From 9aeb204c25874990a1b20d5d37326c42174d19c5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Dec 2025 03:10:31 +0000 Subject: [PATCH 1/5] Initial plan From edfa30705b135bf7a2aa32ceff93e800ed807665 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Dec 2025 03:31:07 +0000 Subject: [PATCH 2/5] Migrate Azure.AI.Language.QuestionAnswering.Authoring to new generator Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- ...uage.QuestionAnswering.Authoring.net8.0.cs | 370 +- ...stionAnswering.Authoring.netstandard2.0.cs | 370 +- ...anguage.QuestionAnswering.Authoring.csproj | 4 +- ...eQuestionAnsweringAuthoringModelFactory.cs | 363 -- .../src/Generated/ActiveLearningFeedback.cs | 66 - ...ientGetDeploymentsAsyncCollectionResult.cs | 92 + ...tGetDeploymentsAsyncCollectionResultOfT.cs | 86 + ...ingClientGetDeploymentsCollectionResult.cs | 91 + ...ClientGetDeploymentsCollectionResultOfT.cs | 85 + ...gClientGetProjectsAsyncCollectionResult.cs | 89 + ...ientGetProjectsAsyncCollectionResultOfT.cs | 83 + ...horingClientGetProjectsCollectionResult.cs | 88 + ...ingClientGetProjectsCollectionResultOfT.cs | 82 + ...oringClientGetQnasAsyncCollectionResult.cs | 95 + ...ngClientGetQnasAsyncCollectionResultOfT.cs | 89 + ...gAuthoringClientGetQnasCollectionResult.cs | 94 + ...thoringClientGetQnasCollectionResultOfT.cs | 88 + ...ngClientGetSourcesAsyncCollectionResult.cs | 92 + ...lientGetSourcesAsyncCollectionResultOfT.cs | 86 + ...thoringClientGetSourcesCollectionResult.cs | 91 + ...ringClientGetSourcesCollectionResultOfT.cs | 85 + ...gClientGetSynonymsAsyncCollectionResult.cs | 92 + ...ientGetSynonymsAsyncCollectionResultOfT.cs | 86 + ...horingClientGetSynonymsCollectionResult.cs | 91 + ...ingClientGetSynonymsCollectionResultOfT.cs | 85 + .../src/Generated/FeedbackRecord.cs | 73 - .../Generated/ImportFiles.Serialization.cs | 180 - .../src/Generated/ImportFiles.cs | 76 - .../src/Generated/ImportJobOptions.cs | 71 - .../src/Generated/Internal/Argument.cs | 75 +- .../Internal/CancellationTokenExtensions.cs | 17 + .../Internal/ChangeTrackingDictionary.cs | 24 +- .../Generated/Internal/ChangeTrackingList.cs | 17 +- .../Internal/ClientPipelineExtensions.cs | 72 + .../Internal/CodeGenMemberAttribute.cs | 20 + .../Internal/CodeGenSerializationAttribute.cs | 48 + .../Internal/CodeGenSuppressAttribute.cs | 29 + .../Internal/CodeGenTypeAttribute.cs | 24 + .../src/Generated/Internal/ErrorResult.cs | 32 + .../Internal/ModelSerializationExtensions.cs | 173 +- ...t.cs => MultiPartFormDataBinaryContent.cs} | 111 +- .../src/Generated/Internal/Optional.cs | 12 +- .../RawRequestUriBuilderExtensions.cs | 23 + .../Internal/RequestContextExtensions.cs | 26 + .../Generated/Internal/SerializationFormat.cs | 49 + .../src/Generated/Internal/TypeFormatters.cs | 180 + .../Internal/Utf8JsonRequestContent.cs | 8 +- .../KnowledgeBaseFile.Serialization.cs | 164 - .../src/Generated/KnowledgeBaseFile.cs | 184 - ...weringAuthoringClientBuilderExtensions.cs} | 32 +- ...eQuestionAnsweringAuthoringModelFactory.cs | 441 +++ .../ActiveLearningFeedback.Serialization.cs | 96 +- .../Models/ActiveLearningFeedback.cs | 37 + .../src/Generated/{ => Models}/AssetKind.cs | 37 +- ...nguageQuestionAnsweringAuthoringContext.cs | 15 +- .../FeedbackRecord.Serialization.cs | 99 +- .../src/Generated/Models/FeedbackRecord.cs | 46 + .../src/Generated/{ => Models}/FileFormat.cs | 47 +- .../ImportJobOptions.Serialization.cs | 106 +- .../src/Generated/Models/ImportJobOptions.cs | 43 + .../ImportQnaRecord.Serialization.cs | 176 +- .../Generated/{ => Models}/ImportQnaRecord.cs | 52 +- .../{ => Models}/KnowledgeBaseSourceKind.cs | 37 +- .../PagedProjectDeployment.Serialization.cs | 175 + .../Models/PagedProjectDeployment.cs | 44 + .../PagedQnaSourceRecord.Serialization.cs | 175 + .../Generated/Models/PagedQnaSourceRecord.cs | 44 + ...nAnsweringProjectMetadata.Serialization.cs | 175 + .../PagedQuestionAnsweringProjectMetadata.cs | 44 + .../PagedRetrieveQnaRecord.Serialization.cs | 175 + .../Models/PagedRetrieveQnaRecord.cs | 44 + .../PagedWordAlterations.Serialization.cs | 175 + .../Generated/Models/PagedWordAlterations.cs | 44 + .../ProjectDeployment.Serialization.cs | 97 +- .../src/Generated/Models/ProjectDeployment.cs | 41 + .../Models/ProjectSettings.Serialization.cs | 140 + .../src/Generated/Models/ProjectSettings.cs | 36 + ...nAnsweringAuthoringAssets.Serialization.cs | 101 +- .../QuestionAnsweringAuthoringAssets.cs | 43 + ...nAnsweringAuthoringDialog.Serialization.cs | 99 +- .../QuestionAnsweringAuthoringDialog.cs | 40 +- ...ngAuthoringExportJobState.Serialization.cs | 246 ++ ...uestionAnsweringAuthoringExportJobState.cs | 58 +- ...ngAuthoringImportJobState.Serialization.cs | 143 +- ...uestionAnsweringAuthoringImportJobState.cs | 54 +- .../QuestionAnsweringAuthoringJobStatus.cs | 62 +- ...ngProjectDeletionJobState.Serialization.cs | 143 +- ...sweringAuthoringProjectDeletionJobState.cs | 54 +- ...ProjectDeploymentJobState.Serialization.cs | 237 ++ ...eringAuthoringProjectDeploymentJobState.cs | 69 + ...nAnsweringAuthoringPrompt.Serialization.cs | 109 +- .../QuestionAnsweringAuthoringPrompt.cs | 42 +- ...nAnsweringAuthoringRecord.Serialization.cs | 162 +- .../QuestionAnsweringAuthoringRecord.cs | 50 +- ...ringAuthoringSourceRecord.Serialization.cs | 116 +- .../QuestionAnsweringAuthoringSourceRecord.cs | 53 +- ...thoringUpdateQnasJobState.Serialization.cs | 237 ++ ...ionAnsweringAuthoringUpdateQnasJobState.cs | 54 +- ...ringUpdateSourcesJobState.Serialization.cs | 237 ++ ...AnsweringAuthoringUpdateSourcesJobState.cs | 54 +- .../QuestionAnsweringProject.Serialization.cs | 143 +- .../{ => Models}/QuestionAnsweringProject.cs | 47 +- .../RetrieveQnaRecord.Serialization.cs | 172 +- .../{ => Models}/RetrieveQnaRecord.cs | 57 +- .../SourceContentStructureKind.cs | 33 +- .../SuggestedQuestion.Serialization.cs | 101 +- .../{ => Models}/SuggestedQuestion.cs | 41 +- ...SuggestedQuestionsCluster.Serialization.cs | 97 +- .../{ => Models}/SuggestedQuestionsCluster.cs | 40 +- .../Models/SynonymAssets.Serialization.cs | 180 + .../src/Generated/Models/SynonymAssets.cs | 47 + .../WordAlterationsGroups.Serialization.cs | 164 + .../Generated/Models/WordAlterationsGroups.cs | 42 + .../src/Generated/ProjectDeployment.cs | 69 - ...ProjectDeploymentJobState.Serialization.cs | 216 -- .../Generated/ProjectDeploymentJobState.cs | 97 - .../ProjectSettings.Serialization.cs | 145 - .../src/Generated/ProjectSettings.cs | 65 - .../QuestionAnsweringAuthoringAssets.cs | 71 - ...tionAnsweringAuthoringClient.RestClient.cs | 576 +++ .../QuestionAnsweringAuthoringClient.cs | 3106 ++++++----------- ...QuestionAnsweringAuthoringClientOptions.cs | 28 +- ...onAnsweringAuthoringError.Serialization.cs | 207 -- .../QuestionAnsweringAuthoringError.cs | 100 - .../QuestionAnsweringAuthoringErrorCode.cs | 99 - ...ngAuthoringExportJobState.Serialization.cs | 225 -- ...uestionAnsweringAuthoringInnerErrorCode.cs | 87 - ...gAuthoringInnerErrorModel.Serialization.cs | 208 -- ...estionAnsweringAuthoringInnerErrorModel.cs | 104 - ...thoringUpdateQnasJobState.Serialization.cs | 216 -- ...ringUpdateSourcesJobState.Serialization.cs | 216 -- .../Generated/SynonymAssets.Serialization.cs | 167 - .../src/Generated/SynonymAssets.cs | 80 - .../WordAlterationsGroups.Serialization.cs | 152 - .../src/Generated/WordAlterationsGroups.cs | 76 - .../src/ImportContentType.cs | 49 + .../src/KnowledgeBaseFile.cs | 15 - .../src/ProjectDeploymentJobState.cs | 12 - .../src/QuestionAnsweringAuthoringClient.cs | 10 +- ...nAnsweringAuthoringClientCustomizations.cs | 27 + .../src/QuestionAnsweringAuthoringError.cs | 12 - .../QuestionAnsweringAuthoringErrorCode.cs | 12 - ...uestionAnsweringAuthoringInnerErrorCode.cs | 12 - ...estionAnsweringAuthoringInnerErrorModel.cs | 12 - .../tsp-location.yaml | 3 +- 145 files changed, 9334 insertions(+), 8071 deletions(-) delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringModelFactory.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CancellationTokenExtensions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ErrorResult.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/{MultipartFormDataRequestContent.cs => MultiPartFormDataBinaryContent.cs} (61%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RawRequestUriBuilderExtensions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RequestContextExtensions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/SerializationFormat.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/TypeFormatters.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{AILanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs => LanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs} (58%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringModelFactory.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/ActiveLearningFeedback.Serialization.cs (51%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/AssetKind.cs (66%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/FeedbackRecord.Serialization.cs (53%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/FileFormat.cs (65%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/ImportJobOptions.Serialization.cs (51%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/ImportQnaRecord.Serialization.cs (55%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/ImportQnaRecord.cs (68%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/KnowledgeBaseSourceKind.cs (68%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/ProjectDeployment.Serialization.cs (51%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringAssets.Serialization.cs (57%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringDialog.Serialization.cs (55%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringDialog.cs (53%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.Serialization.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringExportJobState.cs (57%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringImportJobState.Serialization.cs (50%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringImportJobState.cs (57%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringJobStatus.cs (70%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs (50%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringProjectDeletionJobState.cs (57%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringPrompt.Serialization.cs (54%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringPrompt.cs (54%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringRecord.Serialization.cs (55%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringRecord.cs (64%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringSourceRecord.Serialization.cs (57%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringSourceRecord.cs (60%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringUpdateQnasJobState.cs (57%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringAuthoringUpdateSourcesJobState.cs (57%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringProject.Serialization.cs (57%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/QuestionAnsweringProject.cs (70%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/RetrieveQnaRecord.Serialization.cs (53%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/RetrieveQnaRecord.cs (58%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/SourceContentStructureKind.cs (67%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/SuggestedQuestion.Serialization.cs (52%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/SuggestedQuestion.cs (53%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/SuggestedQuestionsCluster.Serialization.cs (56%) rename sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/{ => Models}/SuggestedQuestionsCluster.cs (50%) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.RestClient.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringErrorCode.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorCode.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SynonymAssets.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SynonymAssets.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.Serialization.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ImportContentType.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/KnowledgeBaseFile.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ProjectDeploymentJobState.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringError.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringErrorCode.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorCode.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorModel.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.net8.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.net8.0.cs index a76d6659f122..30ca27cb495b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.net8.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.net8.0.cs @@ -4,30 +4,17 @@ public partial class ActiveLearningFeedback : System.ClientModel.Primitives.IJso { public ActiveLearningFeedback() { } public System.Collections.Generic.IList Records { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback activeLearningFeedback) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public static partial class AILanguageQuestionAnsweringAuthoringModelFactory - { - public static Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord ImportQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdated = default(System.DateTimeOffset?), string sourceDisplayName = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseFile KnowledgeBaseFile(string contentType = null, string filename = null, System.BinaryData contents = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment ProjectDeployment(string deploymentName = null, System.DateTimeOffset? lastDeployed = default(System.DateTimeOffset?)) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeploymentJobState ProjectDeploymentJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringError QuestionAnsweringAuthoringError(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode code = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel innerError = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState QuestionAnsweringAuthoringExportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdated = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null, string resultUrl = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState QuestionAnsweringAuthoringImportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel QuestionAnsweringAuthoringInnerErrorModel(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode code = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode), string message = null, System.Collections.Generic.IReadOnlyDictionary details = null, string target = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel innererror = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState QuestionAnsweringAuthoringProjectDeletionJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord QuestionAnsweringAuthoringSourceRecord(string displayName = null, string source = null, System.Uri sourceUri = null, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind sourceKind = default(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind), Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind? contentStructureKind = default(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind?), System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState QuestionAnsweringAuthoringUpdateQnasJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState QuestionAnsweringAuthoringUpdateSourcesJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject QuestionAnsweringProject(string projectName = null, string description = null, string language = null, bool? isMultilingualResource = default(bool?), Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings settings = null, System.DateTimeOffset? createdDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastDeployedDateTime = default(System.DateTimeOffset?), bool? isConfiguredSemanticRankingEnabled = default(bool?)) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord RetrieveQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AssetKind : System.IEquatable { @@ -43,6 +30,7 @@ public static partial class AILanguageQuestionAnsweringAuthoringModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind left, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.AssetKind (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind left, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind right) { throw null; } public override string ToString() { throw null; } } @@ -58,7 +46,10 @@ public FeedbackRecord() { } public int? QnaId { get { throw null; } set { } } public string UserId { get { throw null; } set { } } public string UserQuestion { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -81,19 +72,26 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat left, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.FileFormat (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat left, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat right) { throw null; } public override string ToString() { throw null; } } - public partial class ImportFiles : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ImportContentType : System.IEquatable { - public ImportFiles(System.Collections.Generic.IEnumerable files) { } - public System.Collections.Generic.IList Files { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ImportContentType(string value) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType ApplicationJson { get { throw null; } } + public bool Equals(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType 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.QuestionAnswering.Authoring.ImportContentType left, Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType right) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType left, Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType right) { throw null; } + public override string ToString() { throw null; } } public partial class ImportJobOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -101,7 +99,11 @@ public ImportJobOptions() { } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets Assets { get { throw null; } set { } } public System.Uri FileUri { get { throw null; } set { } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject Metadata { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions importJobOptions) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -120,26 +122,16 @@ public ImportQnaRecord(int id) { } public System.Collections.Generic.IList Questions { get { throw null; } } public string Source { get { throw null; } set { } } public string SourceDisplayName { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class KnowledgeBaseFile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KnowledgeBaseFile(System.BinaryData contents) { } - public System.BinaryData Contents { get { throw null; } } - public string ContentType { get { throw null; } set { } } - public string Filename { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseFile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseFile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.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 KnowledgeBaseSourceKind : System.IEquatable { @@ -155,42 +147,59 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind left, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind left, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind right) { throw null; } public override string ToString() { throw null; } } + public static partial class LanguageQuestionAnsweringAuthoringModelFactory + { + public static Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback ActiveLearningFeedback(System.Collections.Generic.IEnumerable records = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord FeedbackRecord(string userId = null, string userQuestion = null, int? qnaId = default(int?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions ImportJobOptions(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets assets = null, System.Uri fileUri = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord ImportQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdated = default(System.DateTimeOffset?), string sourceDisplayName = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment ProjectDeployment(string deploymentName = null, System.DateTimeOffset? lastDeployed = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings ProjectSettings(string defaultAnswer = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets QuestionAnsweringAuthoringAssets(System.Collections.Generic.IEnumerable synonyms = null, System.Collections.Generic.IEnumerable qnas = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog QuestionAnsweringAuthoringDialog(bool? isContextOnly = default(bool?), System.Collections.Generic.IEnumerable prompts = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState QuestionAnsweringAuthoringExportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdated = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null, string resultUrl = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState QuestionAnsweringAuthoringImportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState QuestionAnsweringAuthoringProjectDeletionJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState QuestionAnsweringAuthoringProjectDeploymentJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt QuestionAnsweringAuthoringPrompt(int? displayOrder = default(int?), int? qnaId = default(int?), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord qnaRecord = null, string displayText = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord QuestionAnsweringAuthoringRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord QuestionAnsweringAuthoringSourceRecord(string displayName = null, string source = null, System.Uri sourceUri = null, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind sourceKind = default(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind), Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind? contentStructureKind = default(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind?), System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState QuestionAnsweringAuthoringUpdateQnasJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState QuestionAnsweringAuthoringUpdateSourcesJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject QuestionAnsweringProject(string projectName = null, string description = null, string language = null, bool? isMultilingualResource = default(bool?), Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings settings = null, System.DateTimeOffset? createdDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastDeployedDateTime = default(System.DateTimeOffset?), bool? isConfiguredSemanticRankingEnabled = default(bool?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord RetrieveQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion SuggestedQuestion(string question = null, int? userSuggestedCount = default(int?), int? autoSuggestedCount = default(int?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster SuggestedQuestionsCluster(string clusterHead = null, System.Collections.Generic.IEnumerable suggestedQuestions = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets SynonymAssets(System.Collections.Generic.IEnumerable value = null, System.Uri nextLink = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups WordAlterationsGroups(System.Collections.Generic.IEnumerable alterations = null) { throw null; } + } public partial class ProjectDeployment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ProjectDeployment() { } public string DeploymentName { get { throw null; } } public System.DateTimeOffset? LastDeployed { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ProjectDeploymentJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal ProjectDeploymentJobState() { } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } - public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } - public string JobId { get { throw null; } } - public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeploymentJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeploymentJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class ProjectSettings : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ProjectSettings() { } public string DefaultAnswer { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -202,7 +211,10 @@ public partial class QuestionAnsweringAuthoringAssets : System.ClientModel.Primi public QuestionAnsweringAuthoringAssets() { } public System.Collections.Generic.IList Qnas { get { throw null; } } public System.Collections.Generic.IList Synonyms { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -242,10 +254,14 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual System.Threading.Tasks.Task AddFeedbackAsync(string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateProject(string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task CreateProjectAsync(string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeleteProject(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteProjectAsync(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeployProject(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeployProjectAsync(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation DeleteProject(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Operation DeleteProject(Azure.WaitUntil waitUntil, string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteProjectAsync(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeleteProjectAsync(Azure.WaitUntil waitUntil, string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation DeployProject(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context) { throw null; } + public virtual Azure.Operation DeployProject(Azure.WaitUntil waitUntil, string projectName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeployProjectAsync(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeployProjectAsync(Azure.WaitUntil waitUntil, string projectName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation Export(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation Export(Azure.WaitUntil waitUntil, string projectName, string format, string assetKind, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task ExportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -254,14 +270,14 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.Response GetDeleteStatus(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDeleteStatusAsync(string jobId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetDeleteStatusAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetDeployments(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetDeployments(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeployments(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetDeployments(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDeployStatus(string projectName, string deploymentName, string jobId, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetDeployStatus(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeployStatus(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDeployStatusAsync(string projectName, string deploymentName, string jobId, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetDeployStatusAsync(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeployStatusAsync(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetExportStatus(string projectName, string jobId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetExportStatus(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetExportStatusAsync(string projectName, string jobId, Azure.RequestContext context) { throw null; } @@ -274,22 +290,22 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.Response GetProjectDetails(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetProjectDetailsAsync(string projectName, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetProjectDetailsAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetProjects(int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetProjects(int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetProjectsAsync(int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetProjectsAsync(int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetQnas(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetQnas(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetSources(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetSources(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetSynonyms(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetSynonyms(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProjects(int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetProjects(int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQnas(string projectName, int? top, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetQnas(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? top, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSources(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetSources(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSynonyms(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetSynonyms(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetUpdateQnasStatus(string projectName, string jobId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetUpdateQnasStatus(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetUpdateQnasStatusAsync(string projectName, string jobId, Azure.RequestContext context) { throw null; } @@ -298,13 +314,11 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.Response GetUpdateSourcesStatus(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetUpdateSourcesStatusAsync(string projectName, string jobId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetUpdateSourcesStatusAsync(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Operation Import(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation Import(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType? contentType = default(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation Import(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string format = null, string assetKind = null, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task ImportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ImportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType? contentType = default(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string format = null, string assetKind = null, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation ImportFromFiles(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles body, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation ImportFromFiles(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string contentType, string assetKind = null, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task ImportFromFilesAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles body, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportFromFilesAsync(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string contentType, string assetKind = null, Azure.RequestContext context = null) { throw null; } public virtual Azure.Operation UpdateQnas(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task UpdateQnasAsync(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } @@ -332,73 +346,31 @@ public partial class QuestionAnsweringAuthoringDialog : System.ClientModel.Primi public QuestionAnsweringAuthoringDialog() { } public bool? IsContextOnly { get { throw null; } set { } } public System.Collections.Generic.IList Prompts { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class QuestionAnsweringAuthoringError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal QuestionAnsweringAuthoringError() { } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Code { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Details { get { throw null; } } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel InnerError { get { throw null; } } - public string Message { get { throw null; } } - public string Target { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.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 QuestionAnsweringAuthoringErrorCode : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public QuestionAnsweringAuthoringErrorCode(string value) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchIndexLimitReached { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchIndexNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchThrottling { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Conflict { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Forbidden { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode InternalServerError { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode InvalidArgument { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode InvalidRequest { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode NotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode OperationNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode ProjectNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode QuotaExceeded { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode ServiceUnavailable { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Timeout { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode TooManyRequests { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Unauthorized { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Warning { get { throw null; } } - public bool Equals(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode 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.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode right) { throw null; } - public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode (string value) { throw null; } - public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode right) { throw null; } - public override string ToString() { throw null; } - } public partial class QuestionAnsweringAuthoringExportJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal QuestionAnsweringAuthoringExportJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdated { get { throw null; } } public string ResultUrl { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -409,12 +381,16 @@ public partial class QuestionAnsweringAuthoringImportJobState : System.ClientMod { internal QuestionAnsweringAuthoringImportJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -422,51 +398,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 QuestionAnsweringAuthoringInnerErrorCode : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public QuestionAnsweringAuthoringInnerErrorCode(string value) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode AzureCognitiveSearchNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode AzureCognitiveSearchThrottling { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode EmptyRequest { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode ExtractionFailure { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidCountryHint { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidDocument { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidDocumentBatch { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidParameterValue { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidRequest { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidRequestBodyFormat { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode KnowledgeBaseNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode MissingInputDocuments { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode ModelVersionIncorrect { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode UnsupportedLanguageCode { get { throw null; } } - public bool Equals(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode 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.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode right) { throw null; } - public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode (string value) { throw null; } - public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode right) { throw null; } - public override string ToString() { throw null; } - } - public partial class QuestionAnsweringAuthoringInnerErrorModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal QuestionAnsweringAuthoringInnerErrorModel() { } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode Code { get { throw null; } } - public System.Collections.Generic.IReadOnlyDictionary Details { get { throw null; } } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel Innererror { get { throw null; } } - public string Message { get { throw null; } } - public string Target { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.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 QuestionAnsweringAuthoringJobStatus : System.IEquatable { private readonly object _dummy; @@ -486,6 +417,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus right) { throw null; } public override string ToString() { throw null; } } @@ -493,18 +425,42 @@ public partial class QuestionAnsweringAuthoringProjectDeletionJobState : System. { internal QuestionAnsweringAuthoringProjectDeletionJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class QuestionAnsweringAuthoringProjectDeploymentJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QuestionAnsweringAuthoringProjectDeploymentJobState() { } + public System.DateTimeOffset CreatedDateTime { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } + public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } + public string JobId { get { throw null; } } + public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } + public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class QuestionAnsweringAuthoringPrompt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public QuestionAnsweringAuthoringPrompt() { } @@ -512,7 +468,10 @@ public QuestionAnsweringAuthoringPrompt() { } public string DisplayText { get { throw null; } set { } } public int? QnaId { get { throw null; } set { } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord QnaRecord { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -529,7 +488,10 @@ public QuestionAnsweringAuthoringRecord(int id) { } public System.Collections.Generic.IDictionary Metadata { get { throw null; } } public System.Collections.Generic.IList Questions { get { throw null; } } public string Source { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -545,7 +507,10 @@ internal QuestionAnsweringAuthoringSourceRecord() { } public string Source { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind SourceKind { get { throw null; } } public System.Uri SourceUri { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -556,12 +521,16 @@ public partial class QuestionAnsweringAuthoringUpdateQnasJobState : System.Clien { internal QuestionAnsweringAuthoringUpdateQnasJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -572,12 +541,16 @@ public partial class QuestionAnsweringAuthoringUpdateSourcesJobState : System.Cl { internal QuestionAnsweringAuthoringUpdateSourcesJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -596,7 +569,11 @@ public QuestionAnsweringProject() { } public System.DateTimeOffset? LastModifiedDateTime { get { throw null; } } public string ProjectName { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings Settings { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -606,15 +583,18 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class RetrieveQnaRecord : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RetrieveQnaRecord() { } - public System.Collections.Generic.IReadOnlyList ActiveLearningSuggestionClusters { get { throw null; } } + public System.Collections.Generic.IList ActiveLearningSuggestionClusters { get { throw null; } } public string Answer { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog Dialog { get { throw null; } } public int Id { get { throw null; } } public System.DateTimeOffset? LastUpdatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyDictionary Metadata { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Questions { get { throw null; } } + public System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public System.Collections.Generic.IList Questions { get { throw null; } } public string Source { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -635,6 +615,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind left, Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind left, Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind right) { throw null; } public override string ToString() { throw null; } } @@ -644,7 +625,10 @@ public SuggestedQuestion() { } public int? AutoSuggestedCount { get { throw null; } set { } } public string Question { get { throw null; } set { } } public int? UserSuggestedCount { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -656,7 +640,10 @@ public partial class SuggestedQuestionsCluster : System.ClientModel.Primitives.I public SuggestedQuestionsCluster() { } public string ClusterHead { get { throw null; } set { } } public System.Collections.Generic.IList SuggestedQuestions { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -668,7 +655,11 @@ public partial class SynonymAssets : System.ClientModel.Primitives.IJsonModel value) { } public System.Uri NextLink { get { throw null; } set { } } public System.Collections.Generic.IList Value { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets synonymAssets) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -679,7 +670,10 @@ public partial class WordAlterationsGroups : System.ClientModel.Primitives.IJson { public WordAlterationsGroups(System.Collections.Generic.IEnumerable alterations) { } public System.Collections.Generic.IList Alterations { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -689,7 +683,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } namespace Microsoft.Extensions.Azure { - public static partial class AILanguageQuestionAnsweringAuthoringClientBuilderExtensions + public static partial class LanguageQuestionAnsweringAuthoringClientBuilderExtensions { public static Azure.Core.Extensions.IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.netstandard2.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.netstandard2.0.cs index a09e68993e67..9982b79a343e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.netstandard2.0.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/api/Azure.AI.Language.QuestionAnswering.Authoring.netstandard2.0.cs @@ -4,30 +4,17 @@ public partial class ActiveLearningFeedback : System.ClientModel.Primitives.IJso { public ActiveLearningFeedback() { } public System.Collections.Generic.IList Records { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback activeLearningFeedback) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public static partial class AILanguageQuestionAnsweringAuthoringModelFactory - { - public static Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord ImportQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdated = default(System.DateTimeOffset?), string sourceDisplayName = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseFile KnowledgeBaseFile(string contentType = null, string filename = null, System.BinaryData contents = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment ProjectDeployment(string deploymentName = null, System.DateTimeOffset? lastDeployed = default(System.DateTimeOffset?)) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeploymentJobState ProjectDeploymentJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringError QuestionAnsweringAuthoringError(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode code = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel innerError = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState QuestionAnsweringAuthoringExportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdated = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null, string resultUrl = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState QuestionAnsweringAuthoringImportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel QuestionAnsweringAuthoringInnerErrorModel(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode code = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode), string message = null, System.Collections.Generic.IReadOnlyDictionary details = null, string target = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel innererror = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState QuestionAnsweringAuthoringProjectDeletionJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord QuestionAnsweringAuthoringSourceRecord(string displayName = null, string source = null, System.Uri sourceUri = null, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind sourceKind = default(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind), Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind? contentStructureKind = default(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind?), System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState QuestionAnsweringAuthoringUpdateQnasJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState QuestionAnsweringAuthoringUpdateSourcesJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject QuestionAnsweringProject(string projectName = null, string description = null, string language = null, bool? isMultilingualResource = default(bool?), Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings settings = null, System.DateTimeOffset? createdDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastDeployedDateTime = default(System.DateTimeOffset?), bool? isConfiguredSemanticRankingEnabled = default(bool?)) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord RetrieveQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IReadOnlyDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AssetKind : System.IEquatable { @@ -43,6 +30,7 @@ public static partial class AILanguageQuestionAnsweringAuthoringModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind left, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.AssetKind (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind left, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind right) { throw null; } public override string ToString() { throw null; } } @@ -58,7 +46,10 @@ public FeedbackRecord() { } public int? QnaId { get { throw null; } set { } } public string UserId { get { throw null; } set { } } public string UserQuestion { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -81,19 +72,26 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat left, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.FileFormat (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat left, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat right) { throw null; } public override string ToString() { throw null; } } - public partial class ImportFiles : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ImportContentType : System.IEquatable { - public ImportFiles(System.Collections.Generic.IEnumerable files) { } - public System.Collections.Generic.IList Files { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ImportContentType(string value) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType ApplicationJson { get { throw null; } } + public bool Equals(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType 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.QuestionAnswering.Authoring.ImportContentType left, Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType right) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType left, Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType right) { throw null; } + public override string ToString() { throw null; } } public partial class ImportJobOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -101,7 +99,11 @@ public ImportJobOptions() { } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets Assets { get { throw null; } set { } } public System.Uri FileUri { get { throw null; } set { } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject Metadata { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions importJobOptions) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -120,26 +122,16 @@ public ImportQnaRecord(int id) { } public System.Collections.Generic.IList Questions { get { throw null; } } public string Source { get { throw null; } set { } } public string SourceDisplayName { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class KnowledgeBaseFile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KnowledgeBaseFile(System.BinaryData contents) { } - public System.BinaryData Contents { get { throw null; } } - public string ContentType { get { throw null; } set { } } - public string Filename { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseFile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseFile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.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 KnowledgeBaseSourceKind : System.IEquatable { @@ -155,42 +147,59 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind left, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind left, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind right) { throw null; } public override string ToString() { throw null; } } + public static partial class LanguageQuestionAnsweringAuthoringModelFactory + { + public static Azure.AI.Language.QuestionAnswering.Authoring.ActiveLearningFeedback ActiveLearningFeedback(System.Collections.Generic.IEnumerable records = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.FeedbackRecord FeedbackRecord(string userId = null, string userQuestion = null, int? qnaId = default(int?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions ImportJobOptions(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets assets = null, System.Uri fileUri = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ImportQnaRecord ImportQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdated = default(System.DateTimeOffset?), string sourceDisplayName = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment ProjectDeployment(string deploymentName = null, System.DateTimeOffset? lastDeployed = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings ProjectSettings(string defaultAnswer = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets QuestionAnsweringAuthoringAssets(System.Collections.Generic.IEnumerable synonyms = null, System.Collections.Generic.IEnumerable qnas = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog QuestionAnsweringAuthoringDialog(bool? isContextOnly = default(bool?), System.Collections.Generic.IEnumerable prompts = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState QuestionAnsweringAuthoringExportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdated = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null, string resultUrl = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState QuestionAnsweringAuthoringImportJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState QuestionAnsweringAuthoringProjectDeletionJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState QuestionAnsweringAuthoringProjectDeploymentJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt QuestionAnsweringAuthoringPrompt(int? displayOrder = default(int?), int? qnaId = default(int?), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord qnaRecord = null, string displayText = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord QuestionAnsweringAuthoringRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord QuestionAnsweringAuthoringSourceRecord(string displayName = null, string source = null, System.Uri sourceUri = null, Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind sourceKind = default(Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind), Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind? contentStructureKind = default(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind?), System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState QuestionAnsweringAuthoringUpdateQnasJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState QuestionAnsweringAuthoringUpdateSourcesJobState(System.DateTimeOffset createdDateTime = default(System.DateTimeOffset), System.DateTimeOffset? expirationDateTime = default(System.DateTimeOffset?), string jobId = null, System.DateTimeOffset lastUpdatedDateTime = default(System.DateTimeOffset), Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus status = default(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus), System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject QuestionAnsweringProject(string projectName = null, string description = null, string language = null, bool? isMultilingualResource = default(bool?), Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings settings = null, System.DateTimeOffset? createdDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastDeployedDateTime = default(System.DateTimeOffset?), bool? isConfiguredSemanticRankingEnabled = default(bool?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord RetrieveQnaRecord(int id = 0, string answer = null, string source = null, System.Collections.Generic.IEnumerable questions = null, System.Collections.Generic.IDictionary metadata = null, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog dialog = null, System.Collections.Generic.IEnumerable activeLearningSuggestionClusters = null, System.DateTimeOffset? lastUpdatedDateTime = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion SuggestedQuestion(string question = null, int? userSuggestedCount = default(int?), int? autoSuggestedCount = default(int?)) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster SuggestedQuestionsCluster(string clusterHead = null, System.Collections.Generic.IEnumerable suggestedQuestions = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets SynonymAssets(System.Collections.Generic.IEnumerable value = null, System.Uri nextLink = null) { throw null; } + public static Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups WordAlterationsGroups(System.Collections.Generic.IEnumerable alterations = null) { throw null; } + } public partial class ProjectDeployment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ProjectDeployment() { } public string DeploymentName { get { throw null; } } public System.DateTimeOffset? LastDeployed { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeployment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class ProjectDeploymentJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal ProjectDeploymentJobState() { } - public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } - public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } - public string JobId { get { throw null; } } - public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeploymentJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.ProjectDeploymentJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class ProjectSettings : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ProjectSettings() { } public string DefaultAnswer { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -202,7 +211,10 @@ public partial class QuestionAnsweringAuthoringAssets : System.ClientModel.Primi public QuestionAnsweringAuthoringAssets() { } public System.Collections.Generic.IList Qnas { get { throw null; } } public System.Collections.Generic.IList Synonyms { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringAssets System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -242,10 +254,14 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual System.Threading.Tasks.Task AddFeedbackAsync(string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CreateProject(string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task CreateProjectAsync(string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeleteProject(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteProjectAsync(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeployProject(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeployProjectAsync(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation DeleteProject(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Operation DeleteProject(Azure.WaitUntil waitUntil, string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteProjectAsync(Azure.WaitUntil waitUntil, string projectName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeleteProjectAsync(Azure.WaitUntil waitUntil, string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation DeployProject(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context) { throw null; } + public virtual Azure.Operation DeployProject(Azure.WaitUntil waitUntil, string projectName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeployProjectAsync(Azure.WaitUntil waitUntil, string projectName, string deploymentName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeployProjectAsync(Azure.WaitUntil waitUntil, string projectName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation Export(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation Export(Azure.WaitUntil waitUntil, string projectName, string format, string assetKind, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task ExportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -254,14 +270,14 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.Response GetDeleteStatus(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDeleteStatusAsync(string jobId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetDeleteStatusAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetDeployments(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetDeployments(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeployments(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetDeployments(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetDeploymentsAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDeployStatus(string projectName, string deploymentName, string jobId, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetDeployStatus(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeployStatus(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDeployStatusAsync(string projectName, string deploymentName, string jobId, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task> GetDeployStatusAsync(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeployStatusAsync(string projectName, string deploymentName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetExportStatus(string projectName, string jobId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetExportStatus(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetExportStatusAsync(string projectName, string jobId, Azure.RequestContext context) { throw null; } @@ -274,22 +290,22 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.Response GetProjectDetails(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetProjectDetailsAsync(string projectName, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetProjectDetailsAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetProjects(int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetProjects(int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetProjectsAsync(int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetProjectsAsync(int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetQnas(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetQnas(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetSources(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetSources(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetSynonyms(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetSynonyms(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? maxCount = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProjects(int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetProjects(int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQnas(string projectName, int? top, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetQnas(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? top, int? skip, int? maxpagesize, string source, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetQnasAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), string source = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSources(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetSources(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetSourcesAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSynonyms(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetSynonyms(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? top, int? skip, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetSynonymsAsync(string projectName, int? top = default(int?), int? skip = default(int?), int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetUpdateQnasStatus(string projectName, string jobId, Azure.RequestContext context) { throw null; } public virtual Azure.Response GetUpdateQnasStatus(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetUpdateQnasStatusAsync(string projectName, string jobId, Azure.RequestContext context) { throw null; } @@ -298,13 +314,11 @@ public QuestionAnsweringAuthoringClient(System.Uri endpoint, Azure.Core.TokenCre public virtual Azure.Response GetUpdateSourcesStatus(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetUpdateSourcesStatusAsync(string projectName, string jobId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task> GetUpdateSourcesStatusAsync(string projectName, string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Operation Import(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation Import(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType? contentType = default(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation Import(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string format = null, string assetKind = null, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task ImportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ImportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportJobOptions body = null, Azure.AI.Language.QuestionAnswering.Authoring.FileFormat? format = default(Azure.AI.Language.QuestionAnswering.Authoring.FileFormat?), Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType? contentType = default(Azure.AI.Language.QuestionAnswering.Authoring.ImportContentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportAsync(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string format = null, string assetKind = null, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation ImportFromFiles(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles body, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation ImportFromFiles(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string contentType, string assetKind = null, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task ImportFromFilesAsync(Azure.WaitUntil waitUntil, string projectName, Azure.AI.Language.QuestionAnswering.Authoring.ImportFiles body, Azure.AI.Language.QuestionAnswering.Authoring.AssetKind? assetKind = default(Azure.AI.Language.QuestionAnswering.Authoring.AssetKind?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportFromFilesAsync(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, string contentType, string assetKind = null, Azure.RequestContext context = null) { throw null; } public virtual Azure.Operation UpdateQnas(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task UpdateQnasAsync(Azure.WaitUntil waitUntil, string projectName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } @@ -332,73 +346,31 @@ public partial class QuestionAnsweringAuthoringDialog : System.ClientModel.Primi public QuestionAnsweringAuthoringDialog() { } public bool? IsContextOnly { get { throw null; } set { } } public System.Collections.Generic.IList Prompts { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class QuestionAnsweringAuthoringError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal QuestionAnsweringAuthoringError() { } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Code { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Details { get { throw null; } } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel InnerError { get { throw null; } } - public string Message { get { throw null; } } - public string Target { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.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 QuestionAnsweringAuthoringErrorCode : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public QuestionAnsweringAuthoringErrorCode(string value) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchIndexLimitReached { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchIndexNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchThrottling { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Conflict { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Forbidden { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode InternalServerError { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode InvalidArgument { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode InvalidRequest { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode NotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode OperationNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode ProjectNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode QuotaExceeded { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode ServiceUnavailable { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Timeout { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode TooManyRequests { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Unauthorized { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode Warning { get { throw null; } } - public bool Equals(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode 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.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode right) { throw null; } - public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode (string value) { throw null; } - public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringErrorCode right) { throw null; } - public override string ToString() { throw null; } - } public partial class QuestionAnsweringAuthoringExportJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal QuestionAnsweringAuthoringExportJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdated { get { throw null; } } public string ResultUrl { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringExportJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -409,12 +381,16 @@ public partial class QuestionAnsweringAuthoringImportJobState : System.ClientMod { internal QuestionAnsweringAuthoringImportJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringImportJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -422,51 +398,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 QuestionAnsweringAuthoringInnerErrorCode : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public QuestionAnsweringAuthoringInnerErrorCode(string value) { throw null; } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode AzureCognitiveSearchNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode AzureCognitiveSearchThrottling { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode EmptyRequest { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode ExtractionFailure { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidCountryHint { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidDocument { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidDocumentBatch { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidParameterValue { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidRequest { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode InvalidRequestBodyFormat { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode KnowledgeBaseNotFound { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode MissingInputDocuments { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode ModelVersionIncorrect { get { throw null; } } - public static Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode UnsupportedLanguageCode { get { throw null; } } - public bool Equals(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode 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.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode right) { throw null; } - public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode (string value) { throw null; } - public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode right) { throw null; } - public override string ToString() { throw null; } - } - public partial class QuestionAnsweringAuthoringInnerErrorModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - internal QuestionAnsweringAuthoringInnerErrorModel() { } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorCode Code { get { throw null; } } - public System.Collections.Generic.IReadOnlyDictionary Details { get { throw null; } } - public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel Innererror { get { throw null; } } - public string Message { get { throw null; } } - public string Target { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringInnerErrorModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.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 QuestionAnsweringAuthoringJobStatus : System.IEquatable { private readonly object _dummy; @@ -486,6 +417,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus left, Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus right) { throw null; } public override string ToString() { throw null; } } @@ -493,18 +425,42 @@ public partial class QuestionAnsweringAuthoringProjectDeletionJobState : System. { internal QuestionAnsweringAuthoringProjectDeletionJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeletionJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class QuestionAnsweringAuthoringProjectDeploymentJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QuestionAnsweringAuthoringProjectDeploymentJobState() { } + public System.DateTimeOffset CreatedDateTime { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } + public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } + public string JobId { get { throw null; } } + public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } + public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringProjectDeploymentJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class QuestionAnsweringAuthoringPrompt : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public QuestionAnsweringAuthoringPrompt() { } @@ -512,7 +468,10 @@ public QuestionAnsweringAuthoringPrompt() { } public string DisplayText { get { throw null; } set { } } public int? QnaId { get { throw null; } set { } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord QnaRecord { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringPrompt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -529,7 +488,10 @@ public QuestionAnsweringAuthoringRecord(int id) { } public System.Collections.Generic.IDictionary Metadata { get { throw null; } } public System.Collections.Generic.IList Questions { get { throw null; } } public string Source { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -545,7 +507,10 @@ internal QuestionAnsweringAuthoringSourceRecord() { } public string Source { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.KnowledgeBaseSourceKind SourceKind { get { throw null; } } public System.Uri SourceUri { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringSourceRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -556,12 +521,16 @@ public partial class QuestionAnsweringAuthoringUpdateQnasJobState : System.Clien { internal QuestionAnsweringAuthoringUpdateQnasJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateQnasJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -572,12 +541,16 @@ public partial class QuestionAnsweringAuthoringUpdateSourcesJobState : System.Cl { internal QuestionAnsweringAuthoringUpdateSourcesJobState() { } public System.DateTimeOffset CreatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset? ExpirationDateTime { get { throw null; } } public string JobId { get { throw null; } } public System.DateTimeOffset LastUpdatedDateTime { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringJobStatus Status { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringUpdateSourcesJobState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -596,7 +569,11 @@ public QuestionAnsweringProject() { } public System.DateTimeOffset? LastModifiedDateTime { get { throw null; } } public string ProjectName { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.ProjectSettings Settings { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject (Azure.Response response) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringProject System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -606,15 +583,18 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class RetrieveQnaRecord : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RetrieveQnaRecord() { } - public System.Collections.Generic.IReadOnlyList ActiveLearningSuggestionClusters { get { throw null; } } + public System.Collections.Generic.IList ActiveLearningSuggestionClusters { get { throw null; } } public string Answer { get { throw null; } } public Azure.AI.Language.QuestionAnswering.Authoring.QuestionAnsweringAuthoringDialog Dialog { get { throw null; } } public int Id { get { throw null; } } public System.DateTimeOffset? LastUpdatedDateTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyDictionary Metadata { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Questions { get { throw null; } } + public System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public System.Collections.Generic.IList Questions { get { throw null; } } public string Source { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.RetrieveQnaRecord System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -635,6 +615,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind left, Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind right) { throw null; } public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind (string value) { throw null; } + public static implicit operator Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind? (string value) { throw null; } public static bool operator !=(Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind left, Azure.AI.Language.QuestionAnswering.Authoring.SourceContentStructureKind right) { throw null; } public override string ToString() { throw null; } } @@ -644,7 +625,10 @@ public SuggestedQuestion() { } public int? AutoSuggestedCount { get { throw null; } set { } } public string Question { get { throw null; } set { } } public int? UserSuggestedCount { get { throw null; } set { } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestion System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -656,7 +640,10 @@ public partial class SuggestedQuestionsCluster : System.ClientModel.Primitives.I public SuggestedQuestionsCluster() { } public string ClusterHead { get { throw null; } set { } } public System.Collections.Generic.IList SuggestedQuestions { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.SuggestedQuestionsCluster System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -668,7 +655,11 @@ public partial class SynonymAssets : System.ClientModel.Primitives.IJsonModel value) { } public System.Uri NextLink { get { throw null; } set { } } public System.Collections.Generic.IList Value { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets synonymAssets) { throw null; } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.SynonymAssets System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -679,7 +670,10 @@ public partial class WordAlterationsGroups : System.ClientModel.Primitives.IJson { public WordAlterationsGroups(System.Collections.Generic.IEnumerable alterations) { } public System.Collections.Generic.IList Alterations { get { throw null; } } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Language.QuestionAnswering.Authoring.WordAlterationsGroups System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -689,7 +683,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } namespace Microsoft.Extensions.Azure { - public static partial class AILanguageQuestionAnsweringAuthoringClientBuilderExtensions + public static partial class LanguageQuestionAnsweringAuthoringClientBuilderExtensions { public static Azure.Core.Extensions.IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Azure.AI.Language.QuestionAnswering.Authoring.csproj b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Azure.AI.Language.QuestionAnswering.Authoring.csproj index 6d73374ead74..626a0edcd961 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Azure.AI.Language.QuestionAnswering.Authoring.csproj +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Azure.AI.Language.QuestionAnswering.Authoring.csproj @@ -6,8 +6,7 @@ Azure.AI.Language.QuestionAnswering.Authoring $(RequiredTargetFrameworks) true - $(NoWarn);AZC0034;AZC0012 - true + $(NoWarn);AZC0034 @@ -15,7 +14,6 @@ - diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringModelFactory.cs deleted file mode 100644 index 74fd927a1b1d..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringModelFactory.cs +++ /dev/null @@ -1,363 +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.Language.QuestionAnswering.Authoring -{ - /// Model factory for models. - public static partial class AILanguageQuestionAnsweringAuthoringModelFactory - { - /// Initializes a new instance of . - /// Name of the project. - /// Description of the project. - /// - /// Language of the text records. This is BCP-47 representation of a language. For - /// example, use "en" for English; "es" for Spanish etc. If not set, use "en" for - /// English as default. - /// - /// Resource enabled for multiple languages across projects or not. - /// Configurable settings of the Project. - /// Project creation date-time. - /// Represents the project last modified date-time. - /// Represents the project last deployment date-time. - /// Represents if semantic ranking is configured. - /// A new instance for mocking. - public static QuestionAnsweringProject QuestionAnsweringProject(string projectName = null, string description = null, string language = null, bool? isMultilingualResource = null, ProjectSettings settings = null, DateTimeOffset? createdDateTime = null, DateTimeOffset? lastModifiedDateTime = null, DateTimeOffset? lastDeployedDateTime = null, bool? isConfiguredSemanticRankingEnabled = null) - { - return new QuestionAnsweringProject( - projectName, - description, - language, - isMultilingualResource, - settings, - createdDateTime, - lastModifiedDateTime, - lastDeployedDateTime, - isConfiguredSemanticRankingEnabled, - 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 QuestionAnsweringAuthoringError QuestionAnsweringAuthoringError(QuestionAnsweringAuthoringErrorCode code = default, string message = null, string target = null, IEnumerable details = null, QuestionAnsweringAuthoringInnerErrorModel innerError = null) - { - details ??= new List(); - - return new QuestionAnsweringAuthoringError( - 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 QuestionAnsweringAuthoringInnerErrorModel QuestionAnsweringAuthoringInnerErrorModel(QuestionAnsweringAuthoringInnerErrorCode code = default, string message = null, IReadOnlyDictionary details = null, string target = null, QuestionAnsweringAuthoringInnerErrorModel innererror = null) - { - details ??= new Dictionary(); - - return new QuestionAnsweringAuthoringInnerErrorModel( - code, - message, - details, - target, - innererror, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// A new instance for mocking. - public static QuestionAnsweringAuthoringProjectDeletionJobState QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, string jobId = null, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = null) - { - errors ??= new List(); - - return new QuestionAnsweringAuthoringProjectDeletionJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// URL to download the result of the Export Job. - /// A new instance for mocking. - public static QuestionAnsweringAuthoringExportJobState QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, string jobId = null, DateTimeOffset lastUpdated = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = null, string resultUrl = null) - { - errors ??= new List(); - - return new QuestionAnsweringAuthoringExportJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdated, - status, - errors?.ToList(), - resultUrl, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Unique ID for the QnA. - /// Answer text. - /// - /// Source from which QnA was indexed e.g. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . - /// - /// List of questions associated with the answer. - /// - /// Metadata associated with the answer, useful to categorize or filter question - /// answers. - /// - /// Context of a QnA. - /// List of Active Learning suggestions for the QnA. - /// Date-time when the QnA was last updated. - /// Friendly name of the Source. - /// A new instance for mocking. - public static ImportQnaRecord ImportQnaRecord(int id = default, string answer = null, string source = null, IEnumerable questions = null, IDictionary metadata = null, QuestionAnsweringAuthoringDialog dialog = null, IEnumerable activeLearningSuggestionClusters = null, DateTimeOffset? lastUpdated = null, string sourceDisplayName = null) - { - questions ??= new List(); - metadata ??= new Dictionary(); - activeLearningSuggestionClusters ??= new List(); - - return new ImportQnaRecord( - id, - answer, - source, - questions?.ToList(), - metadata, - dialog, - activeLearningSuggestionClusters?.ToList(), - lastUpdated, - sourceDisplayName, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// A new instance for mocking. - public static QuestionAnsweringAuthoringImportJobState QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, string jobId = null, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = null) - { - errors ??= new List(); - - return new QuestionAnsweringAuthoringImportJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// A new instance for mocking. - public static KnowledgeBaseFile KnowledgeBaseFile(string contentType = null, string filename = null, BinaryData contents = null) - { - return new KnowledgeBaseFile(contentType, filename, contents, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// A new instance for mocking. - public static ProjectDeploymentJobState ProjectDeploymentJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, string jobId = null, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = null) - { - errors ??= new List(); - - return new ProjectDeploymentJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Name of the deployment. - /// Represents the project last deployment date-time. - /// A new instance for mocking. - public static ProjectDeployment ProjectDeployment(string deploymentName = null, DateTimeOffset? lastDeployed = null) - { - return new ProjectDeployment(deploymentName, lastDeployed, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Friendly name of the Source. - /// - /// Unique source identifier. Name of the file if it's a 'file' source; otherwise, - /// the complete URL if it's a 'url' source. - /// - /// URI location for the file or url. - /// Supported source types. - /// Content structure type for sources. - /// Date-time when the QnA was last updated. - /// A new instance for mocking. - public static QuestionAnsweringAuthoringSourceRecord QuestionAnsweringAuthoringSourceRecord(string displayName = null, string source = null, Uri sourceUri = null, KnowledgeBaseSourceKind sourceKind = default, SourceContentStructureKind? contentStructureKind = null, DateTimeOffset? lastUpdatedDateTime = null) - { - return new QuestionAnsweringAuthoringSourceRecord( - displayName, - source, - sourceUri, - sourceKind, - contentStructureKind, - lastUpdatedDateTime, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// A new instance for mocking. - public static QuestionAnsweringAuthoringUpdateSourcesJobState QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, string jobId = null, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = null) - { - errors ??= new List(); - - return new QuestionAnsweringAuthoringUpdateSourcesJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Unique ID for the QnA. - /// Answer text. - /// - /// Source from which QnA was indexed e.g. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . - /// - /// List of questions associated with the answer. - /// - /// Metadata associated with the answer, useful to categorize or filter question - /// answers. - /// - /// Context of a QnA. - /// List of Active Learning suggestions for the QnA. - /// Date-time when the QnA was last updated. - /// A new instance for mocking. - public static RetrieveQnaRecord RetrieveQnaRecord(int id = default, string answer = null, string source = null, IEnumerable questions = null, IReadOnlyDictionary metadata = null, QuestionAnsweringAuthoringDialog dialog = null, IEnumerable activeLearningSuggestionClusters = null, DateTimeOffset? lastUpdatedDateTime = null) - { - questions ??= new List(); - metadata ??= new Dictionary(); - activeLearningSuggestionClusters ??= new List(); - - return new RetrieveQnaRecord( - id, - answer, - source, - questions?.ToList(), - metadata, - dialog, - activeLearningSuggestionClusters?.ToList(), - lastUpdatedDateTime, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// A new instance for mocking. - public static QuestionAnsweringAuthoringUpdateQnasJobState QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, string jobId = null, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = null) - { - errors ??= new List(); - - return new QuestionAnsweringAuthoringUpdateQnasJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors?.ToList(), - serializedAdditionalRawData: null); - } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.cs deleted file mode 100644 index da4da9555946..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.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.Collections.Generic; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - /// Feedback for Active Learning. - public partial class ActiveLearningFeedback - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 ActiveLearningFeedback() - { - Records = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// A list of Feedback Records for Active Learning. - /// Keeps track of any properties unknown to the library. - internal ActiveLearningFeedback(IList records, IDictionary serializedAdditionalRawData) - { - Records = records; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A list of Feedback Records for Active Learning. - public IList Records { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult.cs new file mode 100644 index 000000000000..2da463670fa2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedProjectDeployment result = (PagedProjectDeployment)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeploymentsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetDeploymentsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployments"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..df62a2570276 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT.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.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedProjectDeployment result = (PagedProjectDeployment)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeploymentsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetDeploymentsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployments"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult.cs new file mode 100644 index 000000000000..ee0960d628eb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedProjectDeployment result = (PagedProjectDeployment)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeploymentsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetDeploymentsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployments"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT.cs new file mode 100644 index 000000000000..757be56947ca --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT.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; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedProjectDeployment result = (PagedProjectDeployment)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeploymentsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetDeploymentsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployments"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult.cs new file mode 100644 index 000000000000..def949028aab --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult(QuestionAnsweringAuthoringClient client, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedQuestionAnsweringProjectMetadata result = (PagedQuestionAnsweringProjectMetadata)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetProjectsRequest(nextLink, _top, _skip, _maxpagesize, _context) : _client.CreateGetProjectsRequest(_top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjects"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..2840560b9132 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT(QuestionAnsweringAuthoringClient client, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedQuestionAnsweringProjectMetadata result = (PagedQuestionAnsweringProjectMetadata)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetProjectsRequest(nextLink, _top, _skip, _maxpagesize, _context) : _client.CreateGetProjectsRequest(_top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjects"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResult.cs new file mode 100644 index 000000000000..34a1272118e7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResult.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetProjectsCollectionResult : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetProjectsCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetProjectsCollectionResult(QuestionAnsweringAuthoringClient client, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetProjectsCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetProjectsCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedQuestionAnsweringProjectMetadata result = (PagedQuestionAnsweringProjectMetadata)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetProjectsRequest(nextLink, _top, _skip, _maxpagesize, _context) : _client.CreateGetProjectsRequest(_top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjects"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT.cs new file mode 100644 index 000000000000..0c9ceb7846f4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT.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; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT(QuestionAnsweringAuthoringClient client, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedQuestionAnsweringProjectMetadata result = (PagedQuestionAnsweringProjectMetadata)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetProjectsRequest(nextLink, _top, _skip, _maxpagesize, _context) : _client.CreateGetProjectsRequest(_top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjects"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult.cs new file mode 100644 index 000000000000..db3a96d8a373 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly string _source; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _source = source; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedRetrieveQnaRecord result = (PagedRetrieveQnaRecord)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetQnasRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _source, _context) : _client.CreateGetQnasRequest(_projectName, _top, _skip, _maxpagesize, _source, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetQnas"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..9ae4fa2b0cc9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly string _source; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _source = source; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedRetrieveQnaRecord result = (PagedRetrieveQnaRecord)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetQnasRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _source, _context) : _client.CreateGetQnasRequest(_projectName, _top, _skip, _maxpagesize, _source, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetQnas"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResult.cs new file mode 100644 index 000000000000..fa6e0f6d0dba --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetQnasCollectionResult : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly string _source; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetQnasCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetQnasCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _source = source; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetQnasCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetQnasCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedRetrieveQnaRecord result = (PagedRetrieveQnaRecord)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetQnasRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _source, _context) : _client.CreateGetQnasRequest(_projectName, _top, _skip, _maxpagesize, _source, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetQnas"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT.cs new file mode 100644 index 000000000000..0bdbc3e603e1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT.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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly string _source; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _source = source; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedRetrieveQnaRecord result = (PagedRetrieveQnaRecord)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetQnasRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _source, _context) : _client.CreateGetQnasRequest(_projectName, _top, _skip, _maxpagesize, _source, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetQnas"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult.cs new file mode 100644 index 000000000000..bb159502f208 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedQnaSourceRecord result = (PagedQnaSourceRecord)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSourcesRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSourcesRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSources"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..b4fc0fb4a8a7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT.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.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedQnaSourceRecord result = (PagedQnaSourceRecord)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSourcesRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSourcesRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSources"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResult.cs new file mode 100644 index 000000000000..a5132756ca39 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResult.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSourcesCollectionResult : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSourcesCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSourcesCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSourcesCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSourcesCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedQnaSourceRecord result = (PagedQnaSourceRecord)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSourcesRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSourcesRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSources"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT.cs new file mode 100644 index 000000000000..2a79e514fca4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT.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; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedQnaSourceRecord result = (PagedQnaSourceRecord)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSourcesRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSourcesRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSources"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult.cs new file mode 100644 index 000000000000..1e94dc46b8a9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedWordAlterations result = (PagedWordAlterations)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSynonymsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSynonymsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSynonyms"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..c121eeb82d20 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT.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.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT : AsyncPageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + PagedWordAlterations result = (PagedWordAlterations)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSynonymsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSynonymsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSynonyms"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResult.cs new file mode 100644 index 000000000000..3c75327c9bf0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResult.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSynonymsCollectionResult : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSynonymsCollectionResult, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSynonymsCollectionResult(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSynonymsCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSynonymsCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedWordAlterations result = (PagedWordAlterations)response; + List items = new List(); + foreach (var item in result.Value) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSynonymsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSynonymsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSynonyms"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT.cs new file mode 100644 index 000000000000..897515bc0d44 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/CollectionResults/QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT.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; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT : Pageable + { + private readonly QuestionAnsweringAuthoringClient _client; + private readonly string _projectName; + private readonly int? _top; + private readonly int? _skip; + private readonly int? _maxpagesize; + private readonly RequestContext _context; + + /// Initializes a new instance of QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The QuestionAnsweringAuthoringClient client used to send requests. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT(QuestionAnsweringAuthoringClient client, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _projectName = projectName; + _top = top; + _skip = skip; + _maxpagesize = maxpagesize; + _context = context; + } + + /// Gets the pages of QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + PagedWordAlterations result = (PagedWordAlterations)response; + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetSynonymsRequest(nextLink, _projectName, _top, _skip, _maxpagesize, _context) : _client.CreateGetSynonymsRequest(_projectName, _top, _skip, _maxpagesize, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetSynonyms"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.cs deleted file mode 100644 index 93d657602ff8..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.cs +++ /dev/null @@ -1,73 +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.Language.QuestionAnswering.Authoring -{ - /// Feedback Record for Active Learning. - public partial class FeedbackRecord - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 FeedbackRecord() - { - } - - /// Initializes a new instance of . - /// Unique identifier of the user. - /// User suggested question for the QnA. - /// Unique ID of the QnA. - /// Keeps track of any properties unknown to the library. - internal FeedbackRecord(string userId, string userQuestion, int? qnaId, IDictionary serializedAdditionalRawData) - { - UserId = userId; - UserQuestion = userQuestion; - QnaId = qnaId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Unique identifier of the user. - public string UserId { get; set; } - /// User suggested question for the QnA. - public string UserQuestion { get; set; } - /// Unique ID of the QnA. - public int? QnaId { get; set; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.Serialization.cs deleted file mode 100644 index e7ae0c065342..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.Serialization.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class ImportFiles : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ImportFiles)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("files"u8); - writer.WriteStartArray(); - foreach (var item in Files) - { - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ImportFiles IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ImportFiles)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeImportFiles(document.RootElement, options); - } - - internal static ImportFiles DeserializeImportFiles(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList files = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("files"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(KnowledgeBaseFile.DeserializeKnowledgeBaseFile(item, options)); - } - files = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ImportFiles(files, serializedAdditionalRawData); - } - - private BinaryData SerializeMultipart(ModelReaderWriterOptions options) - { - using MultipartFormDataRequestContent content = ToMultipartRequestContent(); - using MemoryStream stream = new MemoryStream(); - content.WriteTo(stream); - if (stream.Position > int.MaxValue) - { - return BinaryData.FromStream(stream); - } - else - { - return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); - } - } - - internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() - { - MultipartFormDataRequestContent content = new MultipartFormDataRequestContent(); - foreach (KnowledgeBaseFile item in Files) - { - content.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAILanguageQuestionAnsweringAuthoringContext.Default), "files"); - } - return content; - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - case "MFD": - return SerializeMultipart(options); - default: - throw new FormatException($"The model {nameof(ImportFiles)} does not support writing '{options.Format}' format."); - } - } - - ImportFiles IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeImportFiles(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ImportFiles)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ImportFiles FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeImportFiles(document.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.QuestionAnswering.Authoring/src/Generated/ImportFiles.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.cs deleted file mode 100644 index a70213831cc5..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportFiles.cs +++ /dev/null @@ -1,76 +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.Language.QuestionAnswering.Authoring -{ - /// Collection of files containing project assets that need to be imported. - public partial class ImportFiles - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 . - /// Collection of files where the fileName is required. - /// is null. - public ImportFiles(IEnumerable files) - { - Argument.AssertNotNull(files, nameof(files)); - - Files = files.ToList(); - } - - /// Initializes a new instance of . - /// Collection of files where the fileName is required. - /// Keeps track of any properties unknown to the library. - internal ImportFiles(IList files, IDictionary serializedAdditionalRawData) - { - Files = files; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ImportFiles() - { - } - - /// Collection of files where the fileName is required. - public IList Files { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.cs deleted file mode 100644 index 993576f7af6a..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.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.Language.QuestionAnswering.Authoring -{ - /// Project assets that need to be imported. - public partial class ImportJobOptions - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 ImportJobOptions() - { - } - - /// Initializes a new instance of . - /// Parameters needed to create the project. - /// All assets for this project. - /// Import data File URI. - /// Keeps track of any properties unknown to the library. - internal ImportJobOptions(QuestionAnsweringProject metadata, QuestionAnsweringAuthoringAssets assets, Uri fileUri, IDictionary serializedAdditionalRawData) - { - Metadata = metadata; - Assets = assets; - FileUri = fileUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Parameters needed to create the project. - public QuestionAnsweringProject Metadata { get; set; } - /// All assets for this project. - public QuestionAnsweringAuthoringAssets Assets { get; set; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Argument.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Argument.cs index f2bb6e6d3881..864807074835 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Argument.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal static class Argument + internal static partial class Argument { + /// The value. + /// The name. public static void AssertNotNull(T value, string name) { if (value is null) @@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name) } } + /// The value. + /// The name. public static void AssertNotNull(T? value, string name) - where T : struct + where T : struct { if (!value.HasValue) { @@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(IEnumerable value, string name) { if (value is null) @@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(string value, string name) { if (value is null) @@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name) throw new ArgumentException("Value cannot be an empty string.", name); } } - - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - public static void AssertNotDefault(ref T value, string name) - where T : struct, IEquatable - { - if (value.Equals(default)) - { - throw new ArgumentException("Value cannot be empty.", name); - } - } - - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - public static void AssertEnumDefined(Type enumType, object value, string name) - { - if (!Enum.IsDefined(enumType, value)) - { - throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); - } - } - - public static T CheckNotNull(T value, string name) - where T : class - { - AssertNotNull(value, name); - return value; - } - - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - - public static void AssertNull(T value, string name, string message = null) - { - if (value != null) - { - throw new ArgumentException(message ?? "Value must be null.", name); - } - } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CancellationTokenExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CancellationTokenExtensions.cs new file mode 100644 index 000000000000..687f32ee0d26 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CancellationTokenExtensions.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal static partial class CancellationTokenExtensions + { + public static RequestContext ToRequestContext(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingDictionary.cs index a95cfdefa577..630fd14130a7 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingList.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingList.cs index 05e33507650c..efffd3dc985c 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..6351a2c79cf4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..72778edeb7e4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..dfcabf517497 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..38d536e69173 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..f36b5f513173 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ErrorResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..4bd15997eff2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ModelSerializationExtensions.cs index 163fc7ac1a90..3240657101d9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/ModelSerializationExtensions.cs @@ -11,18 +11,16 @@ using System.Diagnostics; using System.Globalization; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary 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(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + 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"); + 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(); + string 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}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - 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.QuestionAnswering.Authoring/src/Generated/Internal/MultipartFormDataRequestContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/MultiPartFormDataBinaryContent.cs similarity index 61% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/MultipartFormDataRequestContent.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/MultiPartFormDataBinaryContent.cs index 5957f5b33977..37cc7738ab29 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/MultipartFormDataRequestContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/MultiPartFormDataBinaryContent.cs @@ -17,17 +17,18 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal class MultipartFormDataRequestContent : RequestContent + internal partial class MultiPartFormDataBinaryContent : RequestContent { - private readonly System.Net.Http.MultipartFormDataContent _multipartContent; + private readonly MultipartFormDataContent _multipartContent; private static readonly Random _random = new Random(); private static readonly char[] _boundaryValues = "0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".ToCharArray(); - public MultipartFormDataRequestContent() + public MultiPartFormDataBinaryContent() { - _multipartContent = new System.Net.Http.MultipartFormDataContent(CreateBoundary()); + _multipartContent = new MultipartFormDataContent(CreateBoundary()); } + /// Gets the ContentType. public string ContentType { get @@ -36,6 +37,7 @@ public string ContentType } } + /// Gets the HttpContent. internal HttpContent HttpContent => _multipartContent; private static string CreateBoundary() @@ -44,14 +46,19 @@ private static string CreateBoundary() byte[] random = new byte[70]; _random.NextBytes(random); int mask = 255 >> 2; - for (int i = 0; i < 70; i++) + int i = 0; + for (; i < 70; i++) { chars[i] = _boundaryValues[random[i] & mask]; } return chars.ToString(); } - public void Add(string content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(string content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -59,7 +66,11 @@ public void Add(string content, string name, string filename = null, string cont Add(new StringContent(content), name, filename, contentType); } - public void Add(int content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(int content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -68,7 +79,11 @@ public void Add(int content, string name, string filename = null, string content Add(new StringContent(value), name, filename, contentType); } - public void Add(long content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(long content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -77,7 +92,11 @@ public void Add(long content, string name, string filename = null, string conten Add(new StringContent(value), name, filename, contentType); } - public void Add(float content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(float content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -86,7 +105,11 @@ public void Add(float content, string name, string filename = null, string conte Add(new StringContent(value), name, filename, contentType); } - public void Add(double content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(double content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -95,7 +118,11 @@ public void Add(double content, string name, string filename = null, string cont Add(new StringContent(value), name, filename, contentType); } - public void Add(decimal content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(decimal content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -104,7 +131,11 @@ public void Add(decimal content, string name, string filename = null, string con Add(new StringContent(value), name, filename, contentType); } - public void Add(bool content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(bool content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -113,7 +144,11 @@ public void Add(bool content, string name, string filename = null, string conten Add(new StringContent(value), name, filename, contentType); } - public void Add(Stream content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(Stream content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -121,7 +156,11 @@ public void Add(Stream content, string name, string filename = null, string cont Add(new StreamContent(content), name, filename, contentType); } - public void Add(byte[] content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(byte[] content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -129,7 +168,11 @@ public void Add(byte[] content, string name, string filename = null, string cont Add(new ByteArrayContent(content), name, filename, contentType); } - public void Add(BinaryData content, string name, string filename = null, string contentType = null) + /// + /// + /// + /// + public void Add(BinaryData content, string name, string filename = default, string contentType = default) { Argument.AssertNotNull(content, nameof(content)); Argument.AssertNotNullOrEmpty(name, nameof(name)); @@ -137,33 +180,37 @@ public void Add(BinaryData content, string name, string filename = null, string Add(new ByteArrayContent(content.ToArray()), name, filename, contentType); } + /// + /// + /// + /// private void Add(HttpContent content, string name, string filename, string contentType) { + if (contentType != null) + { + Argument.AssertNotNullOrEmpty(contentType, nameof(contentType)); + AddContentTypeHeader(content, contentType); + } if (filename != null) { Argument.AssertNotNullOrEmpty(filename, nameof(filename)); - AddFilenameHeader(content, name, filename); + _multipartContent.Add(content, name, filename); } - if (contentType != null) + else { - Argument.AssertNotNullOrEmpty(contentType, nameof(contentType)); - AddContentTypeHeader(content, contentType); + _multipartContent.Add(content, name); } - _multipartContent.Add(content, name); - } - - public static void AddFilenameHeader(HttpContent content, string name, string filename) - { - ContentDispositionHeaderValue header = new ContentDispositionHeaderValue("form-data") { Name = name, FileName = filename }; - content.Headers.ContentDisposition = header; } + /// + /// public static void AddContentTypeHeader(HttpContent content, string contentType) { MediaTypeHeaderValue header = new MediaTypeHeaderValue(contentType); content.Headers.ContentType = header; } + /// public override bool TryComputeLength(out long length) { if (_multipartContent.Headers.ContentLength is long contentLength) @@ -175,21 +222,25 @@ public override bool TryComputeLength(out long length) return false; } + /// + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { #if NET6_0_OR_GREATER - _multipartContent.CopyTo(stream, default, cancellationToken); + _multipartContent.CopyTo(stream, default, cancellationToken); #else -#pragma warning disable AZC0107 +#pragma warning disable AZC0107 // Public asynchronous method shouldn't be called in synchronous scope. Use synchronous version of the method if it is available. _multipartContent.CopyToAsync(stream).EnsureCompleted(); -#pragma warning restore AZC0107 +#pragma warning restore AZC0107 // Public asynchronous method shouldn't be called in synchronous scope. Use synchronous version of the method if it is available. #endif } + /// + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { #if NET6_0_OR_GREATER - await _multipartContent.CopyToAsync(stream, cancellationToken).ConfigureAwait(false); + await _multipartContent.CopyToAsync(stream, cancellationToken).ConfigureAwait(false); #else await _multipartContent.CopyToAsync(stream).ConfigureAwait(false); #endif diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Optional.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Optional.cs index f36a5fc0ef95..609e07d0d94e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Optional.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..796959cb9c8d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RequestContextExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..2460bcf887c8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/SerializationFormat.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..a06fa07cdddf --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/TypeFormatters.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..193e05efe04f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + internal static partial 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}. Generated clients require 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" => System.Xml.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" => System.Xml.XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return 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 formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => System.Xml.XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Utf8JsonRequestContent.cs index 977c454f39ed..810da75aad66 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. 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; diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.Serialization.cs deleted file mode 100644 index 3c2c31c101a8..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.Serialization.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class KnowledgeBaseFile : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KnowledgeBaseFile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ContentType)) - { - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - } - if (Optional.IsDefined(Filename)) - { - writer.WritePropertyName("filename"u8); - writer.WriteStringValue(Filename); - } - writer.WritePropertyName("contents"u8); - writer.WriteBase64StringValue(Contents.ToArray(), "D"); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KnowledgeBaseFile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KnowledgeBaseFile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKnowledgeBaseFile(document.RootElement, options); - } - - internal static KnowledgeBaseFile DeserializeKnowledgeBaseFile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string contentType = default; - string filename = default; - BinaryData contents = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("contentType"u8)) - { - contentType = property.Value.GetString(); - continue; - } - if (property.NameEquals("filename"u8)) - { - filename = property.Value.GetString(); - continue; - } - if (property.NameEquals("contents"u8)) - { - contents = BinaryData.FromBytes(property.Value.GetBytesFromBase64("D")); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KnowledgeBaseFile(contentType, filename, contents, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(KnowledgeBaseFile)} does not support writing '{options.Format}' format."); - } - } - - KnowledgeBaseFile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeKnowledgeBaseFile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KnowledgeBaseFile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static KnowledgeBaseFile FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeKnowledgeBaseFile(document.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.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.cs deleted file mode 100644 index 88a7b58dff71..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseFile.cs +++ /dev/null @@ -1,184 +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.Language.QuestionAnswering.Authoring -{ - /// - /// A file in an HTTP request, response, or multipart payload. - /// - /// Files have a special meaning that the HTTP library understands. When the body of an HTTP request, response, - /// or multipart payload is _effectively_ an instance of `TypeSpec.Http.File` or any type that extends it, the - /// operation is treated as a file upload or download. - /// - /// When using file bodies, the fields of the file model are defined to come from particular locations by default: - /// - /// - `contentType`: The `Content-Type` header of the request, response, or multipart payload (CANNOT be overridden or changed). - /// - `contents`: The body of the request, response, or multipart payload (CANNOT be overridden or changed). - /// - `filename`: The `filename` parameter value of the `Content-Disposition` header of the response or multipart payload - /// (MAY be overridden or changed). - /// - /// A File may be used as a normal structured JSON object in a request or response, if the request specifies an explicit - /// `Content-Type` header. In this case, the entire File model is serialized as if it were any other model. In a JSON payload, - /// it will have a structure like: - /// - /// ``` - /// { - /// "contentType": <string?>, - /// "filename": <string?>, - /// "contents": <string, base64> - /// } - /// ``` - /// - /// The `contentType` _within_ the file defines what media types the data inside the file can be, but if the specification - /// defines a `Content-Type` for the payload as HTTP metadata, that `Content-Type` metadata defines _how the file is - /// serialized_. See the examples below for more information. - /// - /// NOTE: The `filename` and `contentType` fields are optional. Furthermore, the default location of `filename` - /// (`Content-Disposition: <disposition>; filename=<filename>`) is only valid in HTTP responses and multipart payloads. If - /// you wish to send the `filename` in a request, you must use HTTP metadata decorators to describe the location of the - /// `filename` field. You can combine the metadata decorators with `@visibility` to control when the `filename` location - /// is overridden, as shown in the examples below. - /// - public partial class KnowledgeBaseFile - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// is null. - public KnowledgeBaseFile(BinaryData contents) - { - Argument.AssertNotNull(contents, nameof(contents)); - - Contents = contents; - } - - /// Initializes a new instance of . - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// Keeps track of any properties unknown to the library. - internal KnowledgeBaseFile(string contentType, string filename, BinaryData contents, IDictionary serializedAdditionalRawData) - { - ContentType = contentType; - Filename = filename; - Contents = contents; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KnowledgeBaseFile() - { - } - - /// - /// The allowed media (MIME) types of the file contents. - /// - /// In file bodies, this value comes from the `Content-Type` header of the request or response. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// NOTE: this is not _necessarily_ the same as the `Content-Type` header of the request or response, but - /// it will be for file bodies. It may be different if the file is serialized as a JSON object. It always refers to the - /// _contents_ of the file, and not necessarily the way the file itself is transmitted or serialized. - /// - public string ContentType { get; set; } - /// - /// The name of the file, if any. - /// - /// In file bodies, this value comes from the `filename` parameter of the `Content-Disposition` header of the response - /// or multipart payload. In JSON bodies, this value is serialized as a field in the response. - /// - /// NOTE: By default, `filename` cannot be sent in request payloads and can only be sent in responses and multipart - /// payloads, as the `Content-Disposition` header is not valid in requests. If you want to send the `filename` in a request, - /// you must extend the `File` model and override the `filename` property with a different location defined by HTTP metadata - /// decorators. - /// - public string Filename { get; set; } - /// - /// The contents of the file. - /// - /// In file bodies, this value comes from the body of the request, response, or multipart payload. In JSON bodies, - /// this value is serialized as a field in the response. - /// - /// To assign a byte[] to this property use . - /// The byte[] will be serialized to a Base64 encoded string. - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }) - /// Creates a payload of "AQID". - /// - /// - /// - /// - public BinaryData Contents { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs similarity index 58% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs index 9b49a0dfbe11..6e6febf330dc 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AILanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringClientBuilderExtensions.cs @@ -13,35 +13,39 @@ namespace Microsoft.Extensions.Azure { - /// Extension methods to add to client builder. - public static partial class AILanguageQuestionAnsweringAuthoringClientBuilderExtensions + /// Extension methods to add clients to . + public static partial class LanguageQuestionAnsweringAuthoringClientBuilderExtensions { - /// Registers a instance. + /// Registers a client with the specified . /// 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. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// or is null. public static IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) - where TBuilder : IAzureClientFactoryBuilder + where TBuilder : IAzureClientFactoryBuilder { - return builder.RegisterClientFactory((options) => new QuestionAnsweringAuthoringClient(endpoint, credential, options)); + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + + return builder.RegisterClientFactory(options => new QuestionAnsweringAuthoringClient(endpoint, credential, options)); } - /// Registers a instance. + /// Registers a client with the specified . /// The builder to register with. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// public static IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilderWithCredential + where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new QuestionAnsweringAuthoringClient(endpoint, cred, options)); + return builder.RegisterClientFactory((options, credential) => new QuestionAnsweringAuthoringClient(endpoint, credential, options)); } - /// Registers a instance. + /// Registers a client with the specified . /// The builder to register with. - /// The configuration values. + /// The configuration to use for the client. [RequiresUnreferencedCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] [RequiresDynamicCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] public static IAzureClientBuilder AddQuestionAnsweringAuthoringClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration + where TBuilder : IAzureClientFactoryBuilderWithConfiguration { return builder.RegisterClientFactory(configuration); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringModelFactory.cs new file mode 100644 index 000000000000..1daef7788ef3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/LanguageQuestionAnsweringAuthoringModelFactory.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// A factory class for creating instances of the models for mocking. + public static partial class LanguageQuestionAnsweringAuthoringModelFactory + { + + /// Represents the project. + /// Name of the project. + /// Description of the project. + /// + /// Language of the text records. This is BCP-47 representation of a language. For + /// example, use "en" for English; "es" for Spanish etc. If not set, use "en" for + /// English as default. + /// + /// Resource enabled for multiple languages across projects or not. + /// Configurable settings of the Project. + /// Project creation date-time. + /// Represents the project last modified date-time. + /// Represents the project last deployment date-time. + /// Represents if semantic ranking is configured. + /// A new instance for mocking. + public static QuestionAnsweringProject QuestionAnsweringProject(string projectName = default, string description = default, string language = default, bool? isMultilingualResource = default, ProjectSettings settings = default, DateTimeOffset? createdDateTime = default, DateTimeOffset? lastModifiedDateTime = default, DateTimeOffset? lastDeployedDateTime = default, bool? isConfiguredSemanticRankingEnabled = default) + { + return new QuestionAnsweringProject( + projectName, + description, + language, + isMultilingualResource, + settings, + createdDateTime, + lastModifiedDateTime, + lastDeployedDateTime, + isConfiguredSemanticRankingEnabled, + additionalBinaryDataProperties: null); + } + + /// Configurable settings of the Project. + /// Default Answer response when no good match is found in the knowledge base. + /// A new instance for mocking. + public static ProjectSettings ProjectSettings(string defaultAnswer = default) + { + return new ProjectSettings(defaultAnswer, additionalBinaryDataProperties: null); + } + + /// Represents the state of a project deletion job. + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringProjectDeletionJobState QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = default, string jobId = default, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = default) + { + errors ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringProjectDeletionJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors.ToList(), + additionalBinaryDataProperties: null); + } + + /// Export job status, project metadata, and assets. + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// URL to download the result of the Export Job. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringExportJobState QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = default, string jobId = default, DateTimeOffset lastUpdated = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = default, string resultUrl = default) + { + errors ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringExportJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdated, + status, + errors.ToList(), + resultUrl, + additionalBinaryDataProperties: null); + } + + /// Project assets that need to be imported. + /// Parameters needed to create the project. + /// All assets for this project. + /// Import data File URI. + /// A new instance for mocking. + public static ImportJobOptions ImportJobOptions(QuestionAnsweringProject metadata = default, QuestionAnsweringAuthoringAssets assets = default, Uri fileUri = default) + { + return new ImportJobOptions(metadata, assets, fileUri, additionalBinaryDataProperties: null); + } + + /// All assets for this project. + /// Collection of synonyms. + /// List of QnA records to import. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringAssets QuestionAnsweringAuthoringAssets(IEnumerable synonyms = default, IEnumerable qnas = default) + { + synonyms ??= new ChangeTrackingList(); + qnas ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringAssets(synonyms.ToList(), qnas.ToList(), additionalBinaryDataProperties: null); + } + + /// Collection of word alterations. + /// Collection of word alterations. + /// A new instance for mocking. + public static WordAlterationsGroups WordAlterationsGroups(IEnumerable alterations = default) + { + alterations ??= new ChangeTrackingList(); + + return new WordAlterationsGroups(alterations.ToList(), additionalBinaryDataProperties: null); + } + + /// Import QnA Record. + /// Unique ID for the QnA. + /// Answer text. + /// + /// Source from which QnA was indexed e.g. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . + /// + /// List of questions associated with the answer. + /// + /// Metadata associated with the answer, useful to categorize or filter question + /// answers. + /// + /// Context of a QnA. + /// List of Active Learning suggestions for the QnA. + /// Date-time when the QnA was last updated. + /// Friendly name of the Source. + /// A new instance for mocking. + public static ImportQnaRecord ImportQnaRecord(int id = default, string answer = default, string source = default, IEnumerable questions = default, IDictionary metadata = default, QuestionAnsweringAuthoringDialog dialog = default, IEnumerable activeLearningSuggestionClusters = default, DateTimeOffset? lastUpdated = default, string sourceDisplayName = default) + { + questions ??= new ChangeTrackingList(); + metadata ??= new ChangeTrackingDictionary(); + activeLearningSuggestionClusters ??= new ChangeTrackingList(); + + return new ImportQnaRecord( + id, + answer, + source, + questions.ToList(), + metadata, + dialog, + activeLearningSuggestionClusters.ToList(), + lastUpdated, + sourceDisplayName, + additionalBinaryDataProperties: null); + } + + /// Dialog associated with QnA Record. + /// + /// To mark if a prompt is relevant only with a previous question or not. If true, + /// do not include this QnA as answer for queries without context; otherwise, + /// ignores context and includes this QnA in answers. + /// + /// List of prompts associated with the answer. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringDialog QuestionAnsweringAuthoringDialog(bool? isContextOnly = default, IEnumerable prompts = default) + { + prompts ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringDialog(isContextOnly, prompts.ToList(), additionalBinaryDataProperties: null); + } + + /// Prompt for an answer. + /// Index of the prompt. It is used for ordering of the prompts. + /// ID of the QnA corresponding to the prompt. + /// QnA record. Either QnAId or QnA record needs to be present in a Prompt. + /// Text displayed to represent a follow up question prompt. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringPrompt QuestionAnsweringAuthoringPrompt(int? displayOrder = default, int? qnaId = default, QuestionAnsweringAuthoringRecord qnaRecord = default, string displayText = default) + { + return new QuestionAnsweringAuthoringPrompt(displayOrder, qnaId, qnaRecord, displayText, additionalBinaryDataProperties: null); + } + + /// QnA record. + /// Unique ID for the QnA. + /// Answer text. + /// + /// Source from which QnA was indexed e.g. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . + /// + /// List of questions associated with the answer. + /// + /// Metadata associated with the answer, useful to categorize or filter question + /// answers. + /// + /// Context of a QnA. + /// List of Active Learning suggestions for the QnA. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringRecord QuestionAnsweringAuthoringRecord(int id = default, string answer = default, string source = default, IEnumerable questions = default, IDictionary metadata = default, QuestionAnsweringAuthoringDialog dialog = default, IEnumerable activeLearningSuggestionClusters = default) + { + questions ??= new ChangeTrackingList(); + metadata ??= new ChangeTrackingDictionary(); + activeLearningSuggestionClusters ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringRecord( + id, + answer, + source, + questions.ToList(), + metadata, + dialog, + activeLearningSuggestionClusters.ToList(), + additionalBinaryDataProperties: null); + } + + /// Active Learning suggested questions cluster details. + /// + /// Question chosen as the head of suggested questions cluster by Active Learning + /// clustering algorithm. + /// + /// List of all suggested questions for the QnA. + /// A new instance for mocking. + public static SuggestedQuestionsCluster SuggestedQuestionsCluster(string clusterHead = default, IEnumerable suggestedQuestions = default) + { + suggestedQuestions ??= new ChangeTrackingList(); + + return new SuggestedQuestionsCluster(clusterHead, suggestedQuestions.ToList(), additionalBinaryDataProperties: null); + } + + /// Question suggested by the Active Learning feature. + /// Question suggested by the Active Learning feature. + /// The number of times the question was suggested explicitly by the user. + /// + /// The number of times the question was suggested automatically by the Active + /// Learning algorithm. + /// + /// A new instance for mocking. + public static SuggestedQuestion SuggestedQuestion(string question = default, int? userSuggestedCount = default, int? autoSuggestedCount = default) + { + return new SuggestedQuestion(question, userSuggestedCount, autoSuggestedCount, additionalBinaryDataProperties: null); + } + + /// Import job status, project metadata, and assets. + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringImportJobState QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = default, string jobId = default, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = default) + { + errors ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringImportJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors.ToList(), + additionalBinaryDataProperties: null); + } + + /// Job state represents the job metadata and any errors. + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringProjectDeploymentJobState QuestionAnsweringAuthoringProjectDeploymentJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = default, string jobId = default, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = default) + { + errors ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringProjectDeploymentJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors.ToList(), + additionalBinaryDataProperties: null); + } + + /// Project deployment details. + /// Name of the deployment. + /// Represents the project last deployment date-time. + /// A new instance for mocking. + public static ProjectDeployment ProjectDeployment(string deploymentName = default, DateTimeOffset? lastDeployed = default) + { + return new ProjectDeployment(deploymentName, lastDeployed, additionalBinaryDataProperties: null); + } + + /// Request payload for updating synonyms. + /// The WordAlterations items on this page. + /// The link to the next page of items. + /// A new instance for mocking. + public static SynonymAssets SynonymAssets(IEnumerable value = default, Uri nextLink = default) + { + value ??= new ChangeTrackingList(); + + return new SynonymAssets(value.ToList(), nextLink, additionalBinaryDataProperties: null); + } + + /// Custom source record with last updated date-time. + /// Friendly name of the Source. + /// + /// Unique source identifier. Name of the file if it's a 'file' source; otherwise, + /// the complete URL if it's a 'url' source. + /// + /// URI location for the file or url. + /// Supported source types. + /// Content structure type for sources. + /// Date-time when the QnA was last updated. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringSourceRecord QuestionAnsweringAuthoringSourceRecord(string displayName = default, string source = default, Uri sourceUri = default, KnowledgeBaseSourceKind sourceKind = default, SourceContentStructureKind? contentStructureKind = default, DateTimeOffset? lastUpdatedDateTime = default) + { + return new QuestionAnsweringAuthoringSourceRecord( + displayName, + source, + sourceUri, + sourceKind, + contentStructureKind, + lastUpdatedDateTime, + additionalBinaryDataProperties: null); + } + + /// Job state represents the job metadata and any errors. + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringUpdateSourcesJobState QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = default, string jobId = default, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = default) + { + errors ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringUpdateSourcesJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors.ToList(), + additionalBinaryDataProperties: null); + } + + /// QnA Record with last updated date-time. + /// Unique ID for the QnA. + /// Answer text. + /// + /// Source from which QnA was indexed e.g. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . + /// + /// List of questions associated with the answer. + /// + /// Metadata associated with the answer, useful to categorize or filter question + /// answers. + /// + /// Context of a QnA. + /// List of Active Learning suggestions for the QnA. + /// Date-time when the QnA was last updated. + /// A new instance for mocking. + public static RetrieveQnaRecord RetrieveQnaRecord(int id = default, string answer = default, string source = default, IEnumerable questions = default, IDictionary metadata = default, QuestionAnsweringAuthoringDialog dialog = default, IEnumerable activeLearningSuggestionClusters = default, DateTimeOffset? lastUpdatedDateTime = default) + { + questions ??= new ChangeTrackingList(); + metadata ??= new ChangeTrackingDictionary(); + activeLearningSuggestionClusters ??= new ChangeTrackingList(); + + return new RetrieveQnaRecord( + id, + answer, + source, + questions.ToList(), + metadata, + dialog, + activeLearningSuggestionClusters.ToList(), + lastUpdatedDateTime, + additionalBinaryDataProperties: null); + } + + /// Job state represents the job metadata and any errors. + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// A new instance for mocking. + public static QuestionAnsweringAuthoringUpdateQnasJobState QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = default, string jobId = default, DateTimeOffset lastUpdatedDateTime = default, QuestionAnsweringAuthoringJobStatus status = default, IEnumerable errors = default) + { + errors ??= new ChangeTrackingList(); + + return new QuestionAnsweringAuthoringUpdateQnasJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors.ToList(), + additionalBinaryDataProperties: null); + } + + /// Feedback for Active Learning. + /// A list of Feedback Records for Active Learning. + /// A new instance for mocking. + public static ActiveLearningFeedback ActiveLearningFeedback(IEnumerable records = default) + { + records ??= new ChangeTrackingList(); + + return new ActiveLearningFeedback(records.ToList(), additionalBinaryDataProperties: null); + } + + /// Feedback Record for Active Learning. + /// Unique identifier of the user. + /// User suggested question for the QnA. + /// Unique ID of the QnA. + /// A new instance for mocking. + public static FeedbackRecord FeedbackRecord(string userId = default, string userQuestion = default, int? qnaId = default) + { + return new FeedbackRecord(userId, userQuestion, qnaId, additionalBinaryDataProperties: null); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.Serialization.cs similarity index 51% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.Serialization.cs index ee4f78dcbe44..a9e31ca82ed6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ActiveLearningFeedback.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.Serialization.cs @@ -13,10 +13,11 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class ActiveLearningFeedback : IUtf8JsonSerializable, IJsonModel + /// Feedback for Active Learning. + public partial class ActiveLearningFeedback : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +29,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ActiveLearningFeedback)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Records)) { writer.WritePropertyName("records"u8); writer.WriteStartArray(); - foreach (var item in Records) + foreach (FeedbackRecord item in Records) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,39 +61,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ActiveLearningFeedback IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ActiveLearningFeedback IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ActiveLearningFeedback JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ActiveLearningFeedback)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeActiveLearningFeedback(document.RootElement, options); } - internal static ActiveLearningFeedback DeserializeActiveLearningFeedback(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveLearningFeedback DeserializeActiveLearningFeedback(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList records = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("records"u8)) + if (prop.NameEquals("records"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(FeedbackRecord.DeserializeFeedbackRecord(item, options)); } @@ -102,17 +106,19 @@ internal static ActiveLearningFeedback DeserializeActiveLearningFeedback(JsonEle } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ActiveLearningFeedback(records ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ActiveLearningFeedback(records ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +128,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - ActiveLearningFeedback IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ActiveLearningFeedback IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ActiveLearningFeedback PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeActiveLearningFeedback(document.RootElement, options); } default: @@ -138,21 +149,18 @@ ActiveLearningFeedback IPersistableModel.Create(BinaryDa } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ActiveLearningFeedback FromResponse(Response response) + /// The to serialize into . + public static implicit operator RequestContent(ActiveLearningFeedback activeLearningFeedback) { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeActiveLearningFeedback(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + if (activeLearningFeedback == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(activeLearningFeedback, ModelSerializationExtensions.WireOptions); return content; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.cs new file mode 100644 index 000000000000..4f237f5c3994 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ActiveLearningFeedback.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Feedback for Active Learning. + public partial class ActiveLearningFeedback + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ActiveLearningFeedback() + { + Records = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A list of Feedback Records for Active Learning. + /// Keeps track of any properties unknown to the library. + internal ActiveLearningFeedback(IList records, IDictionary additionalBinaryDataProperties) + { + Records = records; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A list of Feedback Records for Active Learning. + public IList Records { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AssetKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/AssetKind.cs similarity index 66% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AssetKind.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/AssetKind.cs index a51c17801849..cc796e582393 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/AssetKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/AssetKind.cs @@ -14,38 +14,57 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring public readonly partial struct AssetKind : IEquatable { private readonly string _value; + /// Question and Answers. + private const string QnasValue = "qnas"; + /// Synonyms. + private const string SynonymsValue = "synonyms"; /// Initializes a new instance of . + /// The value. /// is null. public AssetKind(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string QnasValue = "qnas"; - private const string SynonymsValue = "synonyms"; + _value = value; + } /// Question and Answers. public static AssetKind Qnas { get; } = new AssetKind(QnasValue); + /// Synonyms. public static AssetKind Synonyms { get; } = new AssetKind(SynonymsValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AssetKind left, AssetKind right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AssetKind left, AssetKind right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AssetKind(string value) => new AssetKind(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AssetKind?(string value) => value == null ? null : new AssetKind(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AssetKind other && Equals(other); - /// + + /// public bool Equals(AssetKind 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.QuestionAnswering.Authoring/src/Generated/Models/AzureAILanguageQuestionAnsweringAuthoringContext.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/AzureAILanguageQuestionAnsweringAuthoringContext.cs index b632e5a11753..0c1f2a882558 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/AzureAILanguageQuestionAnsweringAuthoringContext.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/AzureAILanguageQuestionAnsweringAuthoringContext.cs @@ -6,35 +6,38 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// [ModelReaderWriterBuildable(typeof(ActiveLearningFeedback))] [ModelReaderWriterBuildable(typeof(FeedbackRecord))] - [ModelReaderWriterBuildable(typeof(ImportFiles))] [ModelReaderWriterBuildable(typeof(ImportJobOptions))] [ModelReaderWriterBuildable(typeof(ImportQnaRecord))] - [ModelReaderWriterBuildable(typeof(KnowledgeBaseFile))] + [ModelReaderWriterBuildable(typeof(PagedProjectDeployment))] + [ModelReaderWriterBuildable(typeof(PagedQnaSourceRecord))] + [ModelReaderWriterBuildable(typeof(PagedQuestionAnsweringProjectMetadata))] + [ModelReaderWriterBuildable(typeof(PagedRetrieveQnaRecord))] + [ModelReaderWriterBuildable(typeof(PagedWordAlterations))] [ModelReaderWriterBuildable(typeof(ProjectDeployment))] - [ModelReaderWriterBuildable(typeof(ProjectDeploymentJobState))] [ModelReaderWriterBuildable(typeof(ProjectSettings))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringAssets))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringDialog))] - [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringError))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringExportJobState))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringImportJobState))] - [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringInnerErrorModel))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringProjectDeletionJobState))] + [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringProjectDeploymentJobState))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringPrompt))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringRecord))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringSourceRecord))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringUpdateQnasJobState))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringAuthoringUpdateSourcesJobState))] [ModelReaderWriterBuildable(typeof(QuestionAnsweringProject))] + [ModelReaderWriterBuildable(typeof(ResponseError))] [ModelReaderWriterBuildable(typeof(RetrieveQnaRecord))] [ModelReaderWriterBuildable(typeof(SuggestedQuestion))] [ModelReaderWriterBuildable(typeof(SuggestedQuestionsCluster))] diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.Serialization.cs similarity index 53% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.Serialization.cs index ab648159507e..dbca993286a4 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FeedbackRecord.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class FeedbackRecord : IUtf8JsonSerializable, IJsonModel + /// Feedback Record for Active Learning. + public partial class FeedbackRecord : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(FeedbackRecord)} does not support writing '{format}' format."); } - if (Optional.IsDefined(UserId)) { writer.WritePropertyName("userId"u8); @@ -49,15 +48,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("qnaId"u8); writer.WriteNumberValue(QnaId.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +65,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - FeedbackRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + FeedbackRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual FeedbackRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(FeedbackRecord)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeFeedbackRecord(document.RootElement, options); } - internal static FeedbackRecord DeserializeFeedbackRecord(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static FeedbackRecord DeserializeFeedbackRecord(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,42 +93,43 @@ internal static FeedbackRecord DeserializeFeedbackRecord(JsonElement element, Mo string userId = default; string userQuestion = default; int? qnaId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("userId"u8)) + if (prop.NameEquals("userId"u8)) { - userId = property.Value.GetString(); + userId = prop.Value.GetString(); continue; } - if (property.NameEquals("userQuestion"u8)) + if (prop.NameEquals("userQuestion"u8)) { - userQuestion = property.Value.GetString(); + userQuestion = prop.Value.GetString(); continue; } - if (property.NameEquals("qnaId"u8)) + if (prop.NameEquals("qnaId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - qnaId = property.Value.GetInt32(); + qnaId = prop.Value.GetInt32(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new FeedbackRecord(userId, userQuestion, qnaId, serializedAdditionalRawData); + return new FeedbackRecord(userId, userQuestion, qnaId, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -134,15 +139,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opti } } - FeedbackRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + FeedbackRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual FeedbackRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeFeedbackRecord(document.RootElement, options); } default: @@ -150,22 +160,7 @@ FeedbackRecord IPersistableModel.Create(BinaryData data, ModelRe } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static FeedbackRecord FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeFeedbackRecord(document.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.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.cs new file mode 100644 index 000000000000..a66b9717c94c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FeedbackRecord.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Feedback Record for Active Learning. + public partial class FeedbackRecord + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public FeedbackRecord() + { + } + + /// Initializes a new instance of . + /// Unique identifier of the user. + /// User suggested question for the QnA. + /// Unique ID of the QnA. + /// Keeps track of any properties unknown to the library. + internal FeedbackRecord(string userId, string userQuestion, int? qnaId, IDictionary additionalBinaryDataProperties) + { + UserId = userId; + UserQuestion = userQuestion; + QnaId = qnaId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Unique identifier of the user. + public string UserId { get; set; } + + /// User suggested question for the QnA. + public string UserQuestion { get; set; } + + /// Unique ID of the QnA. + public int? QnaId { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FileFormat.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FileFormat.cs similarity index 65% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FileFormat.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FileFormat.cs index 66cf54d16b96..454b1d0b5570 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/FileFormat.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/FileFormat.cs @@ -14,47 +14,74 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring public readonly partial struct FileFormat : IEquatable { private readonly string _value; + /// Export or Import QnA assets in JSON format. + private const string JsonValue = "json"; + /// + /// Export or Import knowledge base replica including all assets and metadata in + /// Excel format. + /// + private const string TsvValue = "tsv"; + /// + /// Export or Import knowledge base replica including all assets and metadata in + /// Tsv format. + /// + private const string ExcelValue = "excel"; /// Initializes a new instance of . + /// The value. /// is null. public FileFormat(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string JsonValue = "json"; - private const string TsvValue = "tsv"; - private const string ExcelValue = "excel"; + _value = value; + } /// Export or Import QnA assets in JSON format. public static FileFormat Json { get; } = new FileFormat(JsonValue); + /// /// Export or Import knowledge base replica including all assets and metadata in /// Excel format. /// public static FileFormat Tsv { get; } = new FileFormat(TsvValue); + /// /// Export or Import knowledge base replica including all assets and metadata in /// Tsv format. /// public static FileFormat Excel { get; } = new FileFormat(ExcelValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(FileFormat left, FileFormat right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(FileFormat left, FileFormat right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator FileFormat(string value) => new FileFormat(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator FileFormat?(string value) => value == null ? null : new FileFormat(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is FileFormat other && Equals(other); - /// + + /// public bool Equals(FileFormat 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.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.Serialization.cs similarity index 51% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.Serialization.cs index 2a2faef68c62..5ce34f1f142b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportJobOptions.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.Serialization.cs @@ -13,10 +13,11 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class ImportJobOptions : IUtf8JsonSerializable, IJsonModel + /// Project assets that need to be imported. + public partial class ImportJobOptions : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ImportJobOptions)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Metadata)) { writer.WritePropertyName("metadata"u8); @@ -49,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("fileUri"u8); writer.WriteStringValue(FileUri.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ImportJobOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ImportJobOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ImportJobOptions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ImportJobOptions)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeImportJobOptions(document.RootElement, options); } - internal static ImportJobOptions DeserializeImportJobOptions(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ImportJobOptions DeserializeImportJobOptions(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,50 +94,51 @@ internal static ImportJobOptions DeserializeImportJobOptions(JsonElement element QuestionAnsweringProject metadata = default; QuestionAnsweringAuthoringAssets assets = default; Uri fileUri = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("metadata"u8)) + if (prop.NameEquals("metadata"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - metadata = QuestionAnsweringProject.DeserializeQuestionAnsweringProject(property.Value, options); + metadata = QuestionAnsweringProject.DeserializeQuestionAnsweringProject(prop.Value, options); continue; } - if (property.NameEquals("assets"u8)) + if (prop.NameEquals("assets"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - assets = QuestionAnsweringAuthoringAssets.DeserializeQuestionAnsweringAuthoringAssets(property.Value, options); + assets = QuestionAnsweringAuthoringAssets.DeserializeQuestionAnsweringAuthoringAssets(prop.Value, options); continue; } - if (property.NameEquals("fileUri"u8)) + if (prop.NameEquals("fileUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - fileUri = new Uri(property.Value.GetString()); + fileUri = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ImportJobOptions(metadata, assets, fileUri, serializedAdditionalRawData); + return new ImportJobOptions(metadata, assets, fileUri, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -142,15 +148,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - ImportJobOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ImportJobOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ImportJobOptions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeImportJobOptions(document.RootElement, options); } default: @@ -158,21 +169,18 @@ ImportJobOptions IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ImportJobOptions FromResponse(Response response) + /// The to serialize into . + public static implicit operator RequestContent(ImportJobOptions importJobOptions) { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeImportJobOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + if (importJobOptions == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(importJobOptions, ModelSerializationExtensions.WireOptions); return content; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.cs new file mode 100644 index 000000000000..629f84e97d93 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportJobOptions.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Project assets that need to be imported. + public partial class ImportJobOptions + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ImportJobOptions() + { + } + + /// Initializes a new instance of . + /// Parameters needed to create the project. + /// All assets for this project. + /// Import data File URI. + /// Keeps track of any properties unknown to the library. + internal ImportJobOptions(QuestionAnsweringProject metadata, QuestionAnsweringAuthoringAssets assets, Uri fileUri, IDictionary additionalBinaryDataProperties) + { + Metadata = metadata; + Assets = assets; + FileUri = fileUri; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Parameters needed to create the project. + public QuestionAnsweringProject Metadata { get; set; } + + /// All assets for this project. + public QuestionAnsweringAuthoringAssets Assets { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportQnaRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportQnaRecord.Serialization.cs similarity index 55% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportQnaRecord.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportQnaRecord.Serialization.cs index b8b995faece0..ba6e56f66eac 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportQnaRecord.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportQnaRecord.Serialization.cs @@ -9,14 +9,19 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class ImportQnaRecord : IUtf8JsonSerializable, IJsonModel + /// Import QnA Record. + public partial class ImportQnaRecord : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ImportQnaRecord() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ImportQnaRecord)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); writer.WriteNumberValue(Id); if (Optional.IsDefined(Answer)) @@ -50,8 +54,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("questions"u8); writer.WriteStartArray(); - foreach (var item in Questions) + foreach (string item in Questions) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -63,6 +72,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Metadata) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -76,7 +90,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("activeLearningSuggestions"u8); writer.WriteStartArray(); - foreach (var item in ActiveLearningSuggestionClusters) + foreach (SuggestedQuestionsCluster item in ActiveLearningSuggestionClusters) { writer.WriteObjectValue(item, options); } @@ -92,15 +106,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("sourceDisplayName"u8); writer.WriteStringValue(SourceDisplayName); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -109,22 +123,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ImportQnaRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ImportQnaRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ImportQnaRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ImportQnaRecord)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeImportQnaRecord(document.RootElement, options); } - internal static ImportQnaRecord DeserializeImportQnaRecord(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ImportQnaRecord DeserializeImportQnaRecord(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -135,99 +154,111 @@ internal static ImportQnaRecord DeserializeImportQnaRecord(JsonElement element, IList questions = default; IDictionary metadata = default; QuestionAnsweringAuthoringDialog dialog = default; - IList activeLearningSuggestions = default; - DateTimeOffset? lastUpdatedDateTime = default; + IList activeLearningSuggestionClusters = default; + DateTimeOffset? lastUpdated = default; string sourceDisplayName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = property.Value.GetInt32(); + id = prop.Value.GetInt32(); continue; } - if (property.NameEquals("answer"u8)) + if (prop.NameEquals("answer"u8)) { - answer = property.Value.GetString(); + answer = prop.Value.GetString(); continue; } - if (property.NameEquals("source"u8)) + if (prop.NameEquals("source"u8)) { - source = property.Value.GetString(); + source = prop.Value.GetString(); continue; } - if (property.NameEquals("questions"u8)) + if (prop.NameEquals("questions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } questions = array; continue; } - if (property.NameEquals("metadata"u8)) + if (prop.NameEquals("metadata"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } metadata = dictionary; continue; } - if (property.NameEquals("dialog"u8)) + if (prop.NameEquals("dialog"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - dialog = QuestionAnsweringAuthoringDialog.DeserializeQuestionAnsweringAuthoringDialog(property.Value, options); + dialog = QuestionAnsweringAuthoringDialog.DeserializeQuestionAnsweringAuthoringDialog(prop.Value, options); continue; } - if (property.NameEquals("activeLearningSuggestions"u8)) + if (prop.NameEquals("activeLearningSuggestions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(SuggestedQuestionsCluster.DeserializeSuggestedQuestionsCluster(item, options)); } - activeLearningSuggestions = array; + activeLearningSuggestionClusters = array; continue; } - if (property.NameEquals("lastUpdatedDateTime"u8)) + if (prop.NameEquals("lastUpdatedDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + lastUpdated = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("sourceDisplayName"u8)) + if (prop.NameEquals("sourceDisplayName"u8)) { - sourceDisplayName = property.Value.GetString(); + sourceDisplayName = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new ImportQnaRecord( id, answer, @@ -235,16 +266,19 @@ internal static ImportQnaRecord DeserializeImportQnaRecord(JsonElement element, questions ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), dialog, - activeLearningSuggestions ?? new ChangeTrackingList(), - lastUpdatedDateTime, + activeLearningSuggestionClusters ?? new ChangeTrackingList(), + lastUpdated, sourceDisplayName, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -254,15 +288,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - ImportQnaRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ImportQnaRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ImportQnaRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeImportQnaRecord(document.RootElement, options); } default: @@ -270,22 +309,7 @@ ImportQnaRecord IPersistableModel.Create(BinaryData data, Model } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ImportQnaRecord FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeImportQnaRecord(document.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.QuestionAnswering.Authoring/src/Generated/ImportQnaRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportQnaRecord.cs similarity index 68% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportQnaRecord.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportQnaRecord.cs index da52e03eb443..4fa6fc85342f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ImportQnaRecord.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ImportQnaRecord.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Import QnA Record. public partial class ImportQnaRecord { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Unique ID for the QnA. @@ -71,8 +42,8 @@ public ImportQnaRecord(int id) /// List of Active Learning suggestions for the QnA. /// Date-time when the QnA was last updated. /// Friendly name of the Source. - /// Keeps track of any properties unknown to the library. - internal ImportQnaRecord(int id, string answer, string source, IList questions, IDictionary metadata, QuestionAnsweringAuthoringDialog dialog, IList activeLearningSuggestionClusters, DateTimeOffset? lastUpdated, string sourceDisplayName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ImportQnaRecord(int id, string answer, string source, IList questions, IDictionary metadata, QuestionAnsweringAuthoringDialog dialog, IList activeLearningSuggestionClusters, DateTimeOffset? lastUpdated, string sourceDisplayName, IDictionary additionalBinaryDataProperties) { Id = id; Answer = answer; @@ -83,36 +54,39 @@ internal ImportQnaRecord(int id, string answer, string source, IList que ActiveLearningSuggestionClusters = activeLearningSuggestionClusters; LastUpdated = lastUpdated; SourceDisplayName = sourceDisplayName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ImportQnaRecord() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Unique ID for the QnA. public int Id { get; } + /// Answer text. public string Answer { get; set; } + /// /// Source from which QnA was indexed e.g. /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . /// public string Source { get; set; } + /// List of questions associated with the answer. public IList Questions { get; } + /// /// Metadata associated with the answer, useful to categorize or filter question /// answers. /// public IDictionary Metadata { get; } + /// Context of a QnA. public QuestionAnsweringAuthoringDialog Dialog { get; set; } + /// List of Active Learning suggestions for the QnA. public IList ActiveLearningSuggestionClusters { get; } + /// Date-time when the QnA was last updated. public DateTimeOffset? LastUpdated { get; set; } + /// Friendly name of the Source. public string SourceDisplayName { get; set; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseSourceKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/KnowledgeBaseSourceKind.cs similarity index 68% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseSourceKind.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/KnowledgeBaseSourceKind.cs index a5d000583284..8ca918d8dca0 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/KnowledgeBaseSourceKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/KnowledgeBaseSourceKind.cs @@ -14,38 +14,57 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring public readonly partial struct KnowledgeBaseSourceKind : IEquatable { private readonly string _value; + /// File Source. + private const string FileValue = "file"; + /// URI Source. + private const string UrlValue = "url"; /// Initializes a new instance of . + /// The value. /// is null. public KnowledgeBaseSourceKind(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string FileValue = "file"; - private const string UrlValue = "url"; + _value = value; + } /// File Source. public static KnowledgeBaseSourceKind File { get; } = new KnowledgeBaseSourceKind(FileValue); + /// URI Source. public static KnowledgeBaseSourceKind Url { get; } = new KnowledgeBaseSourceKind(UrlValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KnowledgeBaseSourceKind left, KnowledgeBaseSourceKind right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KnowledgeBaseSourceKind left, KnowledgeBaseSourceKind right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KnowledgeBaseSourceKind(string value) => new KnowledgeBaseSourceKind(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KnowledgeBaseSourceKind?(string value) => value == null ? null : new KnowledgeBaseSourceKind(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KnowledgeBaseSourceKind other && Equals(other); - /// + + /// public bool Equals(KnowledgeBaseSourceKind 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.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.Serialization.cs new file mode 100644 index 000000000000..af9f56e129ab --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.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; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of ProjectDeployment items. + internal partial class PagedProjectDeployment : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PagedProjectDeployment() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedProjectDeployment)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ProjectDeployment item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PagedProjectDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PagedProjectDeployment JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedProjectDeployment)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedProjectDeployment(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PagedProjectDeployment DeserializePagedProjectDeployment(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ProjectDeployment.DeserializeProjectDeployment(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PagedProjectDeployment(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(PagedProjectDeployment)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PagedProjectDeployment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PagedProjectDeployment PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePagedProjectDeployment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedProjectDeployment)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator PagedProjectDeployment(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagedProjectDeployment(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.cs new file mode 100644 index 000000000000..b2362180421d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedProjectDeployment.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of ProjectDeployment items. + internal partial class PagedProjectDeployment + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ProjectDeployment items on this page. + internal PagedProjectDeployment(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ProjectDeployment items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedProjectDeployment(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ProjectDeployment items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.Serialization.cs new file mode 100644 index 000000000000..a79dbc843543 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.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; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of QnaSourceRecord items. + internal partial class PagedQnaSourceRecord : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PagedQnaSourceRecord() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedQnaSourceRecord)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (QuestionAnsweringAuthoringSourceRecord item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PagedQnaSourceRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PagedQnaSourceRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedQnaSourceRecord)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedQnaSourceRecord(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PagedQnaSourceRecord DeserializePagedQnaSourceRecord(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(QuestionAnsweringAuthoringSourceRecord.DeserializeQuestionAnsweringAuthoringSourceRecord(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PagedQnaSourceRecord(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(PagedQnaSourceRecord)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PagedQnaSourceRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PagedQnaSourceRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePagedQnaSourceRecord(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedQnaSourceRecord)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator PagedQnaSourceRecord(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagedQnaSourceRecord(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.cs new file mode 100644 index 000000000000..4e048862dfe4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQnaSourceRecord.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of QnaSourceRecord items. + internal partial class PagedQnaSourceRecord + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The QnaSourceRecord items on this page. + internal PagedQnaSourceRecord(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The QnaSourceRecord items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedQnaSourceRecord(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The QnaSourceRecord items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.Serialization.cs new file mode 100644 index 000000000000..2928a9ebfa22 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.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; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of QuestionAnsweringProjectMetadata items. + internal partial class PagedQuestionAnsweringProjectMetadata : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PagedQuestionAnsweringProjectMetadata() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedQuestionAnsweringProjectMetadata)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (QuestionAnsweringProject item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PagedQuestionAnsweringProjectMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PagedQuestionAnsweringProjectMetadata JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedQuestionAnsweringProjectMetadata)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedQuestionAnsweringProjectMetadata(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PagedQuestionAnsweringProjectMetadata DeserializePagedQuestionAnsweringProjectMetadata(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(QuestionAnsweringProject.DeserializeQuestionAnsweringProject(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PagedQuestionAnsweringProjectMetadata(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(PagedQuestionAnsweringProjectMetadata)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PagedQuestionAnsweringProjectMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PagedQuestionAnsweringProjectMetadata PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePagedQuestionAnsweringProjectMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedQuestionAnsweringProjectMetadata)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator PagedQuestionAnsweringProjectMetadata(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagedQuestionAnsweringProjectMetadata(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.cs new file mode 100644 index 000000000000..21901fb0a9d1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedQuestionAnsweringProjectMetadata.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of QuestionAnsweringProjectMetadata items. + internal partial class PagedQuestionAnsweringProjectMetadata + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The QuestionAnsweringProjectMetadata items on this page. + internal PagedQuestionAnsweringProjectMetadata(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The QuestionAnsweringProjectMetadata items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedQuestionAnsweringProjectMetadata(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The QuestionAnsweringProjectMetadata items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.Serialization.cs new file mode 100644 index 000000000000..de64577b6286 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.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; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of RetrieveQnaRecord items. + internal partial class PagedRetrieveQnaRecord : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PagedRetrieveQnaRecord() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedRetrieveQnaRecord)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (RetrieveQnaRecord item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PagedRetrieveQnaRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PagedRetrieveQnaRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedRetrieveQnaRecord)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedRetrieveQnaRecord(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PagedRetrieveQnaRecord DeserializePagedRetrieveQnaRecord(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(RetrieveQnaRecord.DeserializeRetrieveQnaRecord(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PagedRetrieveQnaRecord(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(PagedRetrieveQnaRecord)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PagedRetrieveQnaRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PagedRetrieveQnaRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePagedRetrieveQnaRecord(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedRetrieveQnaRecord)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator PagedRetrieveQnaRecord(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagedRetrieveQnaRecord(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.cs new file mode 100644 index 000000000000..ae3ce171fb10 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedRetrieveQnaRecord.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of RetrieveQnaRecord items. + internal partial class PagedRetrieveQnaRecord + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The RetrieveQnaRecord items on this page. + internal PagedRetrieveQnaRecord(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The RetrieveQnaRecord items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedRetrieveQnaRecord(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The RetrieveQnaRecord items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.Serialization.cs new file mode 100644 index 000000000000..4c2aa8517f65 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.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; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of WordAlterations items. + internal partial class PagedWordAlterations : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PagedWordAlterations() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedWordAlterations)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (WordAlterationsGroups item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PagedWordAlterations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PagedWordAlterations JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PagedWordAlterations)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedWordAlterations(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PagedWordAlterations DeserializePagedWordAlterations(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(WordAlterationsGroups.DeserializeWordAlterationsGroups(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PagedWordAlterations(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(PagedWordAlterations)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PagedWordAlterations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PagedWordAlterations PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializePagedWordAlterations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedWordAlterations)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator PagedWordAlterations(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagedWordAlterations(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.cs new file mode 100644 index 000000000000..1454298c3f7a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/PagedWordAlterations.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Paged collection of WordAlterations items. + internal partial class PagedWordAlterations + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The WordAlterations items on this page. + internal PagedWordAlterations(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The WordAlterations items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedWordAlterations(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The WordAlterations items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.Serialization.cs similarity index 51% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.Serialization.cs index 37b3bacbd176..f16ab0b865d2 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class ProjectDeployment : IUtf8JsonSerializable, IJsonModel + /// Project deployment details. + public partial class ProjectDeployment : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ProjectDeployment)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("deploymentName"u8); @@ -44,15 +43,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("lastDeployedDateTime"u8); writer.WriteStringValue(LastDeployed.Value, "O"); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,59 +60,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ProjectDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ProjectDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ProjectDeployment JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ProjectDeployment)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeProjectDeployment(document.RootElement, options); } - internal static ProjectDeployment DeserializeProjectDeployment(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ProjectDeployment DeserializeProjectDeployment(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string deploymentName = default; - DateTimeOffset? lastDeployedDateTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + DateTimeOffset? lastDeployed = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("deploymentName"u8)) + if (prop.NameEquals("deploymentName"u8)) { - deploymentName = property.Value.GetString(); + deploymentName = prop.Value.GetString(); continue; } - if (property.NameEquals("lastDeployedDateTime"u8)) + if (prop.NameEquals("lastDeployedDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastDeployedDateTime = property.Value.GetDateTimeOffset("O"); + lastDeployed = prop.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ProjectDeployment(deploymentName, lastDeployedDateTime, serializedAdditionalRawData); + return new ProjectDeployment(deploymentName, lastDeployed, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -123,15 +128,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - ProjectDeployment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ProjectDeployment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ProjectDeployment PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeProjectDeployment(document.RootElement, options); } default: @@ -139,22 +149,7 @@ ProjectDeployment IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ProjectDeployment FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProjectDeployment(document.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.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.cs new file mode 100644 index 000000000000..4c944bdeb86b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectDeployment.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.QuestionAnswering.Authoring +{ + /// Project deployment details. + public partial class ProjectDeployment + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ProjectDeployment() + { + } + + /// Initializes a new instance of . + /// Name of the deployment. + /// Represents the project last deployment date-time. + /// Keeps track of any properties unknown to the library. + internal ProjectDeployment(string deploymentName, DateTimeOffset? lastDeployed, IDictionary additionalBinaryDataProperties) + { + DeploymentName = deploymentName; + LastDeployed = lastDeployed; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Name of the deployment. + public string DeploymentName { get; } + + /// Represents the project last deployment date-time. + public DateTimeOffset? LastDeployed { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.Serialization.cs new file mode 100644 index 000000000000..a359e70c8b56 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Configurable settings of the Project. + public partial class ProjectSettings : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProjectSettings)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DefaultAnswer)) + { + writer.WritePropertyName("defaultAnswer"u8); + writer.WriteStringValue(DefaultAnswer); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ProjectSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ProjectSettings JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProjectSettings)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProjectSettings(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ProjectSettings DeserializeProjectSettings(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string defaultAnswer = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("defaultAnswer"u8)) + { + defaultAnswer = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ProjectSettings(defaultAnswer, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(ProjectSettings)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ProjectSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ProjectSettings PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeProjectSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProjectSettings)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.cs new file mode 100644 index 000000000000..09140cf382be --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/ProjectSettings.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Configurable settings of the Project. + public partial class ProjectSettings + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ProjectSettings() + { + } + + /// Initializes a new instance of . + /// Default Answer response when no good match is found in the knowledge base. + /// Keeps track of any properties unknown to the library. + internal ProjectSettings(string defaultAnswer, IDictionary additionalBinaryDataProperties) + { + DefaultAnswer = defaultAnswer; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Default Answer response when no good match is found in the knowledge base. + public string DefaultAnswer { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.Serialization.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.Serialization.cs index 964e5dbf1cf0..91a4c06bf5dd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringAssets : IUtf8JsonSerializable, IJsonModel + /// All assets for this project. + public partial class QuestionAnsweringAuthoringAssets : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,17 +28,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringAssets)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Synonyms)) { writer.WritePropertyName("synonyms"u8); writer.WriteStartArray(); - foreach (var item in Synonyms) + foreach (WordAlterationsGroups item in Synonyms) { writer.WriteObjectValue(item, options); } @@ -48,21 +47,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("qnas"u8); writer.WriteStartArray(); - foreach (var item in Qnas) + foreach (ImportQnaRecord item in Qnas) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -71,54 +70,58 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringAssets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringAssets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringAssets JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringAssets)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringAssets(document.RootElement, options); } - internal static QuestionAnsweringAuthoringAssets DeserializeQuestionAnsweringAuthoringAssets(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringAssets DeserializeQuestionAnsweringAuthoringAssets(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList synonyms = default; IList qnas = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("synonyms"u8)) + if (prop.NameEquals("synonyms"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(WordAlterationsGroups.DeserializeWordAlterationsGroups(item, options)); } synonyms = array; continue; } - if (property.NameEquals("qnas"u8)) + if (prop.NameEquals("qnas"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ImportQnaRecord.DeserializeImportQnaRecord(item, options)); } @@ -127,17 +130,19 @@ internal static QuestionAnsweringAuthoringAssets DeserializeQuestionAnsweringAut } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringAssets(synonyms ?? new ChangeTrackingList(), qnas ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new QuestionAnsweringAuthoringAssets(synonyms ?? new ChangeTrackingList(), qnas ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -147,15 +152,20 @@ BinaryData IPersistableModel.Write(ModelReader } } - QuestionAnsweringAuthoringAssets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringAssets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringAssets PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringAssets(document.RootElement, options); } default: @@ -163,22 +173,7 @@ QuestionAnsweringAuthoringAssets IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringAssets FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringAssets(document.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.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.cs new file mode 100644 index 000000000000..5f35789dd4f5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringAssets.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// All assets for this project. + public partial class QuestionAnsweringAuthoringAssets + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public QuestionAnsweringAuthoringAssets() + { + Synonyms = new ChangeTrackingList(); + Qnas = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Collection of synonyms. + /// List of QnA records to import. + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringAssets(IList synonyms, IList qnas, IDictionary additionalBinaryDataProperties) + { + Synonyms = synonyms; + Qnas = qnas; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Collection of synonyms. + public IList Synonyms { get; } + + /// List of QnA records to import. + public IList Qnas { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringDialog.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringDialog.Serialization.cs similarity index 55% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringDialog.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringDialog.Serialization.cs index 3e5157bc63a6..a6ad50623031 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringDialog.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringDialog.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringDialog : IUtf8JsonSerializable, IJsonModel + /// Dialog associated with QnA Record. + public partial class QuestionAnsweringAuthoringDialog : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringDialog)} does not support writing '{format}' format."); } - if (Optional.IsDefined(IsContextOnly)) { writer.WritePropertyName("isContextOnly"u8); @@ -43,21 +42,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("prompts"u8); writer.WriteStartArray(); - foreach (var item in Prompts) + foreach (QuestionAnsweringAuthoringPrompt item in Prompts) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,49 +65,53 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringDialog IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringDialog IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringDialog JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringDialog)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringDialog(document.RootElement, options); } - internal static QuestionAnsweringAuthoringDialog DeserializeQuestionAnsweringAuthoringDialog(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringDialog DeserializeQuestionAnsweringAuthoringDialog(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } bool? isContextOnly = default; IList prompts = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("isContextOnly"u8)) + if (prop.NameEquals("isContextOnly"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - isContextOnly = property.Value.GetBoolean(); + isContextOnly = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("prompts"u8)) + if (prop.NameEquals("prompts"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(QuestionAnsweringAuthoringPrompt.DeserializeQuestionAnsweringAuthoringPrompt(item, options)); } @@ -117,17 +120,19 @@ internal static QuestionAnsweringAuthoringDialog DeserializeQuestionAnsweringAut } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringDialog(isContextOnly, prompts ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new QuestionAnsweringAuthoringDialog(isContextOnly, prompts ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -137,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReader } } - QuestionAnsweringAuthoringDialog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringDialog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringDialog PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringDialog(document.RootElement, options); } default: @@ -153,22 +163,7 @@ QuestionAnsweringAuthoringDialog IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringDialog FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringDialog(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringDialog.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringDialog.cs similarity index 53% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringDialog.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringDialog.cs index f083de85d4c2..706787395ebd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringDialog.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringDialog.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Dialog associated with QnA Record. public partial class QuestionAnsweringAuthoringDialog { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public QuestionAnsweringAuthoringDialog() @@ -58,12 +29,12 @@ public QuestionAnsweringAuthoringDialog() /// ignores context and includes this QnA in answers. /// /// List of prompts associated with the answer. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringDialog(bool? isContextOnly, IList prompts, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringDialog(bool? isContextOnly, IList prompts, IDictionary additionalBinaryDataProperties) { IsContextOnly = isContextOnly; Prompts = prompts; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -72,6 +43,7 @@ internal QuestionAnsweringAuthoringDialog(bool? isContextOnly, IList public bool? IsContextOnly { get; set; } + /// List of prompts associated with the answer. public IList Prompts { get; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.Serialization.cs new file mode 100644 index 000000000000..5365b69884c3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.Serialization.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Export job status, project metadata, and assets. + public partial class QuestionAnsweringAuthoringExportJobState : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringExportJobState() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support writing '{format}' format."); + } + 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(LastUpdated, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (ResponseError item in Errors) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + ((IJsonModel)item).Write(writer, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("resultUrl"u8); + writer.WriteStringValue(ResultUrl); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringExportJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringExportJobState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnsweringAuthoringExportJobState(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringExportJobState DeserializeQuestionAnsweringAuthoringExportJobState(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset createdDateTime = default; + DateTimeOffset? expirationDateTime = default; + string jobId = default; + DateTimeOffset lastUpdated = default; + QuestionAnsweringAuthoringJobStatus status = default; + IList errors = default; + string resultUrl = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("createdDateTime"u8)) + { + createdDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("expirationDateTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("jobId"u8)) + { + jobId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("lastUpdatedDateTime"u8)) + { + lastUpdated = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("status"u8)) + { + status = new QuestionAnsweringAuthoringJobStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("errors"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + } + errors = array; + continue; + } + if (prop.NameEquals("resultUrl"u8)) + { + resultUrl = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuestionAnsweringAuthoringExportJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdated, + status, + errors ?? new ChangeTrackingList(), + resultUrl, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringExportJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringExportJobState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeQuestionAnsweringAuthoringExportJobState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator QuestionAnsweringAuthoringExportJobState(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringAuthoringExportJobState(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.cs index 614977009bb9..48d1ef12376b 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringExportJobState.cs @@ -7,58 +7,27 @@ using System; using System.Collections.Generic; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { /// Export job status, project metadata, and assets. public partial class QuestionAnsweringAuthoringExportJobState { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The creation date time of the job. /// The last date time the job was updated. /// Job Status. /// URL to download the result of the Export Job. - /// is null. internal QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime, DateTimeOffset lastUpdated, QuestionAnsweringAuthoringJobStatus status, string resultUrl) { - Argument.AssertNotNull(resultUrl, nameof(resultUrl)); - CreatedDateTime = createdDateTime; LastUpdated = lastUpdated; Status = status; - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); ResultUrl = resultUrl; } @@ -70,8 +39,8 @@ internal QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime /// Job Status. /// The errors encountered while executing the job. /// URL to download the result of the Export Job. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdated, QuestionAnsweringAuthoringJobStatus status, IReadOnlyList errors, string resultUrl, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdated, QuestionAnsweringAuthoringJobStatus status, IList errors, string resultUrl, IDictionary additionalBinaryDataProperties) { CreatedDateTime = createdDateTime; ExpirationDateTime = expirationDateTime; @@ -80,26 +49,27 @@ internal QuestionAnsweringAuthoringExportJobState(DateTimeOffset createdDateTime Status = status; Errors = errors; ResultUrl = resultUrl; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringExportJobState() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The creation date time of the job. public DateTimeOffset CreatedDateTime { get; } + /// The expiration date time of the job. public DateTimeOffset? ExpirationDateTime { get; } + /// The job ID. public string JobId { get; } + /// The last date time the job was updated. public DateTimeOffset LastUpdated { get; } + /// Job Status. public QuestionAnsweringAuthoringJobStatus Status { get; } + /// The errors encountered while executing the job. - public IReadOnlyList Errors { get; } + public IList Errors { get; } + /// URL to download the result of the Export Job. public string ResultUrl { get; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringImportJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringImportJobState.Serialization.cs similarity index 50% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringImportJobState.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringImportJobState.Serialization.cs index 3122748f6c88..7365be32d29d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringImportJobState.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringImportJobState.Serialization.cs @@ -8,15 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringImportJobState : IUtf8JsonSerializable, IJsonModel + /// Import job status, project metadata, and assets. + public partial class QuestionAnsweringAuthoringImportJobState : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringImportJobState() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +35,11 @@ void IJsonModel.Write(Utf8JsonWriter w /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringImportJobState)} does not support writing '{format}' format."); } - writer.WritePropertyName("createdDateTime"u8); writer.WriteStringValue(CreatedDateTime, "O"); if (Optional.IsDefined(ExpirationDateTime)) @@ -54,21 +60,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("errors"u8); writer.WriteStartArray(); - foreach (var item in Errors) + foreach (ResponseError item in Errors) { - writer.WriteObjectValue(item, options); + if (item == null) + { + writer.WriteNullValue(); + continue; + } + ((IJsonModel)item).Write(writer, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -77,22 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringImportJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringImportJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringImportJobState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringImportJobState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringImportJobState(document.RootElement, options); } - internal static QuestionAnsweringAuthoringImportJobState DeserializeQuestionAnsweringAuthoringImportJobState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringImportJobState DeserializeQuestionAnsweringAuthoringImportJobState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -102,74 +118,82 @@ internal static QuestionAnsweringAuthoringImportJobState DeserializeQuestionAnsw string jobId = default; DateTimeOffset lastUpdatedDateTime = default; QuestionAnsweringAuthoringJobStatus status = default; - IReadOnlyList errors = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList errors = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("createdDateTime"u8)) + if (prop.NameEquals("createdDateTime"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); + createdDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("expirationDateTime"u8)) + if (prop.NameEquals("expirationDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - expirationDateTime = property.Value.GetDateTimeOffset("O"); + expirationDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("jobId"u8)) + if (prop.NameEquals("jobId"u8)) { - jobId = property.Value.GetString(); + jobId = prop.Value.GetString(); continue; } - if (property.NameEquals("lastUpdatedDateTime"u8)) + if (prop.NameEquals("lastUpdatedDateTime"u8)) { - lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - status = new QuestionAnsweringAuthoringJobStatus(property.Value.GetString()); + status = new QuestionAnsweringAuthoringJobStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("errors"u8)) + if (prop.NameEquals("errors"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(QuestionAnsweringAuthoringError.DeserializeQuestionAnsweringAuthoringError(item, options)); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } } errors = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new QuestionAnsweringAuthoringImportJobState( createdDateTime, expirationDateTime, jobId, lastUpdatedDateTime, status, - errors ?? new ChangeTrackingList(), - serializedAdditionalRawData); + errors ?? new ChangeTrackingList(), + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -179,15 +203,20 @@ BinaryData IPersistableModel.Write(Mod } } - QuestionAnsweringAuthoringImportJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringImportJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringImportJobState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringImportJobState(document.RootElement, options); } default: @@ -195,22 +224,14 @@ QuestionAnsweringAuthoringImportJobState IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringImportJobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringImportJobState(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to deserialize the from. + public static explicit operator QuestionAnsweringAuthoringImportJobState(Response response) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringAuthoringImportJobState(document.RootElement, ModelSerializationExtensions.WireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringImportJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringImportJobState.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringImportJobState.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringImportJobState.cs index 086a1e2c0a39..26c8cca5c15e 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringImportJobState.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringImportJobState.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { /// Import job status, project metadata, and assets. public partial class QuestionAnsweringAuthoringImportJobState { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The creation date time of the job. @@ -54,7 +26,7 @@ internal QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime CreatedDateTime = createdDateTime; LastUpdatedDateTime = lastUpdatedDateTime; Status = status; - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -64,8 +36,8 @@ internal QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime /// The last date time the job was updated. /// Job Status. /// The errors encountered while executing the job. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IList errors, IDictionary additionalBinaryDataProperties) { CreatedDateTime = createdDateTime; ExpirationDateTime = expirationDateTime; @@ -73,25 +45,25 @@ internal QuestionAnsweringAuthoringImportJobState(DateTimeOffset createdDateTime LastUpdatedDateTime = lastUpdatedDateTime; Status = status; Errors = errors; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringImportJobState() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The creation date time of the job. public DateTimeOffset CreatedDateTime { get; } + /// The expiration date time of the job. public DateTimeOffset? ExpirationDateTime { get; } + /// The job ID. public string JobId { get; } + /// The last date time the job was updated. public DateTimeOffset LastUpdatedDateTime { get; } + /// Job Status. public QuestionAnsweringAuthoringJobStatus Status { get; } + /// The errors encountered while executing the job. - public IReadOnlyList Errors { get; } + public IList Errors { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringJobStatus.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringJobStatus.cs similarity index 70% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringJobStatus.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringJobStatus.cs index 5549936f84f2..e7612025f25d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringJobStatus.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringJobStatus.cs @@ -14,14 +14,6 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring public readonly partial struct QuestionAnsweringAuthoringJobStatus : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public QuestionAnsweringAuthoringJobStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string NotStartedValue = "notStarted"; private const string RunningValue = "running"; private const string SucceededValue = "succeeded"; @@ -30,37 +22,67 @@ public QuestionAnsweringAuthoringJobStatus(string value) private const string CancellingValue = "cancelling"; private const string PartiallyCompletedValue = "partiallyCompleted"; - /// notStarted. + /// Initializes a new instance of . + /// The value. + /// is null. + public QuestionAnsweringAuthoringJobStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the NotStarted. public static QuestionAnsweringAuthoringJobStatus NotStarted { get; } = new QuestionAnsweringAuthoringJobStatus(NotStartedValue); - /// running. + + /// Gets the Running. public static QuestionAnsweringAuthoringJobStatus Running { get; } = new QuestionAnsweringAuthoringJobStatus(RunningValue); - /// succeeded. + + /// Gets the Succeeded. public static QuestionAnsweringAuthoringJobStatus Succeeded { get; } = new QuestionAnsweringAuthoringJobStatus(SucceededValue); - /// failed. + + /// Gets the Failed. public static QuestionAnsweringAuthoringJobStatus Failed { get; } = new QuestionAnsweringAuthoringJobStatus(FailedValue); - /// cancelled. + + /// Gets the Cancelled. public static QuestionAnsweringAuthoringJobStatus Cancelled { get; } = new QuestionAnsweringAuthoringJobStatus(CancelledValue); - /// cancelling. + + /// Gets the Cancelling. public static QuestionAnsweringAuthoringJobStatus Cancelling { get; } = new QuestionAnsweringAuthoringJobStatus(CancellingValue); - /// partiallyCompleted. + + /// Gets the PartiallyCompleted. public static QuestionAnsweringAuthoringJobStatus PartiallyCompleted { get; } = new QuestionAnsweringAuthoringJobStatus(PartiallyCompletedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(QuestionAnsweringAuthoringJobStatus left, QuestionAnsweringAuthoringJobStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(QuestionAnsweringAuthoringJobStatus left, QuestionAnsweringAuthoringJobStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator QuestionAnsweringAuthoringJobStatus(string value) => new QuestionAnsweringAuthoringJobStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator QuestionAnsweringAuthoringJobStatus?(string value) => value == null ? null : new QuestionAnsweringAuthoringJobStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is QuestionAnsweringAuthoringJobStatus other && Equals(other); - /// + + /// public bool Equals(QuestionAnsweringAuthoringJobStatus 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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs similarity index 50% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs index 21d8cf0f5873..ff85d235f7cd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeletionJobState.Serialization.cs @@ -8,15 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringProjectDeletionJobState : IUtf8JsonSerializable, IJsonModel + /// Represents the state of a project deletion job. + public partial class QuestionAnsweringAuthoringProjectDeletionJobState : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringProjectDeletionJobState() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +35,11 @@ void IJsonModel.Write(Utf8Jso /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringProjectDeletionJobState)} does not support writing '{format}' format."); } - writer.WritePropertyName("createdDateTime"u8); writer.WriteStringValue(CreatedDateTime, "O"); if (Optional.IsDefined(ExpirationDateTime)) @@ -54,21 +60,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("errors"u8); writer.WriteStartArray(); - foreach (var item in Errors) + foreach (ResponseError item in Errors) { - writer.WriteObjectValue(item, options); + if (item == null) + { + writer.WriteNullValue(); + continue; + } + ((IJsonModel)item).Write(writer, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -77,22 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringProjectDeletionJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringProjectDeletionJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringProjectDeletionJobState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringProjectDeletionJobState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringProjectDeletionJobState(document.RootElement, options); } - internal static QuestionAnsweringAuthoringProjectDeletionJobState DeserializeQuestionAnsweringAuthoringProjectDeletionJobState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringProjectDeletionJobState DeserializeQuestionAnsweringAuthoringProjectDeletionJobState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -102,74 +118,82 @@ internal static QuestionAnsweringAuthoringProjectDeletionJobState DeserializeQue string jobId = default; DateTimeOffset lastUpdatedDateTime = default; QuestionAnsweringAuthoringJobStatus status = default; - IReadOnlyList errors = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList errors = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("createdDateTime"u8)) + if (prop.NameEquals("createdDateTime"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); + createdDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("expirationDateTime"u8)) + if (prop.NameEquals("expirationDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - expirationDateTime = property.Value.GetDateTimeOffset("O"); + expirationDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("jobId"u8)) + if (prop.NameEquals("jobId"u8)) { - jobId = property.Value.GetString(); + jobId = prop.Value.GetString(); continue; } - if (property.NameEquals("lastUpdatedDateTime"u8)) + if (prop.NameEquals("lastUpdatedDateTime"u8)) { - lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - status = new QuestionAnsweringAuthoringJobStatus(property.Value.GetString()); + status = new QuestionAnsweringAuthoringJobStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("errors"u8)) + if (prop.NameEquals("errors"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(QuestionAnsweringAuthoringError.DeserializeQuestionAnsweringAuthoringError(item, options)); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } } errors = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new QuestionAnsweringAuthoringProjectDeletionJobState( createdDateTime, expirationDateTime, jobId, lastUpdatedDateTime, status, - errors ?? new ChangeTrackingList(), - serializedAdditionalRawData); + errors ?? new ChangeTrackingList(), + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -179,15 +203,20 @@ BinaryData IPersistableModel. } } - QuestionAnsweringAuthoringProjectDeletionJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringProjectDeletionJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringProjectDeletionJobState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringProjectDeletionJobState(document.RootElement, options); } default: @@ -195,22 +224,14 @@ QuestionAnsweringAuthoringProjectDeletionJobState IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringProjectDeletionJobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringProjectDeletionJobState(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to deserialize the from. + public static explicit operator QuestionAnsweringAuthoringProjectDeletionJobState(Response response) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringAuthoringProjectDeletionJobState(document.RootElement, ModelSerializationExtensions.WireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringProjectDeletionJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeletionJobState.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringProjectDeletionJobState.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeletionJobState.cs index 37e0eeb7b748..8b3c26de3ec8 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringProjectDeletionJobState.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeletionJobState.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { /// Represents the state of a project deletion job. public partial class QuestionAnsweringAuthoringProjectDeletionJobState { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The creation date time of the job. @@ -54,7 +26,7 @@ internal QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset create CreatedDateTime = createdDateTime; LastUpdatedDateTime = lastUpdatedDateTime; Status = status; - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -64,8 +36,8 @@ internal QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset create /// The last date time the job was updated. /// Job Status. /// The errors encountered while executing the job. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IList errors, IDictionary additionalBinaryDataProperties) { CreatedDateTime = createdDateTime; ExpirationDateTime = expirationDateTime; @@ -73,25 +45,25 @@ internal QuestionAnsweringAuthoringProjectDeletionJobState(DateTimeOffset create LastUpdatedDateTime = lastUpdatedDateTime; Status = status; Errors = errors; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringProjectDeletionJobState() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The creation date time of the job. public DateTimeOffset CreatedDateTime { get; } + /// The expiration date time of the job. public DateTimeOffset? ExpirationDateTime { get; } + /// The job ID. public string JobId { get; } + /// The last date time the job was updated. public DateTimeOffset LastUpdatedDateTime { get; } + /// Job Status. public QuestionAnsweringAuthoringJobStatus Status { get; } + /// The errors encountered while executing the job. - public IReadOnlyList Errors { get; } + public IList Errors { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.Serialization.cs new file mode 100644 index 000000000000..a6dc0b2947a7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.Serialization.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Job state represents the job metadata and any errors. + public partial class QuestionAnsweringAuthoringProjectDeploymentJobState : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringProjectDeploymentJobState() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringProjectDeploymentJobState)} does not support writing '{format}' format."); + } + 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 (ResponseError item in Errors) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + ((IJsonModel)item).Write(writer, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringProjectDeploymentJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringProjectDeploymentJobState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringProjectDeploymentJobState)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnsweringAuthoringProjectDeploymentJobState(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringProjectDeploymentJobState DeserializeQuestionAnsweringAuthoringProjectDeploymentJobState(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset createdDateTime = default; + DateTimeOffset? expirationDateTime = default; + string jobId = default; + DateTimeOffset lastUpdatedDateTime = default; + QuestionAnsweringAuthoringJobStatus status = default; + IList errors = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("createdDateTime"u8)) + { + createdDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("expirationDateTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("jobId"u8)) + { + jobId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("lastUpdatedDateTime"u8)) + { + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("status"u8)) + { + status = new QuestionAnsweringAuthoringJobStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("errors"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + } + errors = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuestionAnsweringAuthoringProjectDeploymentJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors ?? new ChangeTrackingList(), + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringProjectDeploymentJobState)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringProjectDeploymentJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringProjectDeploymentJobState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeQuestionAnsweringAuthoringProjectDeploymentJobState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringProjectDeploymentJobState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator QuestionAnsweringAuthoringProjectDeploymentJobState(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringAuthoringProjectDeploymentJobState(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.cs new file mode 100644 index 000000000000..fc53619c43bf --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringProjectDeploymentJobState.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; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Job state represents the job metadata and any errors. + public partial class QuestionAnsweringAuthoringProjectDeploymentJobState + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The creation date time of the job. + /// The last date time the job was updated. + /// Job Status. + internal QuestionAnsweringAuthoringProjectDeploymentJobState(DateTimeOffset createdDateTime, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status) + { + CreatedDateTime = createdDateTime; + LastUpdatedDateTime = lastUpdatedDateTime; + Status = status; + Errors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The creation date time of the job. + /// The expiration date time of the job. + /// The job ID. + /// The last date time the job was updated. + /// Job Status. + /// The errors encountered while executing the job. + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringProjectDeploymentJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IList errors, IDictionary additionalBinaryDataProperties) + { + CreatedDateTime = createdDateTime; + ExpirationDateTime = expirationDateTime; + JobId = jobId; + LastUpdatedDateTime = lastUpdatedDateTime; + Status = status; + Errors = errors; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The creation date time of the job. + public DateTimeOffset CreatedDateTime { get; } + + /// The expiration date time of the job. + public DateTimeOffset? ExpirationDateTime { get; } + + /// The job ID. + public string JobId { get; } + + /// The last date time the job was updated. + public DateTimeOffset LastUpdatedDateTime { get; } + + /// Job Status. + public QuestionAnsweringAuthoringJobStatus Status { get; } + + /// The errors encountered while executing the job. + public IList Errors { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringPrompt.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringPrompt.Serialization.cs similarity index 54% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringPrompt.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringPrompt.Serialization.cs index 772a314be5b4..0252bb0fb0fc 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringPrompt.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringPrompt.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringPrompt : IUtf8JsonSerializable, IJsonModel + /// Prompt for an answer. + public partial class QuestionAnsweringAuthoringPrompt : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringPrompt)} does not support writing '{format}' format."); } - if (Optional.IsDefined(DisplayOrder)) { writer.WritePropertyName("displayOrder"u8); @@ -54,15 +53,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("displayText"u8); writer.WriteStringValue(DisplayText); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -71,79 +70,85 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringPrompt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringPrompt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringPrompt JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringPrompt)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringPrompt(document.RootElement, options); } - internal static QuestionAnsweringAuthoringPrompt DeserializeQuestionAnsweringAuthoringPrompt(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringPrompt DeserializeQuestionAnsweringAuthoringPrompt(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } int? displayOrder = default; int? qnaId = default; - QuestionAnsweringAuthoringRecord qna = default; + QuestionAnsweringAuthoringRecord qnaRecord = default; string displayText = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("displayOrder"u8)) + if (prop.NameEquals("displayOrder"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - displayOrder = property.Value.GetInt32(); + displayOrder = prop.Value.GetInt32(); continue; } - if (property.NameEquals("qnaId"u8)) + if (prop.NameEquals("qnaId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - qnaId = property.Value.GetInt32(); + qnaId = prop.Value.GetInt32(); continue; } - if (property.NameEquals("qna"u8)) + if (prop.NameEquals("qna"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - qna = QuestionAnsweringAuthoringRecord.DeserializeQuestionAnsweringAuthoringRecord(property.Value, options); + qnaRecord = QuestionAnsweringAuthoringRecord.DeserializeQuestionAnsweringAuthoringRecord(prop.Value, options); continue; } - if (property.NameEquals("displayText"u8)) + if (prop.NameEquals("displayText"u8)) { - displayText = property.Value.GetString(); + displayText = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringPrompt(displayOrder, qnaId, qna, displayText, serializedAdditionalRawData); + return new QuestionAnsweringAuthoringPrompt(displayOrder, qnaId, qnaRecord, displayText, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -153,15 +158,20 @@ BinaryData IPersistableModel.Write(ModelReader } } - QuestionAnsweringAuthoringPrompt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringPrompt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringPrompt PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringPrompt(document.RootElement, options); } default: @@ -169,22 +179,7 @@ QuestionAnsweringAuthoringPrompt IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringPrompt FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringPrompt(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringPrompt.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringPrompt.cs similarity index 54% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringPrompt.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringPrompt.cs index 77f0db5e197c..9704232aecd2 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringPrompt.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringPrompt.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Prompt for an answer. public partial class QuestionAnsweringAuthoringPrompt { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public QuestionAnsweringAuthoringPrompt() @@ -55,22 +26,25 @@ public QuestionAnsweringAuthoringPrompt() /// ID of the QnA corresponding to the prompt. /// QnA record. Either QnAId or QnA record needs to be present in a Prompt. /// Text displayed to represent a follow up question prompt. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringPrompt(int? displayOrder, int? qnaId, QuestionAnsweringAuthoringRecord qnaRecord, string displayText, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringPrompt(int? displayOrder, int? qnaId, QuestionAnsweringAuthoringRecord qnaRecord, string displayText, IDictionary additionalBinaryDataProperties) { DisplayOrder = displayOrder; QnaId = qnaId; QnaRecord = qnaRecord; DisplayText = displayText; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Index of the prompt. It is used for ordering of the prompts. public int? DisplayOrder { get; set; } + /// ID of the QnA corresponding to the prompt. public int? QnaId { get; set; } + /// QnA record. Either QnAId or QnA record needs to be present in a Prompt. public QuestionAnsweringAuthoringRecord QnaRecord { get; set; } + /// Text displayed to represent a follow up question prompt. public string DisplayText { get; set; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringRecord.Serialization.cs similarity index 55% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringRecord.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringRecord.Serialization.cs index 243203f4ad09..9fc0739ba241 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringRecord.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringRecord.Serialization.cs @@ -9,14 +9,19 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringRecord : IUtf8JsonSerializable, IJsonModel + /// QnA record. + public partial class QuestionAnsweringAuthoringRecord : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringRecord() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringRecord)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); writer.WriteNumberValue(Id); if (Optional.IsDefined(Answer)) @@ -50,8 +54,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("questions"u8); writer.WriteStartArray(); - foreach (var item in Questions) + foreach (string item in Questions) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -63,6 +72,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Metadata) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -76,21 +90,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("activeLearningSuggestions"u8); writer.WriteStartArray(); - foreach (var item in ActiveLearningSuggestionClusters) + foreach (SuggestedQuestionsCluster item in ActiveLearningSuggestionClusters) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -99,22 +113,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringRecord)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringRecord(document.RootElement, options); } - internal static QuestionAnsweringAuthoringRecord DeserializeQuestionAnsweringAuthoringRecord(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringRecord DeserializeQuestionAnsweringAuthoringRecord(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -125,83 +144,95 @@ internal static QuestionAnsweringAuthoringRecord DeserializeQuestionAnsweringAut IList questions = default; IDictionary metadata = default; QuestionAnsweringAuthoringDialog dialog = default; - IList activeLearningSuggestions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList activeLearningSuggestionClusters = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = property.Value.GetInt32(); + id = prop.Value.GetInt32(); continue; } - if (property.NameEquals("answer"u8)) + if (prop.NameEquals("answer"u8)) { - answer = property.Value.GetString(); + answer = prop.Value.GetString(); continue; } - if (property.NameEquals("source"u8)) + if (prop.NameEquals("source"u8)) { - source = property.Value.GetString(); + source = prop.Value.GetString(); continue; } - if (property.NameEquals("questions"u8)) + if (prop.NameEquals("questions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } questions = array; continue; } - if (property.NameEquals("metadata"u8)) + if (prop.NameEquals("metadata"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } metadata = dictionary; continue; } - if (property.NameEquals("dialog"u8)) + if (prop.NameEquals("dialog"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - dialog = QuestionAnsweringAuthoringDialog.DeserializeQuestionAnsweringAuthoringDialog(property.Value, options); + dialog = QuestionAnsweringAuthoringDialog.DeserializeQuestionAnsweringAuthoringDialog(prop.Value, options); continue; } - if (property.NameEquals("activeLearningSuggestions"u8)) + if (prop.NameEquals("activeLearningSuggestions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(SuggestedQuestionsCluster.DeserializeSuggestedQuestionsCluster(item, options)); } - activeLearningSuggestions = array; + activeLearningSuggestionClusters = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new QuestionAnsweringAuthoringRecord( id, answer, @@ -209,14 +240,17 @@ internal static QuestionAnsweringAuthoringRecord DeserializeQuestionAnsweringAut questions ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), dialog, - activeLearningSuggestions ?? new ChangeTrackingList(), - serializedAdditionalRawData); + activeLearningSuggestionClusters ?? new ChangeTrackingList(), + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -226,15 +260,20 @@ BinaryData IPersistableModel.Write(ModelReader } } - QuestionAnsweringAuthoringRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringRecord(document.RootElement, options); } default: @@ -242,22 +281,7 @@ QuestionAnsweringAuthoringRecord IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringRecord FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringRecord(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringRecord.cs similarity index 64% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringRecord.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringRecord.cs index a30a6a3fc0bb..2434833fb851 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringRecord.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringRecord.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// QnA record. public partial class QuestionAnsweringAuthoringRecord { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Unique ID for the QnA. @@ -69,8 +40,8 @@ public QuestionAnsweringAuthoringRecord(int id) /// /// Context of a QnA. /// List of Active Learning suggestions for the QnA. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringRecord(int id, string answer, string source, IList questions, IDictionary metadata, QuestionAnsweringAuthoringDialog dialog, IList activeLearningSuggestionClusters, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringRecord(int id, string answer, string source, IList questions, IDictionary metadata, QuestionAnsweringAuthoringDialog dialog, IList activeLearningSuggestionClusters, IDictionary additionalBinaryDataProperties) { Id = id; Answer = answer; @@ -79,32 +50,33 @@ internal QuestionAnsweringAuthoringRecord(int id, string answer, string source, Metadata = metadata; Dialog = dialog; ActiveLearningSuggestionClusters = activeLearningSuggestionClusters; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringRecord() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Unique ID for the QnA. public int Id { get; set; } + /// Answer text. public string Answer { get; set; } + /// /// Source from which QnA was indexed e.g. /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . /// public string Source { get; set; } + /// List of questions associated with the answer. public IList Questions { get; } + /// /// Metadata associated with the answer, useful to categorize or filter question /// answers. /// public IDictionary Metadata { get; } + /// Context of a QnA. public QuestionAnsweringAuthoringDialog Dialog { get; set; } + /// List of Active Learning suggestions for the QnA. public IList ActiveLearningSuggestionClusters { get; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringSourceRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringSourceRecord.Serialization.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringSourceRecord.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringSourceRecord.Serialization.cs index 4b360ecc1a5f..bcbbfd583fe3 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringSourceRecord.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringSourceRecord.Serialization.cs @@ -9,14 +9,19 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringAuthoringSourceRecord : IUtf8JsonSerializable, IJsonModel + /// Custom source record with last updated date-time. + public partial class QuestionAnsweringAuthoringSourceRecord : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringSourceRecord() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter wri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringSourceRecord)} does not support writing '{format}' format."); } - if (Optional.IsDefined(DisplayName)) { writer.WritePropertyName("displayName"u8); @@ -55,15 +59,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("lastUpdatedDateTime"u8); writer.WriteStringValue(LastUpdatedDateTime.Value, "O"); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -72,22 +76,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringAuthoringSourceRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringSourceRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringSourceRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringSourceRecord)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringAuthoringSourceRecord(document.RootElement, options); } - internal static QuestionAnsweringAuthoringSourceRecord DeserializeQuestionAnsweringAuthoringSourceRecord(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringSourceRecord DeserializeQuestionAnsweringAuthoringSourceRecord(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,54 +107,52 @@ internal static QuestionAnsweringAuthoringSourceRecord DeserializeQuestionAnswer KnowledgeBaseSourceKind sourceKind = default; SourceContentStructureKind? contentStructureKind = default; DateTimeOffset? lastUpdatedDateTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("displayName"u8)) + if (prop.NameEquals("displayName"u8)) { - displayName = property.Value.GetString(); + displayName = prop.Value.GetString(); continue; } - if (property.NameEquals("source"u8)) + if (prop.NameEquals("source"u8)) { - source = property.Value.GetString(); + source = prop.Value.GetString(); continue; } - if (property.NameEquals("sourceUri"u8)) + if (prop.NameEquals("sourceUri"u8)) { - sourceUri = new Uri(property.Value.GetString()); + sourceUri = new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("sourceKind"u8)) + if (prop.NameEquals("sourceKind"u8)) { - sourceKind = new KnowledgeBaseSourceKind(property.Value.GetString()); + sourceKind = new KnowledgeBaseSourceKind(prop.Value.GetString()); continue; } - if (property.NameEquals("contentStructureKind"u8)) + if (prop.NameEquals("contentStructureKind"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - contentStructureKind = new SourceContentStructureKind(property.Value.GetString()); + contentStructureKind = new SourceContentStructureKind(prop.Value.GetString()); continue; } - if (property.NameEquals("lastUpdatedDateTime"u8)) + if (prop.NameEquals("lastUpdatedDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new QuestionAnsweringAuthoringSourceRecord( displayName, source, @@ -153,13 +160,16 @@ internal static QuestionAnsweringAuthoringSourceRecord DeserializeQuestionAnswer sourceKind, contentStructureKind, lastUpdatedDateTime, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -169,15 +179,20 @@ BinaryData IPersistableModel.Write(Model } } - QuestionAnsweringAuthoringSourceRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringSourceRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringSourceRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringAuthoringSourceRecord(document.RootElement, options); } default: @@ -185,22 +200,7 @@ QuestionAnsweringAuthoringSourceRecord IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringSourceRecord FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringSourceRecord(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringSourceRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringSourceRecord.cs similarity index 60% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringSourceRecord.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringSourceRecord.cs index 29609cf8d6dc..374fa68c526c 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringSourceRecord.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringSourceRecord.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Custom source record with last updated date-time. public partial class QuestionAnsweringAuthoringSourceRecord { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -52,12 +23,8 @@ public partial class QuestionAnsweringAuthoringSourceRecord /// /// URI location for the file or url. /// Supported source types. - /// or is null. internal QuestionAnsweringAuthoringSourceRecord(string source, Uri sourceUri, KnowledgeBaseSourceKind sourceKind) { - Argument.AssertNotNull(source, nameof(source)); - Argument.AssertNotNull(sourceUri, nameof(sourceUri)); - Source = source; SourceUri = sourceUri; SourceKind = sourceKind; @@ -73,8 +40,8 @@ internal QuestionAnsweringAuthoringSourceRecord(string source, Uri sourceUri, Kn /// Supported source types. /// Content structure type for sources. /// Date-time when the QnA was last updated. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringSourceRecord(string displayName, string source, Uri sourceUri, KnowledgeBaseSourceKind sourceKind, SourceContentStructureKind? contentStructureKind, DateTimeOffset? lastUpdatedDateTime, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringSourceRecord(string displayName, string source, Uri sourceUri, KnowledgeBaseSourceKind sourceKind, SourceContentStructureKind? contentStructureKind, DateTimeOffset? lastUpdatedDateTime, IDictionary additionalBinaryDataProperties) { DisplayName = displayName; Source = source; @@ -82,27 +49,27 @@ internal QuestionAnsweringAuthoringSourceRecord(string displayName, string sourc SourceKind = sourceKind; ContentStructureKind = contentStructureKind; LastUpdatedDateTime = lastUpdatedDateTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringSourceRecord() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Friendly name of the Source. public string DisplayName { get; } + /// /// Unique source identifier. Name of the file if it's a 'file' source; otherwise, /// the complete URL if it's a 'url' source. /// public string Source { get; } + /// URI location for the file or url. public Uri SourceUri { get; } + /// Supported source types. public KnowledgeBaseSourceKind SourceKind { get; } + /// Content structure type for sources. public SourceContentStructureKind? ContentStructureKind { get; } + /// Date-time when the QnA was last updated. public DateTimeOffset? LastUpdatedDateTime { get; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs new file mode 100644 index 000000000000..0dda54edfcec --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Job state represents the job metadata and any errors. + public partial class QuestionAnsweringAuthoringUpdateQnasJobState : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringUpdateQnasJobState() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support writing '{format}' format."); + } + 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 (ResponseError item in Errors) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + ((IJsonModel)item).Write(writer, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringUpdateQnasJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringUpdateQnasJobState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringUpdateQnasJobState DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset createdDateTime = default; + DateTimeOffset? expirationDateTime = default; + string jobId = default; + DateTimeOffset lastUpdatedDateTime = default; + QuestionAnsweringAuthoringJobStatus status = default; + IList errors = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("createdDateTime"u8)) + { + createdDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("expirationDateTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("jobId"u8)) + { + jobId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("lastUpdatedDateTime"u8)) + { + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("status"u8)) + { + status = new QuestionAnsweringAuthoringJobStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("errors"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + } + errors = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuestionAnsweringAuthoringUpdateQnasJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors ?? new ChangeTrackingList(), + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringUpdateQnasJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringUpdateQnasJobState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator QuestionAnsweringAuthoringUpdateQnasJobState(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.cs index 7d0514bdc737..917e9122aa59 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateQnasJobState.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { /// Job state represents the job metadata and any errors. public partial class QuestionAnsweringAuthoringUpdateQnasJobState { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The creation date time of the job. @@ -54,7 +26,7 @@ internal QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDate CreatedDateTime = createdDateTime; LastUpdatedDateTime = lastUpdatedDateTime; Status = status; - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -64,8 +36,8 @@ internal QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDate /// The last date time the job was updated. /// Job Status. /// The errors encountered while executing the job. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IList errors, IDictionary additionalBinaryDataProperties) { CreatedDateTime = createdDateTime; ExpirationDateTime = expirationDateTime; @@ -73,25 +45,25 @@ internal QuestionAnsweringAuthoringUpdateQnasJobState(DateTimeOffset createdDate LastUpdatedDateTime = lastUpdatedDateTime; Status = status; Errors = errors; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringUpdateQnasJobState() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The creation date time of the job. public DateTimeOffset CreatedDateTime { get; } + /// The expiration date time of the job. public DateTimeOffset? ExpirationDateTime { get; } + /// The job ID. public string JobId { get; } + /// The last date time the job was updated. public DateTimeOffset LastUpdatedDateTime { get; } + /// Job Status. public QuestionAnsweringAuthoringJobStatus Status { get; } + /// The errors encountered while executing the job. - public IReadOnlyList Errors { get; } + public IList Errors { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs new file mode 100644 index 000000000000..9724cc2978f0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Job state represents the job metadata and any errors. + public partial class QuestionAnsweringAuthoringUpdateSourcesJobState : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringAuthoringUpdateSourcesJobState() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support writing '{format}' format."); + } + 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 (ResponseError item in Errors) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + ((IJsonModel)item).Write(writer, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringUpdateSourcesJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringUpdateSourcesJobState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringAuthoringUpdateSourcesJobState DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset createdDateTime = default; + DateTimeOffset? expirationDateTime = default; + string jobId = default; + DateTimeOffset lastUpdatedDateTime = default; + QuestionAnsweringAuthoringJobStatus status = default; + IList errors = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("createdDateTime"u8)) + { + createdDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("expirationDateTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("jobId"u8)) + { + jobId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("lastUpdatedDateTime"u8)) + { + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("status"u8)) + { + status = new QuestionAnsweringAuthoringJobStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("errors"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureAILanguageQuestionAnsweringAuthoringContext.Default)); + } + } + errors = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuestionAnsweringAuthoringUpdateSourcesJobState( + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors ?? new ChangeTrackingList(), + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringAuthoringUpdateSourcesJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringAuthoringUpdateSourcesJobState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator QuestionAnsweringAuthoringUpdateSourcesJobState(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.cs index 6187ee751cfd..3e8fb43eb615 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringAuthoringUpdateSourcesJobState.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { /// Job state represents the job metadata and any errors. public partial class QuestionAnsweringAuthoringUpdateSourcesJobState { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The creation date time of the job. @@ -54,7 +26,7 @@ internal QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdD CreatedDateTime = createdDateTime; LastUpdatedDateTime = lastUpdatedDateTime; Status = status; - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -64,8 +36,8 @@ internal QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdD /// The last date time the job was updated. /// Job Status. /// The errors encountered while executing the job. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IList errors, IDictionary additionalBinaryDataProperties) { CreatedDateTime = createdDateTime; ExpirationDateTime = expirationDateTime; @@ -73,25 +45,25 @@ internal QuestionAnsweringAuthoringUpdateSourcesJobState(DateTimeOffset createdD LastUpdatedDateTime = lastUpdatedDateTime; Status = status; Errors = errors; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringUpdateSourcesJobState() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The creation date time of the job. public DateTimeOffset CreatedDateTime { get; } + /// The expiration date time of the job. public DateTimeOffset? ExpirationDateTime { get; } + /// The job ID. public string JobId { get; } + /// The last date time the job was updated. public DateTimeOffset LastUpdatedDateTime { get; } + /// Job Status. public QuestionAnsweringAuthoringJobStatus Status { get; } + /// The errors encountered while executing the job. - public IReadOnlyList Errors { get; } + public IList Errors { get; } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringProject.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringProject.Serialization.cs similarity index 57% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringProject.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringProject.Serialization.cs index 02f803e4c5e6..589bccc2abd9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringProject.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringProject.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class QuestionAnsweringProject : IUtf8JsonSerializable, IJsonModel + /// Represents the project. + public partial class QuestionAnsweringProject : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringProject)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("projectName"u8); @@ -79,15 +79,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("configureSemanticRanking"u8); writer.WriteBooleanValue(IsConfiguredSemanticRankingEnabled.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -96,22 +96,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuestionAnsweringProject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuestionAnsweringProject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringProject JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuestionAnsweringProject)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuestionAnsweringProject(document.RootElement, options); } - internal static QuestionAnsweringProject DeserializeQuestionAnsweringProject(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuestionAnsweringProject DeserializeQuestionAnsweringProject(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -119,108 +124,109 @@ internal static QuestionAnsweringProject DeserializeQuestionAnsweringProject(Jso string projectName = default; string description = default; string language = default; - bool? multilingualResource = default; + bool? isMultilingualResource = default; ProjectSettings settings = default; DateTimeOffset? createdDateTime = default; DateTimeOffset? lastModifiedDateTime = default; DateTimeOffset? lastDeployedDateTime = default; - bool? configureSemanticRanking = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + bool? isConfiguredSemanticRankingEnabled = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("projectName"u8)) + if (prop.NameEquals("projectName"u8)) { - projectName = property.Value.GetString(); + projectName = prop.Value.GetString(); continue; } - if (property.NameEquals("description"u8)) + if (prop.NameEquals("description"u8)) { - description = property.Value.GetString(); + description = prop.Value.GetString(); continue; } - if (property.NameEquals("language"u8)) + if (prop.NameEquals("language"u8)) { - language = property.Value.GetString(); + language = prop.Value.GetString(); continue; } - if (property.NameEquals("multilingualResource"u8)) + if (prop.NameEquals("multilingualResource"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - multilingualResource = property.Value.GetBoolean(); + isMultilingualResource = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("settings"u8)) + if (prop.NameEquals("settings"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - settings = ProjectSettings.DeserializeProjectSettings(property.Value, options); + settings = ProjectSettings.DeserializeProjectSettings(prop.Value, options); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (prop.NameEquals("createdDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - createdDateTime = property.Value.GetDateTimeOffset("O"); + createdDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("lastModifiedDateTime"u8)) + if (prop.NameEquals("lastModifiedDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastModifiedDateTime = property.Value.GetDateTimeOffset("O"); + lastModifiedDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("lastDeployedDateTime"u8)) + if (prop.NameEquals("lastDeployedDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastDeployedDateTime = property.Value.GetDateTimeOffset("O"); + lastDeployedDateTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("configureSemanticRanking"u8)) + if (prop.NameEquals("configureSemanticRanking"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - configureSemanticRanking = property.Value.GetBoolean(); + isConfiguredSemanticRankingEnabled = prop.Value.GetBoolean(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new QuestionAnsweringProject( projectName, description, language, - multilingualResource, + isMultilingualResource, settings, createdDateTime, lastModifiedDateTime, lastDeployedDateTime, - configureSemanticRanking, - serializedAdditionalRawData); + isConfiguredSemanticRankingEnabled, + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -230,15 +236,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - QuestionAnsweringProject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuestionAnsweringProject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuestionAnsweringProject PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuestionAnsweringProject(document.RootElement, options); } default: @@ -246,22 +257,14 @@ QuestionAnsweringProject IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringProject FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringProject(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to deserialize the from. + public static explicit operator QuestionAnsweringProject(Response response) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuestionAnsweringProject(document.RootElement, ModelSerializationExtensions.WireOptions); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringProject.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringProject.cs similarity index 70% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringProject.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringProject.cs index 3950a546ed23..811125421137 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringProject.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/QuestionAnsweringProject.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Represents the project. public partial class QuestionAnsweringProject { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public QuestionAnsweringProject() @@ -64,8 +35,8 @@ public QuestionAnsweringProject() /// Represents the project last modified date-time. /// Represents the project last deployment date-time. /// Represents if semantic ranking is configured. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringProject(string projectName, string description, string language, bool? isMultilingualResource, ProjectSettings settings, DateTimeOffset? createdDateTime, DateTimeOffset? lastModifiedDateTime, DateTimeOffset? lastDeployedDateTime, bool? isConfiguredSemanticRankingEnabled, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuestionAnsweringProject(string projectName, string description, string language, bool? isMultilingualResource, ProjectSettings settings, DateTimeOffset? createdDateTime, DateTimeOffset? lastModifiedDateTime, DateTimeOffset? lastDeployedDateTime, bool? isConfiguredSemanticRankingEnabled, IDictionary additionalBinaryDataProperties) { ProjectName = projectName; Description = description; @@ -76,29 +47,37 @@ internal QuestionAnsweringProject(string projectName, string description, string LastModifiedDateTime = lastModifiedDateTime; LastDeployedDateTime = lastDeployedDateTime; IsConfiguredSemanticRankingEnabled = isConfiguredSemanticRankingEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Name of the project. public string ProjectName { get; } + /// Description of the project. public string Description { get; set; } + /// /// Language of the text records. This is BCP-47 representation of a language. For /// example, use "en" for English; "es" for Spanish etc. If not set, use "en" for /// English as default. /// public string Language { get; set; } + /// Resource enabled for multiple languages across projects or not. public bool? IsMultilingualResource { get; set; } + /// Configurable settings of the Project. public ProjectSettings Settings { get; set; } + /// Project creation date-time. public DateTimeOffset? CreatedDateTime { get; } + /// Represents the project last modified date-time. public DateTimeOffset? LastModifiedDateTime { get; } + /// Represents the project last deployment date-time. public DateTimeOffset? LastDeployedDateTime { get; } + /// Represents if semantic ranking is configured. public bool? IsConfiguredSemanticRankingEnabled { get; set; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/RetrieveQnaRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/RetrieveQnaRecord.Serialization.cs similarity index 53% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/RetrieveQnaRecord.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/RetrieveQnaRecord.Serialization.cs index bef64557944e..8817e68215fd 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/RetrieveQnaRecord.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/RetrieveQnaRecord.Serialization.cs @@ -9,14 +9,19 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class RetrieveQnaRecord : IUtf8JsonSerializable, IJsonModel + /// QnA Record with last updated date-time. + public partial class RetrieveQnaRecord : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal RetrieveQnaRecord() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(RetrieveQnaRecord)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); writer.WriteNumberValue(Id); if (Optional.IsDefined(Answer)) @@ -50,8 +54,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("questions"u8); writer.WriteStartArray(); - foreach (var item in Questions) + foreach (string item in Questions) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -63,6 +72,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Metadata) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -76,7 +90,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("activeLearningSuggestions"u8); writer.WriteStartArray(); - foreach (var item in ActiveLearningSuggestionClusters) + foreach (SuggestedQuestionsCluster item in ActiveLearningSuggestionClusters) { writer.WriteObjectValue(item, options); } @@ -87,15 +101,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("lastUpdatedDateTime"u8); writer.WriteStringValue(LastUpdatedDateTime.Value, "O"); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -104,22 +118,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RetrieveQnaRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + RetrieveQnaRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RetrieveQnaRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(RetrieveQnaRecord)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeRetrieveQnaRecord(document.RootElement, options); } - internal static RetrieveQnaRecord DeserializeRetrieveQnaRecord(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RetrieveQnaRecord DeserializeRetrieveQnaRecord(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,96 +146,108 @@ internal static RetrieveQnaRecord DeserializeRetrieveQnaRecord(JsonElement eleme int id = default; string answer = default; string source = default; - IReadOnlyList questions = default; - IReadOnlyDictionary metadata = default; + IList questions = default; + IDictionary metadata = default; QuestionAnsweringAuthoringDialog dialog = default; - IReadOnlyList activeLearningSuggestions = default; + IList activeLearningSuggestionClusters = default; DateTimeOffset? lastUpdatedDateTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = property.Value.GetInt32(); + id = prop.Value.GetInt32(); continue; } - if (property.NameEquals("answer"u8)) + if (prop.NameEquals("answer"u8)) { - answer = property.Value.GetString(); + answer = prop.Value.GetString(); continue; } - if (property.NameEquals("source"u8)) + if (prop.NameEquals("source"u8)) { - source = property.Value.GetString(); + source = prop.Value.GetString(); continue; } - if (property.NameEquals("questions"u8)) + if (prop.NameEquals("questions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } questions = array; continue; } - if (property.NameEquals("metadata"u8)) + if (prop.NameEquals("metadata"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } metadata = dictionary; continue; } - if (property.NameEquals("dialog"u8)) + if (prop.NameEquals("dialog"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - dialog = QuestionAnsweringAuthoringDialog.DeserializeQuestionAnsweringAuthoringDialog(property.Value, options); + dialog = QuestionAnsweringAuthoringDialog.DeserializeQuestionAnsweringAuthoringDialog(prop.Value, options); continue; } - if (property.NameEquals("activeLearningSuggestions"u8)) + if (prop.NameEquals("activeLearningSuggestions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(SuggestedQuestionsCluster.DeserializeSuggestedQuestionsCluster(item, options)); } - activeLearningSuggestions = array; + activeLearningSuggestionClusters = array; continue; } - if (property.NameEquals("lastUpdatedDateTime"u8)) + if (prop.NameEquals("lastUpdatedDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + lastUpdatedDateTime = prop.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new RetrieveQnaRecord( id, answer, @@ -224,15 +255,18 @@ internal static RetrieveQnaRecord DeserializeRetrieveQnaRecord(JsonElement eleme questions ?? new ChangeTrackingList(), metadata ?? new ChangeTrackingDictionary(), dialog, - activeLearningSuggestions ?? new ChangeTrackingList(), + activeLearningSuggestionClusters ?? new ChangeTrackingList(), lastUpdatedDateTime, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -242,15 +276,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - RetrieveQnaRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + RetrieveQnaRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RetrieveQnaRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeRetrieveQnaRecord(document.RootElement, options); } default: @@ -258,22 +297,7 @@ RetrieveQnaRecord IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static RetrieveQnaRecord FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRetrieveQnaRecord(document.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.QuestionAnswering.Authoring/src/Generated/RetrieveQnaRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/RetrieveQnaRecord.cs similarity index 58% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/RetrieveQnaRecord.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/RetrieveQnaRecord.cs index 77852e8ecd65..0d04a0afc1fa 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/RetrieveQnaRecord.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/RetrieveQnaRecord.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// QnA Record with last updated date-time. public partial class RetrieveQnaRecord { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Unique ID for the QnA. @@ -70,8 +41,8 @@ internal RetrieveQnaRecord(int id) /// Context of a QnA. /// List of Active Learning suggestions for the QnA. /// Date-time when the QnA was last updated. - /// Keeps track of any properties unknown to the library. - internal RetrieveQnaRecord(int id, string answer, string source, IReadOnlyList questions, IReadOnlyDictionary metadata, QuestionAnsweringAuthoringDialog dialog, IReadOnlyList activeLearningSuggestionClusters, DateTimeOffset? lastUpdatedDateTime, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal RetrieveQnaRecord(int id, string answer, string source, IList questions, IDictionary metadata, QuestionAnsweringAuthoringDialog dialog, IList activeLearningSuggestionClusters, DateTimeOffset? lastUpdatedDateTime, IDictionary additionalBinaryDataProperties) { Id = id; Answer = answer; @@ -81,34 +52,36 @@ internal RetrieveQnaRecord(int id, string answer, string source, IReadOnlyList Initializes a new instance of for deserialization. - internal RetrieveQnaRecord() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Unique ID for the QnA. public int Id { get; } + /// Answer text. public string Answer { get; } + /// /// Source from which QnA was indexed e.g. /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs . /// public string Source { get; } + /// List of questions associated with the answer. - public IReadOnlyList Questions { get; } + public IList Questions { get; } + /// /// Metadata associated with the answer, useful to categorize or filter question /// answers. /// - public IReadOnlyDictionary Metadata { get; } + public IDictionary Metadata { get; } + /// Context of a QnA. public QuestionAnsweringAuthoringDialog Dialog { get; } + /// List of Active Learning suggestions for the QnA. - public IReadOnlyList ActiveLearningSuggestionClusters { get; } + public IList ActiveLearningSuggestionClusters { get; } + /// Date-time when the QnA was last updated. public DateTimeOffset? LastUpdatedDateTime { get; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SourceContentStructureKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SourceContentStructureKind.cs similarity index 67% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SourceContentStructureKind.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SourceContentStructureKind.cs index 063c2e3574a3..67a161c2755d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SourceContentStructureKind.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SourceContentStructureKind.cs @@ -14,35 +14,52 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring public readonly partial struct SourceContentStructureKind : IEquatable { private readonly string _value; + /// Unstructured. + private const string UnstructuredValue = "unstructured"; /// Initializes a new instance of . + /// The value. /// is null. public SourceContentStructureKind(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string UnstructuredValue = "unstructured"; + _value = value; + } /// Unstructured. public static SourceContentStructureKind Unstructured { get; } = new SourceContentStructureKind(UnstructuredValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(SourceContentStructureKind left, SourceContentStructureKind right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(SourceContentStructureKind left, SourceContentStructureKind right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator SourceContentStructureKind(string value) => new SourceContentStructureKind(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator SourceContentStructureKind?(string value) => value == null ? null : new SourceContentStructureKind(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is SourceContentStructureKind other && Equals(other); - /// + + /// public bool Equals(SourceContentStructureKind 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.QuestionAnswering.Authoring/src/Generated/SuggestedQuestion.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestion.Serialization.cs similarity index 52% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestion.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestion.Serialization.cs index fcc0b446f969..bccef4c2b2a3 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestion.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestion.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class SuggestedQuestion : IUtf8JsonSerializable, IJsonModel + /// Question suggested by the Active Learning feature. + public partial class SuggestedQuestion : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SuggestedQuestion)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Question)) { writer.WritePropertyName("question"u8); @@ -49,15 +48,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("autoSuggestedCount"u8); writer.WriteNumberValue(AutoSuggestedCount.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +65,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SuggestedQuestion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SuggestedQuestion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SuggestedQuestion JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SuggestedQuestion)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSuggestedQuestion(document.RootElement, options); } - internal static SuggestedQuestion DeserializeSuggestedQuestion(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SuggestedQuestion DeserializeSuggestedQuestion(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,46 +93,47 @@ internal static SuggestedQuestion DeserializeSuggestedQuestion(JsonElement eleme string question = default; int? userSuggestedCount = default; int? autoSuggestedCount = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("question"u8)) + if (prop.NameEquals("question"u8)) { - question = property.Value.GetString(); + question = prop.Value.GetString(); continue; } - if (property.NameEquals("userSuggestedCount"u8)) + if (prop.NameEquals("userSuggestedCount"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - userSuggestedCount = property.Value.GetInt32(); + userSuggestedCount = prop.Value.GetInt32(); continue; } - if (property.NameEquals("autoSuggestedCount"u8)) + if (prop.NameEquals("autoSuggestedCount"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - autoSuggestedCount = property.Value.GetInt32(); + autoSuggestedCount = prop.Value.GetInt32(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new SuggestedQuestion(question, userSuggestedCount, autoSuggestedCount, serializedAdditionalRawData); + return new SuggestedQuestion(question, userSuggestedCount, autoSuggestedCount, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +143,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - SuggestedQuestion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SuggestedQuestion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SuggestedQuestion PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSuggestedQuestion(document.RootElement, options); } default: @@ -154,22 +164,7 @@ SuggestedQuestion IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static SuggestedQuestion FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSuggestedQuestion(document.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.QuestionAnswering.Authoring/src/Generated/SuggestedQuestion.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestion.cs similarity index 53% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestion.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestion.cs index 73d28bfe814e..ec431cb182c9 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestion.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestion.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Question suggested by the Active Learning feature. public partial class SuggestedQuestion { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public SuggestedQuestion() @@ -57,19 +28,21 @@ public SuggestedQuestion() /// The number of times the question was suggested automatically by the Active /// Learning algorithm. /// - /// Keeps track of any properties unknown to the library. - internal SuggestedQuestion(string question, int? userSuggestedCount, int? autoSuggestedCount, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SuggestedQuestion(string question, int? userSuggestedCount, int? autoSuggestedCount, IDictionary additionalBinaryDataProperties) { Question = question; UserSuggestedCount = userSuggestedCount; AutoSuggestedCount = autoSuggestedCount; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Question suggested by the Active Learning feature. public string Question { get; set; } + /// The number of times the question was suggested explicitly by the user. public int? UserSuggestedCount { get; set; } + /// /// The number of times the question was suggested automatically by the Active /// Learning algorithm. diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestionsCluster.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestionsCluster.Serialization.cs similarity index 56% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestionsCluster.Serialization.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestionsCluster.Serialization.cs index a29c19af7236..9b2bcdfbd1c6 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestionsCluster.Serialization.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestionsCluster.Serialization.cs @@ -9,14 +9,14 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.Language.QuestionAnswering.Authoring { - public partial class SuggestedQuestionsCluster : IUtf8JsonSerializable, IJsonModel + /// Active Learning suggested questions cluster details. + public partial class SuggestedQuestionsCluster : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SuggestedQuestionsCluster)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ClusterHead)) { writer.WritePropertyName("clusterHead"u8); @@ -43,21 +42,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("suggestedQuestions"u8); writer.WriteStartArray(); - foreach (var item in SuggestedQuestions) + foreach (SuggestedQuestion item in SuggestedQuestions) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,45 +65,49 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SuggestedQuestionsCluster IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SuggestedQuestionsCluster IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SuggestedQuestionsCluster JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SuggestedQuestionsCluster)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSuggestedQuestionsCluster(document.RootElement, options); } - internal static SuggestedQuestionsCluster DeserializeSuggestedQuestionsCluster(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SuggestedQuestionsCluster DeserializeSuggestedQuestionsCluster(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string clusterHead = default; IList suggestedQuestions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("clusterHead"u8)) + if (prop.NameEquals("clusterHead"u8)) { - clusterHead = property.Value.GetString(); + clusterHead = prop.Value.GetString(); continue; } - if (property.NameEquals("suggestedQuestions"u8)) + if (prop.NameEquals("suggestedQuestions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(SuggestedQuestion.DeserializeSuggestedQuestion(item, options)); } @@ -113,17 +116,19 @@ internal static SuggestedQuestionsCluster DeserializeSuggestedQuestionsCluster(J } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new SuggestedQuestionsCluster(clusterHead, suggestedQuestions ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new SuggestedQuestionsCluster(clusterHead, suggestedQuestions ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +138,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - SuggestedQuestionsCluster IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SuggestedQuestionsCluster IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SuggestedQuestionsCluster PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSuggestedQuestionsCluster(document.RootElement, options); } default: @@ -149,22 +159,7 @@ SuggestedQuestionsCluster IPersistableModel.Create(Bi } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static SuggestedQuestionsCluster FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSuggestedQuestionsCluster(document.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.QuestionAnswering.Authoring/src/Generated/SuggestedQuestionsCluster.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestionsCluster.cs similarity index 50% rename from sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestionsCluster.cs rename to sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestionsCluster.cs index ef8f81c2a7e0..8ef9ce22f8ae 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SuggestedQuestionsCluster.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SuggestedQuestionsCluster.cs @@ -13,37 +13,8 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// Active Learning suggested questions cluster details. public partial class SuggestedQuestionsCluster { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public SuggestedQuestionsCluster() @@ -57,12 +28,12 @@ public SuggestedQuestionsCluster() /// clustering algorithm. /// /// List of all suggested questions for the QnA. - /// Keeps track of any properties unknown to the library. - internal SuggestedQuestionsCluster(string clusterHead, IList suggestedQuestions, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SuggestedQuestionsCluster(string clusterHead, IList suggestedQuestions, IDictionary additionalBinaryDataProperties) { ClusterHead = clusterHead; SuggestedQuestions = suggestedQuestions; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -70,6 +41,7 @@ internal SuggestedQuestionsCluster(string clusterHead, IList /// clustering algorithm. /// public string ClusterHead { get; set; } + /// List of all suggested questions for the QnA. public IList SuggestedQuestions { get; } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.Serialization.cs new file mode 100644 index 000000000000..37ee5ab34c5e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.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.QuestionAnswering.Authoring +{ + /// Request payload for updating synonyms. + public partial class SynonymAssets : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SynonymAssets() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SynonymAssets)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (WordAlterationsGroups item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SynonymAssets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SynonymAssets JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SynonymAssets)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSynonymAssets(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SynonymAssets DeserializeSynonymAssets(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(WordAlterationsGroups.DeserializeWordAlterationsGroups(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SynonymAssets(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(SynonymAssets)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SynonymAssets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SynonymAssets PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeSynonymAssets(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SynonymAssets)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + public static implicit operator RequestContent(SynonymAssets synonymAssets) + { + if (synonymAssets == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(synonymAssets, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.cs new file mode 100644 index 000000000000..1021213f6e3a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/SynonymAssets.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Request payload for updating synonyms. + public partial class SynonymAssets + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The WordAlterations items on this page. + /// is null. + public SynonymAssets(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The WordAlterations items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SynonymAssets(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The WordAlterations items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.Serialization.cs new file mode 100644 index 000000000000..44ee6dc66666 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.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; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Collection of word alterations. + public partial class WordAlterationsGroups : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal WordAlterationsGroups() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support writing '{format}' format."); + } + writer.WritePropertyName("alterations"u8); + writer.WriteStartArray(); + foreach (string item in Alterations) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + WordAlterationsGroups IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual WordAlterationsGroups JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWordAlterationsGroups(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static WordAlterationsGroups DeserializeWordAlterationsGroups(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList alterations = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("alterations"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + alterations = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new WordAlterationsGroups(alterations, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); + default: + throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + WordAlterationsGroups IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual WordAlterationsGroups PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeWordAlterationsGroups(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.cs new file mode 100644 index 000000000000..bd4f0af9d3cc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/Models/WordAlterationsGroups.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; +using System.Linq; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Collection of word alterations. + public partial class WordAlterationsGroups + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Collection of word alterations. + /// is null. + public WordAlterationsGroups(IEnumerable alterations) + { + Argument.AssertNotNull(alterations, nameof(alterations)); + + Alterations = alterations.ToList(); + } + + /// Initializes a new instance of . + /// Collection of word alterations. + /// Keeps track of any properties unknown to the library. + internal WordAlterationsGroups(IList alterations, IDictionary additionalBinaryDataProperties) + { + Alterations = alterations; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Collection of word alterations. + public IList Alterations { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.cs deleted file mode 100644 index 91c42aca8e31..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeployment.cs +++ /dev/null @@ -1,69 +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.Language.QuestionAnswering.Authoring -{ - /// Project deployment details. - public partial class ProjectDeployment - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 ProjectDeployment() - { - } - - /// Initializes a new instance of . - /// Name of the deployment. - /// Represents the project last deployment date-time. - /// Keeps track of any properties unknown to the library. - internal ProjectDeployment(string deploymentName, DateTimeOffset? lastDeployed, IDictionary serializedAdditionalRawData) - { - DeploymentName = deploymentName; - LastDeployed = lastDeployed; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Name of the deployment. - public string DeploymentName { get; } - /// Represents the project last deployment date-time. - public DateTimeOffset? LastDeployed { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.Serialization.cs deleted file mode 100644 index 3fac8b4b3e75..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.Serialization.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class ProjectDeploymentJobState : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ProjectDeploymentJobState)} does not support writing '{format}' format."); - } - - 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 (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ProjectDeploymentJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ProjectDeploymentJobState)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProjectDeploymentJobState(document.RootElement, options); - } - - internal static ProjectDeploymentJobState DeserializeProjectDeploymentJobState(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset createdDateTime = default; - DateTimeOffset? expirationDateTime = default; - string jobId = default; - DateTimeOffset lastUpdatedDateTime = default; - QuestionAnsweringAuthoringJobStatus status = default; - IReadOnlyList errors = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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 QuestionAnsweringAuthoringJobStatus(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(QuestionAnsweringAuthoringError.DeserializeQuestionAnsweringAuthoringError(item, options)); - } - errors = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ProjectDeploymentJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors ?? 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, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(ProjectDeploymentJobState)} does not support writing '{options.Format}' format."); - } - } - - ProjectDeploymentJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProjectDeploymentJobState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ProjectDeploymentJobState)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ProjectDeploymentJobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProjectDeploymentJobState(document.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.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.cs deleted file mode 100644 index 7ca75e71fb2d..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectDeploymentJobState.cs +++ /dev/null @@ -1,97 +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.Language.QuestionAnswering.Authoring -{ - /// Job state represents the job metadata and any errors. - public partial class ProjectDeploymentJobState - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 creation date time of the job. - /// The last date time the job was updated. - /// Job Status. - internal ProjectDeploymentJobState(DateTimeOffset createdDateTime, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status) - { - CreatedDateTime = createdDateTime; - LastUpdatedDateTime = lastUpdatedDateTime; - Status = status; - Errors = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The creation date time of the job. - /// The expiration date time of the job. - /// The job ID. - /// The last date time the job was updated. - /// Job Status. - /// The errors encountered while executing the job. - /// Keeps track of any properties unknown to the library. - internal ProjectDeploymentJobState(DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, QuestionAnsweringAuthoringJobStatus status, IReadOnlyList errors, IDictionary serializedAdditionalRawData) - { - CreatedDateTime = createdDateTime; - ExpirationDateTime = expirationDateTime; - JobId = jobId; - LastUpdatedDateTime = lastUpdatedDateTime; - Status = status; - Errors = errors; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ProjectDeploymentJobState() - { - } - - /// The creation date time of the job. - public DateTimeOffset CreatedDateTime { get; } - /// The expiration date time of the job. - public DateTimeOffset? ExpirationDateTime { get; } - /// The job ID. - public string JobId { get; } - /// The last date time the job was updated. - public DateTimeOffset LastUpdatedDateTime { get; } - /// Job Status. - public QuestionAnsweringAuthoringJobStatus Status { get; } - /// The errors encountered while executing the job. - public IReadOnlyList Errors { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.Serialization.cs deleted file mode 100644 index f2c14e7a3764..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.Serialization.cs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class ProjectSettings : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ProjectSettings)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DefaultAnswer)) - { - writer.WritePropertyName("defaultAnswer"u8); - writer.WriteStringValue(DefaultAnswer); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ProjectSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ProjectSettings)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeProjectSettings(document.RootElement, options); - } - - internal static ProjectSettings DeserializeProjectSettings(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string defaultAnswer = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("defaultAnswer"u8)) - { - defaultAnswer = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ProjectSettings(defaultAnswer, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(ProjectSettings)} does not support writing '{options.Format}' format."); - } - } - - ProjectSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProjectSettings(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ProjectSettings)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ProjectSettings FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeProjectSettings(document.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.QuestionAnswering.Authoring/src/Generated/ProjectSettings.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.cs deleted file mode 100644 index 5998196022e9..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/ProjectSettings.cs +++ /dev/null @@ -1,65 +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.Language.QuestionAnswering.Authoring -{ - /// Configurable settings of the Project. - public partial class ProjectSettings - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 ProjectSettings() - { - } - - /// Initializes a new instance of . - /// Default Answer response when no good match is found in the knowledge base. - /// Keeps track of any properties unknown to the library. - internal ProjectSettings(string defaultAnswer, IDictionary serializedAdditionalRawData) - { - DefaultAnswer = defaultAnswer; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Default Answer response when no good match is found in the knowledge base. - public string DefaultAnswer { get; set; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.cs deleted file mode 100644 index 523f469a8a17..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringAssets.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.Language.QuestionAnswering.Authoring -{ - /// All assets for this project. - public partial class QuestionAnsweringAuthoringAssets - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 QuestionAnsweringAuthoringAssets() - { - Synonyms = new ChangeTrackingList(); - Qnas = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Collection of synonyms. - /// List of QnA records to import. - /// Keeps track of any properties unknown to the library. - internal QuestionAnsweringAuthoringAssets(IList synonyms, IList qnas, IDictionary serializedAdditionalRawData) - { - Synonyms = synonyms; - Qnas = qnas; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Collection of synonyms. - public IList Synonyms { get; } - /// List of QnA records to import. - public IList Qnas { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.RestClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.RestClient.cs new file mode 100644 index 000000000000..fc4acdf21801 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.RestClient.cs @@ -0,0 +1,576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// + public partial class QuestionAnsweringAuthoringClient + { + private static ResponseClassifier _pipelineMessageClassifier200; + private static ResponseClassifier _pipelineMessageClassifier200201; + private static ResponseClassifier _pipelineMessageClassifier202; + private static ResponseClassifier _pipelineMessageClassifier204; + + private static ResponseClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 = new StatusCodeClassifier(stackalloc ushort[] { 200 }); + + private static ResponseClassifier PipelineMessageClassifier200201 => _pipelineMessageClassifier200201 = new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + + private static ResponseClassifier PipelineMessageClassifier202 => _pipelineMessageClassifier202 = new StatusCodeClassifier(stackalloc ushort[] { 202 }); + + private static ResponseClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 = new StatusCodeClassifier(stackalloc ushort[] { 204 }); + + internal HttpMessage CreateGetProjectsRequest(int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", TypeFormatters.ConvertToString(top), true); + } + if (skip != null) + { + uri.AppendQuery("skip", TypeFormatters.ConvertToString(skip), true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", TypeFormatters.ConvertToString(maxpagesize), true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetProjectsRequest(Uri nextPage, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetProjectDetailsRequest(string projectName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateProjectRequest(string projectName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200201); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteProjectRequest(string projectName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetDeleteStatusRequest(string jobId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/deletion-jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateExportRequest(string projectName, string format, string assetKind, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/:export", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (format != null) + { + uri.AppendQuery("format", format, true); + } + if (assetKind != null) + { + uri.AppendQuery("assetKind", assetKind, true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + + internal HttpMessage CreateGetExportStatusRequest(string projectName, string jobId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/export/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateImportRequest(string projectName, RequestContent content, string format, string assetKind, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/:import", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (format != null) + { + uri.AppendQuery("format", format, true); + } + if (assetKind != null) + { + uri.AppendQuery("assetKind", assetKind, true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + if ("application/json" != null) + { + request.Headers.SetValue("Content-Type", "application/json"); + } + request.Content = content; + return message; + } + + internal HttpMessage CreateImportFromFilesRequest(string projectName, RequestContent content, string contentType, string assetKind, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/:import", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (assetKind != null) + { + uri.AppendQuery("assetKind", assetKind, true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", contentType); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetImportStatusRequest(string projectName, string jobId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/import/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeployProjectRequest(string projectName, string deploymentName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + return message; + } + + internal HttpMessage CreateGetDeployStatusRequest(string projectName, string deploymentName, string jobId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/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); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDeploymentsRequest(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/deployments", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", TypeFormatters.ConvertToString(top), true); + } + if (skip != null) + { + uri.AppendQuery("skip", TypeFormatters.ConvertToString(skip), true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", TypeFormatters.ConvertToString(maxpagesize), true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetDeploymentsRequest(Uri nextPage, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSynonymsRequest(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/synonyms", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", TypeFormatters.ConvertToString(top), true); + } + if (skip != null) + { + uri.AppendQuery("skip", TypeFormatters.ConvertToString(skip), true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", TypeFormatters.ConvertToString(maxpagesize), true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetSynonymsRequest(Uri nextPage, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateSynonymsRequest(string projectName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/synonyms", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetSourcesRequest(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/sources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", TypeFormatters.ConvertToString(top), true); + } + if (skip != null) + { + uri.AppendQuery("skip", TypeFormatters.ConvertToString(skip), true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", TypeFormatters.ConvertToString(maxpagesize), true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetSourcesRequest(Uri nextPage, string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateSourcesRequest(string projectName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/sources", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateSourcesFromFilesRequest(string projectName, RequestContent content, string contentType, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/sources", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", contentType); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetUpdateSourcesStatusRequest(string projectName, string jobId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/sources/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetQnasRequest(string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/qnas", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("top", TypeFormatters.ConvertToString(top), true); + } + if (skip != null) + { + uri.AppendQuery("skip", TypeFormatters.ConvertToString(skip), true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", TypeFormatters.ConvertToString(maxpagesize), true); + } + if (source != null) + { + uri.AppendQuery("source", source, true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetQnasRequest(Uri nextPage, string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateQnasRequest(string projectName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/qnas", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetUpdateQnasStatusRequest(string projectName, string jobId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/qnas/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateAddFeedbackRequest(string projectName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/language", false); + uri.AppendPath("/authoring/query-knowledgebases/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/feedback", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.cs index 6f50a9d8974a..f9bf7356ed5d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClient.cs @@ -8,120 +8,146 @@ using System; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.AI.Language.QuestionAnswering.Authoring { - // Data plane generated client. - /// The QuestionAnsweringAuthoring service client. + /// The QuestionAnsweringAuthoringClient. public partial class QuestionAnsweringAuthoringClient { - private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; + private readonly Uri _endpoint; + /// A credential used to authenticate to the service. private readonly AzureKeyCredential _keyCredential; - private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; + private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; + /// A credential used to authenticate to the service. private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; + private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; 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 QuestionAnsweringAuthoringClient for mocking. protected QuestionAnsweringAuthoringClient() { } /// Initializes a new instance of QuestionAnsweringAuthoringClient. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). - /// A credential used to authenticate to an Azure Service. + /// Service endpoint. + /// A credential used to authenticate to the service. /// or is null. public QuestionAnsweringAuthoringClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new QuestionAnsweringAuthoringClientOptions()) { } /// Initializes a new instance of QuestionAnsweringAuthoringClient. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). - /// A credential used to authenticate to an Azure Service. + /// Service endpoint. + /// A credential used to authenticate to the service. /// The options for configuring the client. /// or is null. public QuestionAnsweringAuthoringClient(Uri endpoint, AzureKeyCredential credential, QuestionAnsweringAuthoringClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); + options ??= new QuestionAnsweringAuthoringClientOptions(); - ClientDiagnostics = new ClientDiagnostics(options, true); - _keyCredential = credential; - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }, new ResponseClassifier()); _endpoint = endpoint; + _keyCredential = credential; + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }); _apiVersion = options.Version; + ClientDiagnostics = new ClientDiagnostics(options, true); } - /// Get the requested project metadata. - /// Name of the project. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetProjectDetailsAsync(string projectName, CancellationToken cancellationToken = default) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// + /// [Protocol Method] Gets all projects for a user. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, 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 Pageable GetProjects(int? top, int? skip, int? maxpagesize, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + return new QuestionAnsweringAuthoringClientGetProjectsCollectionResult(this, top, skip, maxpagesize, context); + } - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetProjectDetailsAsync(projectName, context).ConfigureAwait(false); - return Response.FromValue(QuestionAnsweringProject.FromResponse(response), response); + /// + /// [Protocol Method] Gets all projects for a user. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, 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 AsyncPageable GetProjectsAsync(int? top, int? skip, int? maxpagesize, RequestContext context) + { + return new QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResult(this, top, skip, maxpagesize, context); } - /// Get the requested project metadata. - /// Name of the project. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetProjectDetails(string projectName, CancellationToken cancellationToken = default) + /// Gets all projects for a user. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual Pageable GetProjects(int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + return new QuestionAnsweringAuthoringClientGetProjectsCollectionResultOfT(this, top, skip, maxpagesize, cancellationToken.ToRequestContext()); + } - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetProjectDetails(projectName, context); - return Response.FromValue(QuestionAnsweringProject.FromResponse(response), response); + /// Gets all projects for a user. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual AsyncPageable GetProjectsAsync(int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) + { + return new QuestionAnsweringAuthoringClientGetProjectsAsyncCollectionResultOfT(this, top, skip, maxpagesize, cancellationToken.ToRequestContext()); } /// /// [Protocol Method] Get the requested project metadata. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetProjectDetailsAsync(string projectName, RequestContext context) + public virtual Response GetProjectDetails(string projectName, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjectDetails"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjectDetails"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + using HttpMessage message = CreateGetProjectDetailsRequest(projectName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -134,33 +160,26 @@ public virtual async Task GetProjectDetailsAsync(string projectName, R /// [Protocol Method] Get the requested project metadata. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetProjectDetails(string projectName, RequestContext context) + public virtual async Task GetProjectDetailsAsync(string projectName, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjectDetails"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetProjectDetails"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + using HttpMessage message = CreateGetProjectDetailsRequest(projectName, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -169,34 +188,60 @@ public virtual Response GetProjectDetails(string projectName, RequestContext con } } + /// Get the requested project metadata. + /// Name of the project. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response GetProjectDetails(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + Response result = GetProjectDetails(projectName, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringProject)result, result); + } + + /// Get the requested project metadata. + /// Name of the project. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task> GetProjectDetailsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + Response result = await GetProjectDetailsAsync(projectName, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringProject)result, result); + } + /// /// [Protocol Method] Create or update a project. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. /// 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. + /// The request options, 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) + 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("QuestionAnsweringAuthoringClient.CreateProject"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.CreateProject"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateCreateProjectRequest(projectName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -209,30 +254,28 @@ public virtual async Task CreateProjectAsync(string projectName, Reque /// [Protocol Method] Create or update a project. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. /// 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. + /// The request options, 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) + 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("QuestionAnsweringAuthoringClient.CreateProject"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.CreateProject"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateCreateProjectRequest(projectName, content, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -241,65 +284,23 @@ public virtual Response CreateProject(string projectName, RequestContent content } } - /// Gets the status of a Project delete job. - /// The job ID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task> GetDeleteStatusAsync(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDeleteStatusAsync(jobId, context).ConfigureAwait(false); - return Response.FromValue(QuestionAnsweringAuthoringProjectDeletionJobState.FromResponse(response), response); - } - - /// Gets the status of a Project delete job. - /// The job ID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response GetDeleteStatus(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDeleteStatus(jobId, context); - return Response.FromValue(QuestionAnsweringAuthoringProjectDeletionJobState.FromResponse(response), response); - } - - /// - /// [Protocol Method] Gets the status of a Project delete job. - /// - /// - /// - /// 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 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. + /// Delete the project. + /// 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 options, 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. /// The response returned from the service. - public virtual async Task GetDeleteStatusAsync(string jobId, RequestContext context) + public virtual Operation DeleteProject(WaitUntil waitUntil, string projectName, RequestContext context) { - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeleteStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeleteProject"); scope.Start(); try { - using HttpMessage message = CreateGetDeleteStatusRequest(jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using HttpMessage message = CreateDeleteProjectRequest(projectName, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeleteProject", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -308,37 +309,23 @@ public virtual async Task GetDeleteStatusAsync(string jobId, RequestCo } } - /// - /// [Protocol Method] Gets the status of a Project delete job. - /// - /// - /// - /// 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 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. + /// Delete the project. + /// 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 options, 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. /// The response returned from the service. - public virtual Response GetDeleteStatus(string jobId, RequestContext context) + public virtual async Task DeleteProjectAsync(WaitUntil waitUntil, string projectName, RequestContext context) { - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeleteStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeleteProject"); scope.Start(); try { - using HttpMessage message = CreateGetDeleteStatusRequest(jobId, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using HttpMessage message = CreateDeleteProjectRequest(projectName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeleteProjectAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -347,78 +334,56 @@ public virtual Response GetDeleteStatus(string jobId, RequestContext context) } } - /// - /// Gets the status of an Export job, once job completes, returns the project - /// metadata, and assets. - /// - /// Name of the project. - /// The job ID. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetExportStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) + /// Delete the project. + /// 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 cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Operation DeleteProject(WaitUntil waitUntil, string projectName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetExportStatusAsync(projectName, jobId, context).ConfigureAwait(false); - return Response.FromValue(QuestionAnsweringAuthoringExportJobState.FromResponse(response), response); + return DeleteProject(waitUntil, projectName, cancellationToken.ToRequestContext()); } - /// - /// Gets the status of an Export job, once job completes, returns the project - /// metadata, and assets. - /// - /// Name of the project. - /// The job ID. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetExportStatus(string projectName, string jobId, CancellationToken cancellationToken = default) + /// Delete the project. + /// 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 cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task DeleteProjectAsync(WaitUntil waitUntil, string projectName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetExportStatus(projectName, jobId, context); - return Response.FromValue(QuestionAnsweringAuthoringExportJobState.FromResponse(response), response); + return await DeleteProjectAsync(waitUntil, projectName, cancellationToken.ToRequestContext()).ConfigureAwait(false); } /// - /// [Protocol Method] Gets the status of an Export job, once job completes, returns the project - /// metadata, and assets. + /// [Protocol Method] Gets the status of a Project delete job. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// - /// Name of the project. /// 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. + /// The request options, 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 GetExportStatusAsync(string projectName, string jobId, RequestContext context) + public virtual Response GetDeleteStatus(string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetExportStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeleteStatus"); scope.Start(); try { - using HttpMessage message = CreateGetExportStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetDeleteStatusRequest(jobId, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -428,39 +393,29 @@ public virtual async Task GetExportStatusAsync(string projectName, str } /// - /// [Protocol Method] Gets the status of an Export job, once job completes, returns the project - /// metadata, and assets. + /// [Protocol Method] Gets the status of a Project delete job. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// - /// Name of the project. /// 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. + /// The request options, 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 GetExportStatus(string projectName, string jobId, RequestContext context) + public virtual async Task GetDeleteStatusAsync(string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetExportStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeleteStatus"); scope.Start(); try { - using HttpMessage message = CreateGetExportStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetDeleteStatusRequest(jobId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -469,71 +424,145 @@ public virtual Response GetExportStatus(string projectName, string jobId, Reques } } - /// Gets the status of an Import job. - /// Name of the project. + /// Gets the status of a Project delete job. /// The job ID. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetImportStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response GetDeleteStatus(string jobId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetImportStatusAsync(projectName, jobId, context).ConfigureAwait(false); - return Response.FromValue(QuestionAnsweringAuthoringImportJobState.FromResponse(response), response); + Response result = GetDeleteStatus(jobId, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringAuthoringProjectDeletionJobState)result, result); } - /// Gets the status of an Import job. - /// Name of the project. + /// Gets the status of a Project delete job. /// The job ID. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetImportStatus(string projectName, string jobId, CancellationToken cancellationToken = default) + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task> GetDeleteStatusAsync(string jobId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetImportStatus(projectName, jobId, context); - return Response.FromValue(QuestionAnsweringAuthoringImportJobState.FromResponse(response), response); + Response result = await GetDeleteStatusAsync(jobId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringAuthoringProjectDeletionJobState)result, result); + } + + /// Export project metadata and assets. + /// 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. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// The request options, 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. + /// The response returned from the service. + public virtual Operation Export(WaitUntil waitUntil, string projectName, string format, string assetKind, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Export"); + scope.Start(); + try + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using HttpMessage message = CreateExportRequest(projectName, format, assetKind, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Export project metadata and assets. + /// 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. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// The request options, 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. + /// The response returned from the service. + public virtual async Task ExportAsync(WaitUntil waitUntil, string projectName, string format, string assetKind, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Export"); + scope.Start(); + try + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using HttpMessage message = CreateExportRequest(projectName, format, assetKind, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.ExportAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Export project metadata and assets. + /// 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. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Operation Export(WaitUntil waitUntil, string projectName, FileFormat? format = default, AssetKind? assetKind = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return Export(waitUntil, projectName, format?.ToString(), assetKind?.ToString(), cancellationToken.ToRequestContext()); + } + + /// Export project metadata and assets. + /// 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. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task ExportAsync(WaitUntil waitUntil, string projectName, FileFormat? format = default, AssetKind? assetKind = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return await ExportAsync(waitUntil, projectName, format?.ToString(), assetKind?.ToString(), cancellationToken.ToRequestContext()).ConfigureAwait(false); } /// - /// [Protocol Method] Gets the status of an Import job. + /// [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. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetImportStatusAsync(string projectName, string jobId, RequestContext context) + public virtual Response GetExportStatus(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetImportStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetExportStatus"); scope.Start(); try { - using HttpMessage message = CreateGetImportStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetExportStatusRequest(projectName, jobId, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -543,38 +572,32 @@ public virtual async Task GetImportStatusAsync(string projectName, str } /// - /// [Protocol Method] Gets the status of an Import job. + /// [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. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetImportStatus(string projectName, string jobId, RequestContext context) + public virtual async Task GetExportStatusAsync(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetImportStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetExportStatus"); scope.Start(); try { - using HttpMessage message = CreateGetImportStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetExportStatusRequest(projectName, jobId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -583,77 +606,64 @@ public virtual Response GetImportStatus(string projectName, string jobId, Reques } } - /// Gets the status of a Deploy job. + /// + /// Gets the status of an Export job, once job completes, returns the project + /// metadata, and assets. + /// /// Name of the project. - /// Name of the deployment. /// The job ID. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public virtual async Task> GetDeployStatusAsync(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response GetExportStatus(string projectName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDeployStatusAsync(projectName, deploymentName, jobId, context).ConfigureAwait(false); - return Response.FromValue(ProjectDeploymentJobState.FromResponse(response), response); + Response result = GetExportStatus(projectName, jobId, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringAuthoringExportJobState)result, result); } - /// Gets the status of a Deploy job. + /// + /// Gets the status of an Export job, once job completes, returns the project + /// metadata, and assets. + /// /// Name of the project. - /// Name of the deployment. /// The job ID. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public virtual Response GetDeployStatus(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task> GetExportStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDeployStatus(projectName, deploymentName, jobId, context); - return Response.FromValue(ProjectDeploymentJobState.FromResponse(response), response); + Response result = await GetExportStatusAsync(projectName, jobId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringAuthoringExportJobState)result, result); } - /// - /// [Protocol Method] Gets the status of a Deploy job. - /// - /// - /// - /// 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. - /// - /// - /// - /// - /// Name of the project. - /// Name of the deployment. - /// 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. + /// Import project assets. + /// 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. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// The request options, 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. /// The response returned from the service. - public virtual async Task GetDeployStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context) + public virtual Operation Import(WaitUntil waitUntil, string projectName, RequestContent content, string format = default, string assetKind = default, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Import"); scope.Start(); try { - using HttpMessage message = CreateGetDeployStatusRequest(projectName, deploymentName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using HttpMessage message = CreateImportRequest(projectName, content, format, assetKind, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.Import", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -662,41 +672,26 @@ public virtual async Task GetDeployStatusAsync(string projectName, str } } - /// - /// [Protocol Method] Gets the status of a Deploy job. - /// - /// - /// - /// 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. - /// - /// - /// - /// - /// Name of the project. - /// Name of the deployment. - /// 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. + /// Import project assets. + /// 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. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// The request options, 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. /// The response returned from the service. - public virtual Response GetDeployStatus(string projectName, string deploymentName, string jobId, RequestContext context) + public virtual async Task ImportAsync(WaitUntil waitUntil, string projectName, RequestContent content, string format = default, string assetKind = default, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Import"); scope.Start(); try { - using HttpMessage message = CreateGetDeployStatusRequest(projectName, deploymentName, jobId, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + using HttpMessage message = CreateImportRequest(projectName, content, format, assetKind, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.ImportAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -705,73 +700,61 @@ public virtual Response GetDeployStatus(string projectName, string deploymentNam } } - /// Updates all the synonyms of a project. + /// Import project assets. + /// 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. - /// All the synonyms of a project. - /// The cancellation token to use. - /// or is null. + /// Project assets the needs to be imported. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// Body parameter's content type. Known values are application/json. + /// The cancellation token that can be used to cancel the operation. + /// is null. /// is an empty string, and was expected to be non-empty. - public virtual async Task UpdateSynonymsAsync(string projectName, SynonymAssets body, CancellationToken cancellationToken = default) + public virtual Operation Import(WaitUntil waitUntil, string projectName, ImportJobOptions body = default, FileFormat? format = default, AssetKind? assetKind = default, Authoring.ImportContentType? contentType = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(body, nameof(body)); - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await UpdateSynonymsAsync(projectName, content, context).ConfigureAwait(false); - return response; + return this.Import(waitUntil, projectName, body, format?.ToString(), assetKind?.ToString(), contentType?.ToString(), cancellationToken.ToRequestContext()); } - /// Updates all the synonyms of a project. + /// Import project assets. + /// 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. - /// All the synonyms of a project. - /// The cancellation token to use. - /// or is null. + /// Project assets the needs to be imported. + /// Knowledge base Import or Export format. + /// Kind of the asset of the project. + /// Body parameter's content type. Known values are application/json. + /// The cancellation token that can be used to cancel the operation. + /// is null. /// is an empty string, and was expected to be non-empty. - public virtual Response UpdateSynonyms(string projectName, SynonymAssets body, CancellationToken cancellationToken = default) + public virtual async Task ImportAsync(WaitUntil waitUntil, string projectName, ImportJobOptions body = default, FileFormat? format = default, AssetKind? assetKind = default, Authoring.ImportContentType? contentType = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(body, nameof(body)); - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = UpdateSynonyms(projectName, content, context); - return response; + return await this.ImportAsync(waitUntil, projectName, body, format?.ToString(), assetKind?.ToString(), contentType?.ToString(), cancellationToken.ToRequestContext()).ConfigureAwait(false); } - /// - /// [Protocol Method] Updates all the synonyms of a project. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Import project assets from file. + /// 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. + /// The contentType to use which has the multipart/form-data boundary. + /// Kind of the asset of the project. + /// The request options, 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 UpdateSynonymsAsync(string projectName, RequestContent content, RequestContext context = null) + public virtual Operation ImportFromFiles(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, string assetKind = default, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSynonyms"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.ImportFromFiles"); scope.Start(); try { - using HttpMessage message = CreateUpdateSynonymsRequest(projectName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateImportFromFilesRequest(projectName, content, contentType, assetKind, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.ImportFromFiles", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -780,39 +763,27 @@ public virtual async Task UpdateSynonymsAsync(string projectName, Requ } } - /// - /// [Protocol Method] Updates all the synonyms of a project. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Import project assets from file. + /// 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. + /// The contentType to use which has the multipart/form-data boundary. + /// Kind of the asset of the project. + /// The request options, 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 UpdateSynonyms(string projectName, RequestContent content, RequestContext context = null) + public virtual async Task ImportFromFilesAsync(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, string assetKind = default, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSynonyms"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.ImportFromFiles"); scope.Start(); try { - using HttpMessage message = CreateUpdateSynonymsRequest(projectName, content, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateImportFromFilesRequest(projectName, content, contentType, assetKind, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.ImportFromFilesAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -821,71 +792,32 @@ public virtual Response UpdateSynonyms(string projectName, RequestContent conten } } - /// Gets the status of update sources job. - /// Name of the project. - /// The job ID. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetUpdateSourcesStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetUpdateSourcesStatusAsync(projectName, jobId, context).ConfigureAwait(false); - return Response.FromValue(QuestionAnsweringAuthoringUpdateSourcesJobState.FromResponse(response), response); - } - - /// Gets the status of update sources job. - /// Name of the project. - /// The job ID. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public virtual Response GetUpdateSourcesStatus(string projectName, string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetUpdateSourcesStatus(projectName, jobId, context); - return Response.FromValue(QuestionAnsweringAuthoringUpdateSourcesJobState.FromResponse(response), response); - } - /// - /// [Protocol Method] Gets the status of update sources job. + /// [Protocol Method] Gets the status of an Import job. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetUpdateSourcesStatusAsync(string projectName, string jobId, RequestContext context) + public virtual Response GetImportStatus(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateSourcesStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetImportStatus"); scope.Start(); try { - using HttpMessage message = CreateGetUpdateSourcesStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetImportStatusRequest(projectName, jobId, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -895,38 +827,31 @@ public virtual async Task GetUpdateSourcesStatusAsync(string projectNa } /// - /// [Protocol Method] Gets the status of update sources job. + /// [Protocol Method] Gets the status of an Import job. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetUpdateSourcesStatus(string projectName, string jobId, RequestContext context) + public virtual async Task GetImportStatusAsync(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateSourcesStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetImportStatus"); scope.Start(); try { - using HttpMessage message = CreateGetUpdateSourcesStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetImportStatusRequest(projectName, jobId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -935,71 +860,57 @@ public virtual Response GetUpdateSourcesStatus(string projectName, string jobId, } } - /// Gets the status of update QnAs job. + /// Gets the status of an Import job. /// Name of the project. /// The job ID. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// or is null. /// or is an empty string, and was expected to be non-empty. - public virtual async Task> GetUpdateQnasStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Response GetImportStatus(string projectName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetUpdateQnasStatusAsync(projectName, jobId, context).ConfigureAwait(false); - return Response.FromValue(QuestionAnsweringAuthoringUpdateQnasJobState.FromResponse(response), response); + Response result = GetImportStatus(projectName, jobId, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringAuthoringImportJobState)result, result); } - /// Gets the status of update QnAs job. + /// Gets the status of an Import job. /// Name of the project. /// The job ID. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// or is null. /// or is an empty string, and was expected to be non-empty. - public virtual Response GetUpdateQnasStatus(string projectName, string jobId, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual async Task> GetImportStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetUpdateQnasStatus(projectName, jobId, context); - return Response.FromValue(QuestionAnsweringAuthoringUpdateQnasJobState.FromResponse(response), response); + Response result = await GetImportStatusAsync(projectName, jobId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringAuthoringImportJobState)result, result); } - /// - /// [Protocol Method] Gets the status of update QnAs job. - /// - /// - /// - /// 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. - /// - /// - /// - /// - /// Name of the project. - /// 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. + /// Deploy project to production. + /// 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 options, 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. /// The response returned from the service. - public virtual async Task GetUpdateQnasStatusAsync(string projectName, string jobId, RequestContext context) + public virtual Operation DeployProject(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateQnasStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeployProject"); scope.Start(); try { - using HttpMessage message = CreateGetUpdateQnasStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeployProject", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -1008,39 +919,25 @@ public virtual async Task GetUpdateQnasStatusAsync(string projectName, } } - /// - /// [Protocol Method] Gets the status of update QnAs job. - /// - /// - /// - /// 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. - /// - /// - /// - /// - /// Name of the project. - /// 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. + /// Deploy project to production. + /// 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 options, 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. /// The response returned from the service. - public virtual Response GetUpdateQnasStatus(string projectName, string jobId, RequestContext context) + public virtual async Task DeployProjectAsync(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateQnasStatus"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeployProject"); scope.Start(); try { - using HttpMessage message = CreateGetUpdateQnasStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeployProjectAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -1049,73 +946,64 @@ public virtual Response GetUpdateQnasStatus(string projectName, string jobId, Re } } - /// Update Active Learning feedback. + /// Deploy project to production. + /// 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. - /// Feedback for Active Learning. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task AddFeedbackAsync(string projectName, ActiveLearningFeedback body, CancellationToken cancellationToken = default) + /// The name of the specific deployment of the project to use. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public virtual Operation DeployProject(WaitUntil waitUntil, string projectName, string deploymentName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await AddFeedbackAsync(projectName, content, context).ConfigureAwait(false); - return response; + return DeployProject(waitUntil, projectName, deploymentName, cancellationToken.ToRequestContext()); } - /// Update Active Learning feedback. + /// Deploy project to production. + /// 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. - /// Feedback for Active Learning. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual Response AddFeedback(string projectName, ActiveLearningFeedback body, CancellationToken cancellationToken = default) + /// The name of the specific deployment of the project to use. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public virtual async Task DeployProjectAsync(WaitUntil waitUntil, string projectName, string deploymentName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = AddFeedback(projectName, content, context); - return response; + return await DeployProjectAsync(waitUntil, projectName, deploymentName, cancellationToken.ToRequestContext()).ConfigureAwait(false); } /// - /// [Protocol Method] Update Active Learning feedback. + /// [Protocol Method] Gets the status of a Deploy job. /// /// - /// - /// 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. - /// + /// 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. + /// Name of the project. + /// Name of the deployment. + /// The job ID. + /// The request options, 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 AddFeedbackAsync(string projectName, RequestContent content, RequestContext context = null) + public virtual Response GetDeployStatus(string projectName, string deploymentName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.AddFeedback"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployStatus"); scope.Start(); try { - using HttpMessage message = CreateAddFeedbackRequest(projectName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetDeployStatusRequest(projectName, deploymentName, jobId, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -1125,38 +1013,33 @@ public virtual async Task AddFeedbackAsync(string projectName, Request } /// - /// [Protocol Method] Update Active Learning feedback. + /// [Protocol Method] Gets the status of a Deploy job. /// /// - /// - /// 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. - /// + /// 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. + /// Name of the project. + /// Name of the deployment. + /// The job ID. + /// The request options, 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 AddFeedback(string projectName, RequestContent content, RequestContext context = null) + public virtual async Task GetDeployStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.AddFeedback"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetDeployStatus"); scope.Start(); try { - using HttpMessage message = CreateAddFeedbackRequest(projectName, content, context); - return _pipeline.ProcessMessage(message, context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetDeployStatusRequest(projectName, deploymentName, jobId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -1165,528 +1048,276 @@ public virtual Response AddFeedback(string projectName, RequestContent content, } } - /// Gets all projects for a user. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - public virtual AsyncPageable GetProjectsAsync(int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => QuestionAnsweringProject.DeserializeQuestionAnsweringProject(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", maxpagesize, context); - } - - /// Gets all projects for a user. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - public virtual Pageable GetProjects(int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => QuestionAnsweringProject.DeserializeQuestionAnsweringProject(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", maxpagesize, context); - } - - /// - /// [Protocol Method] Gets all projects for a user. - /// - /// - /// - /// 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 maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// 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(int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", maxpagesize, context); - } - - /// - /// [Protocol Method] Gets all projects for a user. - /// - /// - /// - /// 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 maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// 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(int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetProjects", "value", "nextLink", maxpagesize, context); - } - - /// List all deployments of a project. - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual AsyncPageable GetDeploymentsAsync(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ProjectDeployment.DeserializeProjectDeployment(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", maxpagesize, context); - } - - /// List all deployments of a project. - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Pageable GetDeployments(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ProjectDeployment.DeserializeProjectDeployment(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", maxpagesize, context); - } - - /// - /// [Protocol Method] List all deployments of a project. - /// - /// - /// - /// 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. - /// - /// - /// - /// - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// 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, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", maxpagesize, context); - } - - /// - /// [Protocol Method] List all deployments of a project. - /// - /// - /// - /// 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. - /// - /// - /// - /// - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// 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, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetDeployments", "value", "nextLink", maxpagesize, context); - } - - /// Gets all the synonyms of a project. - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual AsyncPageable GetSynonymsAsync(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSynonymsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSynonymsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WordAlterationsGroups.DeserializeWordAlterationsGroups(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", maxpagesize, context); - } - - /// Gets all the synonyms of a project. - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Pageable GetSynonyms(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSynonymsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSynonymsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WordAlterationsGroups.DeserializeWordAlterationsGroups(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", maxpagesize, context); - } - - /// - /// [Protocol Method] Gets all the synonyms of a project. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Gets the status of a Deploy job. /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// 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. + /// Name of the deployment. + /// The job ID. + /// The cancellation token that can be used to cancel the operation. + /// , 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 GetSynonymsAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) + public virtual Response GetDeployStatus(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSynonymsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSynonymsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", maxpagesize, context); + Response result = GetDeployStatus(projectName, deploymentName, jobId, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringAuthoringProjectDeploymentJobState)result, result); } - /// - /// [Protocol Method] Gets all the synonyms of a project. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Gets the status of a Deploy job. /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// 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. + /// Name of the deployment. + /// The job ID. + /// The cancellation token that can be used to cancel the operation. + /// , 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 GetSynonyms(string projectName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSynonymsRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSynonymsNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSynonyms", "value", "nextLink", maxpagesize, context); - } - - /// Gets all the sources of a project. - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual AsyncPageable GetSourcesAsync(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSourcesRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSourcesNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => QuestionAnsweringAuthoringSourceRecord.DeserializeQuestionAnsweringAuthoringSourceRecord(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", maxpagesize, context); - } - - /// Gets all the sources of a project. - /// Name of the project. - /// The maximum number of resources to return from the collection. - /// An offset into the collection of the first resource to be returned. - /// The maximum number of resources to include in a single response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public virtual Pageable GetSources(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual async Task> GetDeployStatusAsync(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSourcesRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSourcesNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => QuestionAnsweringAuthoringSourceRecord.DeserializeQuestionAnsweringAuthoringSourceRecord(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", maxpagesize, context); + Response result = await GetDeployStatusAsync(projectName, deploymentName, jobId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringAuthoringProjectDeploymentJobState)result, result); } /// - /// [Protocol Method] Gets all the sources of a project. + /// [Protocol Method] List all deployments of a project. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. - /// The maximum number of resources to return from the collection. + /// The maximum number of resources to return from the collection. /// An offset into the collection of the first resource to be returned. /// The maximum number of resources to include in a single response. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetSourcesAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) + /// The response returned from the service. + public virtual Pageable GetDeployments(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSourcesRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSourcesNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", maxpagesize, context); + return new QuestionAnsweringAuthoringClientGetDeploymentsCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + context); } /// - /// [Protocol Method] Gets all the sources of a project. + /// [Protocol Method] List all deployments of a project. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. - /// The maximum number of resources to return from the collection. + /// The maximum number of resources to return from the collection. /// An offset into the collection of the first resource to be returned. /// The maximum number of resources to include in a single response. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetSources(string projectName, int? maxCount, int? skip, int? maxpagesize, RequestContext context) + /// The response returned from the service. + public virtual AsyncPageable GetDeploymentsAsync(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSourcesRequest(projectName, maxCount, skip, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSourcesNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetSources", "value", "nextLink", maxpagesize, context); + return new QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + context); } - /// Gets all the QnAs of a project. + /// List all deployments of a project. /// Name of the project. - /// The maximum number of resources to return from the collection. + /// The maximum number of resources to return from the collection. /// An offset into the collection of the first resource to be returned. /// The maximum number of resources to include in a single response. - /// Source of the QnA. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// is null. /// is an empty string, and was expected to be non-empty. - public virtual AsyncPageable GetQnasAsync(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, string source = null, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Pageable GetDeployments(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQnasRequest(projectName, maxCount, skip, pageSizeHint, source, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQnasNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, source, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RetrieveQnaRecord.DeserializeRetrieveQnaRecord(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", maxpagesize, context); + return new QuestionAnsweringAuthoringClientGetDeploymentsCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + cancellationToken.ToRequestContext()); } - /// Gets all the QnAs of a project. + /// List all deployments of a project. /// Name of the project. - /// The maximum number of resources to return from the collection. + /// The maximum number of resources to return from the collection. /// An offset into the collection of the first resource to be returned. /// The maximum number of resources to include in a single response. - /// Source of the QnA. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// is null. /// is an empty string, and was expected to be non-empty. - public virtual Pageable GetQnas(string projectName, int? maxCount = null, int? skip = null, int? maxpagesize = null, string source = null, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual AsyncPageable GetDeploymentsAsync(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQnasRequest(projectName, maxCount, skip, pageSizeHint, source, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQnasNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, source, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RetrieveQnaRecord.DeserializeRetrieveQnaRecord(e), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", maxpagesize, context); + return new QuestionAnsweringAuthoringClientGetDeploymentsAsyncCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + cancellationToken.ToRequestContext()); } /// - /// [Protocol Method] Gets all the QnAs of a project. + /// [Protocol Method] Gets all the synonyms of a project. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. - /// The maximum number of resources to return from the collection. + /// The maximum number of resources to return from the collection. /// An offset into the collection of the first resource to be returned. /// The maximum number of resources to include in a single response. - /// Source of the QnA. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 GetQnasAsync(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, RequestContext context) + /// The response returned from the service. + public virtual Pageable GetSynonyms(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQnasRequest(projectName, maxCount, skip, pageSizeHint, source, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQnasNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, source, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", maxpagesize, context); + return new QuestionAnsweringAuthoringClientGetSynonymsCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + context); } /// - /// [Protocol Method] Gets all the QnAs of a project. + /// [Protocol Method] Gets all the synonyms of a project. /// /// - /// - /// 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. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Name of the project. - /// The maximum number of resources to return from the collection. + /// The maximum number of resources to return from the collection. /// An offset into the collection of the first resource to be returned. /// The maximum number of resources to include in a single response. - /// Source of the QnA. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, 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 AsyncPageable GetSynonymsAsync(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return new QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + context); + } + + /// Gets all the synonyms of a project. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Pageable GetSynonyms(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return new QuestionAnsweringAuthoringClientGetSynonymsCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + cancellationToken.ToRequestContext()); + } + + /// Gets all the synonyms of a project. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The cancellation token that can be used to cancel the operation. /// 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 GetQnas(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, RequestContext context) + public virtual AsyncPageable GetSynonymsAsync(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQnasRequest(projectName, maxCount, skip, pageSizeHint, source, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQnasNextPageRequest(nextLink, projectName, maxCount, skip, pageSizeHint, source, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "QuestionAnsweringAuthoringClient.GetQnas", "value", "nextLink", maxpagesize, context); + return new QuestionAnsweringAuthoringClientGetSynonymsAsyncCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + cancellationToken.ToRequestContext()); } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Delete the project. + /// [Protocol Method] Updates all the synonyms of a project. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. + /// The content to send as the body of the request. + /// The request options, 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 DeleteProjectAsync(WaitUntil waitUntil, string projectName, RequestContext context = null) + /// The response returned from the service. + public virtual Response UpdateSynonyms(string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeleteProject"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSynonyms"); scope.Start(); try { - using HttpMessage message = CreateDeleteProjectRequest(projectName, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeleteProject", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateSynonymsRequest(projectName, content, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -1695,34 +1326,32 @@ public virtual async Task DeleteProjectAsync(WaitUntil waitUntil, str } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Delete the project. + /// [Protocol Method] Updates all the synonyms of a project. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. + /// The content to send as the body of the request. + /// The request options, 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 DeleteProject(WaitUntil waitUntil, string projectName, RequestContext context = null) + /// The response returned from the service. + public virtual async Task UpdateSynonymsAsync(string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeleteProject"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSynonyms"); scope.Start(); try { - using HttpMessage message = CreateDeleteProjectRequest(projectName, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeleteProject", OperationFinalStateVia.OperationLocation, context, waitUntil); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateSynonymsRequest(projectName, content, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -1731,193 +1360,159 @@ public virtual Operation DeleteProject(WaitUntil waitUntil, string projectName, } } - /// Export project metadata and assets. - /// 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. + /// Updates all the synonyms of a project. /// The name of the project to use. - /// Knowledge base Import or Export format. - /// Kind of the asset of the project. - /// The cancellation token to use. - /// is null. + /// All the synonyms of a project. + /// The cancellation token that can be used to cancel the operation. + /// or is null. /// is an empty string, and was expected to be non-empty. - public virtual async Task ExportAsync(WaitUntil waitUntil, string projectName, FileFormat? format = null, AssetKind? assetKind = null, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Response UpdateSynonyms(string projectName, SynonymAssets body, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(body, nameof(body)); - RequestContext context = FromCancellationToken(cancellationToken); - return await ExportAsync(waitUntil, projectName, format?.ToString(), assetKind?.ToString(), context).ConfigureAwait(false); + return UpdateSynonyms(projectName, body, cancellationToken.ToRequestContext()); } - /// Export project metadata and assets. - /// 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. + /// Updates all the synonyms of a project. /// The name of the project to use. - /// Knowledge base Import or Export format. - /// Kind of the asset of the project. - /// The cancellation token to use. - /// is null. + /// All the synonyms of a project. + /// The cancellation token that can be used to cancel the operation. + /// or is null. /// is an empty string, and was expected to be non-empty. - public virtual Operation Export(WaitUntil waitUntil, string projectName, FileFormat? format = null, AssetKind? assetKind = null, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual async Task UpdateSynonymsAsync(string projectName, SynonymAssets body, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(body, nameof(body)); - RequestContext context = FromCancellationToken(cancellationToken); - return Export(waitUntil, projectName, format?.ToString(), assetKind?.ToString(), context); + return await UpdateSynonymsAsync(projectName, body, cancellationToken.ToRequestContext()).ConfigureAwait(false); } /// - /// [Protocol Method] Export project metadata and assets. + /// [Protocol Method] Gets all the sources of a project. /// /// - /// - /// 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. - /// + /// 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. - /// Knowledge base Import or Export format. Allowed values: "json" | "tsv" | "excel". - /// Kind of the asset of the project. Allowed values: "qnas" | "synonyms". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, 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 ExportAsync(WaitUntil waitUntil, string projectName, string format, string assetKind, RequestContext context) + /// The response returned from the service. + public virtual Pageable GetSources(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Export"); - scope.Start(); - try - { - using HttpMessage message = CreateExportRequest(projectName, format, assetKind, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new QuestionAnsweringAuthoringClientGetSourcesCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + context); } /// - /// [Protocol Method] Export project metadata and assets. + /// [Protocol Method] Gets all the sources of a project. /// /// - /// - /// 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. - /// + /// 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. - /// Knowledge base Import or Export format. Allowed values: "json" | "tsv" | "excel". - /// Kind of the asset of the project. Allowed values: "qnas" | "synonyms". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The request options, 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 Export(WaitUntil waitUntil, string projectName, string format, string assetKind, RequestContext context) + /// The response returned from the service. + public virtual AsyncPageable GetSourcesAsync(string projectName, int? top, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Export"); - scope.Start(); - try - { - using HttpMessage message = CreateExportRequest(projectName, format, assetKind, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + context); } - /// Import project assets. - /// 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. - /// Project assets the needs to be imported. - /// Knowledge base Import or Export format. - /// Kind of the asset of the project. - /// The cancellation token to use. + /// Gets all the sources of a project. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The cancellation token that can be used to cancel the operation. /// is null. /// is an empty string, and was expected to be non-empty. - public virtual async Task ImportAsync(WaitUntil waitUntil, string projectName, ImportJobOptions body = null, FileFormat? format = null, AssetKind? assetKind = null, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Pageable GetSources(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - using RequestContent content = body?.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - return await ImportAsync(waitUntil, projectName, content, format?.ToString(), assetKind?.ToString(), context).ConfigureAwait(false); + return new QuestionAnsweringAuthoringClientGetSourcesCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + cancellationToken.ToRequestContext()); } - /// Import project assets. - /// 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. - /// Project assets the needs to be imported. - /// Knowledge base Import or Export format. - /// Kind of the asset of the project. - /// The cancellation token to use. + /// Gets all the sources of a project. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// The cancellation token that can be used to cancel the operation. /// is null. /// is an empty string, and was expected to be non-empty. - public virtual Operation Import(WaitUntil waitUntil, string projectName, ImportJobOptions body = null, FileFormat? format = null, AssetKind? assetKind = null, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual AsyncPageable GetSourcesAsync(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - using RequestContent content = body?.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - return Import(waitUntil, projectName, content, format?.ToString(), assetKind?.ToString(), context); + return new QuestionAnsweringAuthoringClientGetSourcesAsyncCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + cancellationToken.ToRequestContext()); } - /// - /// [Protocol Method] Import project assets. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Updates the sources of a project. /// 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. - /// Knowledge base Import or Export format. Allowed values: "json" | "tsv" | "excel". - /// Kind of the asset of the project. Allowed values: "qnas" | "synonyms". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// The request options, 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 ImportAsync(WaitUntil waitUntil, string projectName, RequestContent content, string format = null, string assetKind = null, RequestContext context = null) + /// The response returned from the service. + public virtual Operation UpdateSources(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Import"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSources"); scope.Start(); try { - using HttpMessage message = CreateImportRequest(projectName, content, format, assetKind, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.Import", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateSourcesRequest(projectName, content, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSources", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -1926,41 +1521,25 @@ public virtual async Task ImportAsync(WaitUntil waitUntil, string pro } } - /// - /// [Protocol Method] Import project assets. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Updates the sources of a project. /// 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. - /// Knowledge base Import or Export format. Allowed values: "json" | "tsv" | "excel". - /// Kind of the asset of the project. Allowed values: "qnas" | "synonyms". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// The request options, 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 Import(WaitUntil waitUntil, string projectName, RequestContent content, string format = null, string assetKind = null, RequestContext context = null) + /// The response returned from the service. + public virtual async Task UpdateSourcesAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.Import"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSources"); scope.Start(); try { - using HttpMessage message = CreateImportRequest(projectName, content, format, assetKind, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.Import", OperationFinalStateVia.OperationLocation, context, waitUntil); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateSourcesRequest(projectName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSourcesAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -1969,78 +1548,54 @@ public virtual Operation Import(WaitUntil waitUntil, string projectName, Request } } - /// Import project assets from file. - /// 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. - /// Collection of files containing project assets the needs to be imported. - /// Kind of the asset of the project. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public virtual async Task ImportFromFilesAsync(WaitUntil waitUntil, string projectName, ImportFiles body, AssetKind? assetKind = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(body, nameof(body)); - - using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - return await ImportFromFilesAsync(waitUntil, projectName, content, content.ContentType, assetKind?.ToString(), context).ConfigureAwait(false); - } - - /// Import project assets from file. + /// Updates the sources of a project from files. /// 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. - /// Collection of files containing project assets the needs to be imported. - /// Kind of the asset of the project. - /// The cancellation token to use. - /// or is null. + /// The content to send as the body of the request. + /// The contentType to use which has the multipart/form-data boundary. + /// The request options, 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. - public virtual Operation ImportFromFiles(WaitUntil waitUntil, string projectName, ImportFiles body, AssetKind? assetKind = null, CancellationToken cancellationToken = default) + /// The response returned from the service. + public virtual Operation UpdateSourcesFromFiles(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(body, nameof(body)); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles"); + scope.Start(); + try + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); - using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - return ImportFromFiles(waitUntil, projectName, content, content.ContentType, assetKind?.ToString(), context); + using HttpMessage message = CreateUpdateSourcesFromFilesRequest(projectName, content, contentType, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - /// - /// [Protocol Method] Import project assets from file. - /// - /// - /// - /// 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. - /// - /// - /// - /// + /// Updates the sources of a project from files. /// 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. - /// This request has a multi-part body. Allowed values: "multipart/form-data". - /// Kind of the asset of the project. Allowed values: "qnas" | "synonyms". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The contentType to use which has the multipart/form-data boundary. + /// The request options, 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 ImportFromFilesAsync(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, string assetKind = null, RequestContext context = null) + /// The response returned from the service. + public virtual async Task UpdateSourcesFromFilesAsync(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.ImportFromFiles"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles"); scope.Start(); try { - using HttpMessage message = CreateImportFromFilesRequest(projectName, content, contentType, assetKind, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.ImportFromFiles", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateSourcesFromFilesRequest(projectName, content, contentType, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSourcesFromFilesAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -2050,41 +1605,31 @@ public virtual async Task ImportFromFilesAsync(WaitUntil waitUntil, s } /// - /// [Protocol Method] Import project assets from file. + /// [Protocol Method] Gets the status of update sources job. /// /// - /// - /// 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. - /// + /// 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. - /// This request has a multi-part body. Allowed values: "multipart/form-data". - /// Kind of the asset of the project. Allowed values: "qnas" | "synonyms". - /// 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. + /// Name of the project. + /// The job ID. + /// The request options, 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 ImportFromFiles(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, string assetKind = null, RequestContext context = null) + /// The response returned from the service. + public virtual Response GetUpdateSourcesStatus(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.ImportFromFiles"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateSourcesStatus"); scope.Start(); try { - using HttpMessage message = CreateImportFromFilesRequest(projectName, content, contentType, assetKind, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.ImportFromFiles", OperationFinalStateVia.OperationLocation, context, waitUntil); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetUpdateSourcesStatusRequest(projectName, jobId, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -2093,36 +1638,32 @@ public virtual Operation ImportFromFiles(WaitUntil waitUntil, string projectName } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Deploy project to production. + /// [Protocol Method] Gets the status of update sources job. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. + /// Name of the project. + /// The job ID. + /// The request options, 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, RequestContext context = null) + /// The response returned from the service. + public virtual async Task GetUpdateSourcesStatusAsync(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeployProject"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateSourcesStatus"); scope.Start(); try { - using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeployProject", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetUpdateSourcesStatusRequest(projectName, jobId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -2131,73 +1672,169 @@ public virtual async Task DeployProjectAsync(WaitUntil waitUntil, str } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// Gets the status of update sources job. + /// Name of the project. + /// The job ID. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response GetUpdateSourcesStatus(string projectName, string jobId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + Response result = GetUpdateSourcesStatus(projectName, jobId, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringAuthoringUpdateSourcesJobState)result, result); + } + + /// Gets the status of update sources job. + /// Name of the project. + /// The job ID. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task> GetUpdateSourcesStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + Response result = await GetUpdateSourcesStatusAsync(projectName, jobId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringAuthoringUpdateSourcesJobState)result, result); + } + /// - /// [Protocol Method] Deploy project to production. + /// [Protocol Method] Gets all the QnAs of a project. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The request options, 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 DeployProject(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context = null) + /// The response returned from the service. + public virtual Pageable GetQnas(string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.DeployProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.DeployProject", OperationFinalStateVia.OperationLocation, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new QuestionAnsweringAuthoringClientGetQnasCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + source, + context); } /// - /// [Protocol Method] Updates the sources of a project. + /// [Protocol Method] Gets all the QnAs of a project. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The request options, 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 AsyncPageable GetQnasAsync(string projectName, int? top, int? skip, int? maxpagesize, string source, RequestContext context) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return new QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResult( + this, + projectName, + top, + skip, + maxpagesize, + source, + context); + } + + /// Gets all the QnAs of a project. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Pageable GetQnas(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, string source = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return new QuestionAnsweringAuthoringClientGetQnasCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + source, + cancellationToken.ToRequestContext()); + } + + /// Gets all the QnAs of a project. + /// Name of the project. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The maximum number of resources to include in a single response. + /// Source of the QnA. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual AsyncPageable GetQnasAsync(string projectName, int? top = default, int? skip = default, int? maxpagesize = default, string source = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + return new QuestionAnsweringAuthoringClientGetQnasAsyncCollectionResultOfT( + this, + projectName, + top, + skip, + maxpagesize, + source, + cancellationToken.ToRequestContext()); + } + + /// Updates the QnAs of a project. /// 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. + /// The request options, 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 UpdateSourcesAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) + /// The response returned from the service. + public virtual Operation UpdateQnas(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSources"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateQnas"); scope.Start(); try { - using HttpMessage message = CreateUpdateSourcesRequest(projectName, content, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSources", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateQnasRequest(projectName, content, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateQnas", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -2206,35 +1843,25 @@ public virtual async Task UpdateSourcesAsync(WaitUntil waitUntil, str } } - /// - /// [Protocol Method] Updates the sources of a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// + /// Updates the QnAs of a project. /// 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. + /// The request options, 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 UpdateSources(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) + /// The response returned from the service. + public virtual async Task UpdateQnasAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSources"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateQnas"); scope.Start(); try { - using HttpMessage message = CreateUpdateSourcesRequest(projectName, content, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSources", OperationFinalStateVia.OperationLocation, context, waitUntil); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateUpdateQnasRequest(projectName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateQnasAsync", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -2244,35 +1871,31 @@ public virtual Operation UpdateSources(WaitUntil waitUntil, string projectName, } /// - /// [Protocol Method] Updates the sources of a project from files. + /// [Protocol Method] Gets the status of update QnAs job. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. - /// This request has a multi-part body. Allowed values: "multipart/form-data". - /// 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. + /// Name of the project. + /// The job ID. + /// The request options, 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 UpdateSourcesFromFilesAsync(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, RequestContext context = null) + /// The response returned from the service. + public virtual Response GetUpdateQnasStatus(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateQnasStatus"); scope.Start(); try { - using HttpMessage message = CreateUpdateSourcesFromFilesRequest(projectName, content, contentType, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetUpdateQnasStatusRequest(projectName, jobId, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -2282,35 +1905,31 @@ public virtual async Task UpdateSourcesFromFilesAsync(WaitUntil waitU } /// - /// [Protocol Method] Updates the sources of a project from files. + /// [Protocol Method] Gets the status of update QnAs job. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. - /// This request has a multi-part body. Allowed values: "multipart/form-data". - /// 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. + /// Name of the project. + /// The job ID. + /// The request options, 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 UpdateSourcesFromFiles(WaitUntil waitUntil, string projectName, RequestContent content, string contentType, RequestContext context = null) + /// The response returned from the service. + public virtual async Task GetUpdateQnasStatusAsync(string projectName, string jobId, RequestContext context) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.GetUpdateQnasStatus"); scope.Start(); try { - using HttpMessage message = CreateUpdateSourcesFromFilesRequest(projectName, content, contentType, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateSourcesFromFiles", OperationFinalStateVia.OperationLocation, context, waitUntil); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + using HttpMessage message = CreateGetUpdateQnasStatusRequest(projectName, jobId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -2319,35 +1938,64 @@ public virtual Operation UpdateSourcesFromFiles(WaitUntil waitUntil, string proj } } + /// Gets the status of update QnAs job. + /// Name of the project. + /// The job ID. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response GetUpdateQnasStatus(string projectName, string jobId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + Response result = GetUpdateQnasStatus(projectName, jobId, cancellationToken.ToRequestContext()); + return Response.FromValue((QuestionAnsweringAuthoringUpdateQnasJobState)result, result); + } + + /// Gets the status of update QnAs job. + /// Name of the project. + /// The job ID. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task> GetUpdateQnasStatusAsync(string projectName, string jobId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + + Response result = await GetUpdateQnasStatusAsync(projectName, jobId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((QuestionAnsweringAuthoringUpdateQnasJobState)result, result); + } + /// - /// [Protocol Method] Updates the QnAs of a project. + /// [Protocol Method] Update Active Learning feedback. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. + /// The request options, 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 UpdateQnasAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) + /// The response returned from the service. + public virtual Response AddFeedback(string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateQnas"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.AddFeedback"); scope.Start(); try { - using HttpMessage message = CreateUpdateQnasRequest(projectName, content, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateQnas", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateAddFeedbackRequest(projectName, content, context); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -2357,34 +2005,31 @@ public virtual async Task UpdateQnasAsync(WaitUntil waitUntil, string } /// - /// [Protocol Method] Updates the QnAs of a project. + /// [Protocol Method] Update Active Learning feedback. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// 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. + /// The request options, 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 UpdateQnas(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) + /// The response returned from the service. + public virtual async Task AddFeedbackAsync(string projectName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.UpdateQnas"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("QuestionAnsweringAuthoringClient.AddFeedback"); scope.Start(); try { - using HttpMessage message = CreateUpdateQnasRequest(projectName, content, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "QuestionAnsweringAuthoringClient.UpdateQnas", OperationFinalStateVia.OperationLocation, context, waitUntil); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateAddFeedbackRequest(projectName, content, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -2393,577 +2038,34 @@ public virtual Operation UpdateQnas(WaitUntil waitUntil, string projectName, Req } } - internal HttpMessage CreateGetProjectsRequest(int? maxCount, int? skip, int? maxpagesize, 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/query-knowledgebases/projects", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetProjectDetailsRequest(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/query-knowledgebases/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 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/query-knowledgebases/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/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateDeleteProjectRequest(string projectName, RequestContext context) + /// Update Active Learning feedback. + /// The name of the project to use. + /// Feedback for Active Learning. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response AddFeedback(string projectName, ActiveLearningFeedback body, CancellationToken cancellationToken = default) { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - return message; - } + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(body, nameof(body)); - internal HttpMessage CreateGetDeleteStatusRequest(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/query-knowledgebases/projects/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 CreateExportRequest(string projectName, string format, string assetKind, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/:export", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (format != null) - { - uri.AppendQuery("format", format, true); - } - if (assetKind != null) - { - uri.AppendQuery("assetKind", assetKind, true); - } - request.Uri = uri; - return message; - } - - internal HttpMessage CreateGetExportStatusRequest(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/query-knowledgebases/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 CreateImportRequest(string projectName, RequestContent content, string format, string assetKind, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/:import", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (format != null) - { - uri.AppendQuery("format", format, true); - } - if (assetKind != null) - { - uri.AppendQuery("assetKind", assetKind, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateImportFromFilesRequest(string projectName, RequestContent content, string contentType, string assetKind, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/:import", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (assetKind != null) - { - uri.AppendQuery("assetKind", assetKind, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", contentType); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetImportStatusRequest(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/query-knowledgebases/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 CreateDeployProjectRequest(string projectName, string deploymentName, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/", false); - uri.AppendPath(deploymentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - return message; - } - - internal HttpMessage CreateGetDeployStatusRequest(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/query-knowledgebases/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 CreateGetDeploymentsRequest(string projectName, int? maxCount, int? skip, int? maxpagesize, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSynonymsRequest(string projectName, int? maxCount, int? skip, int? maxpagesize, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/synonyms", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUpdateSynonymsRequest(string projectName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/synonyms", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetSourcesRequest(string projectName, int? maxCount, int? skip, int? maxpagesize, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/sources", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + return AddFeedback(projectName, body, cancellationToken.ToRequestContext()); } - internal HttpMessage CreateUpdateSourcesRequest(string projectName, RequestContent content, RequestContext context) + /// Update Active Learning feedback. + /// The name of the project to use. + /// Feedback for Active Learning. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task AddFeedbackAsync(string projectName, ActiveLearningFeedback body, CancellationToken cancellationToken = default) { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/sources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateUpdateSourcesFromFilesRequest(string projectName, RequestContent content, string contentType, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/sources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", contentType); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetUpdateSourcesStatusRequest(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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/sources/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 CreateGetQnasRequest(string projectName, int? maxCount, int? skip, int? maxpagesize, string source, 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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/qnas", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - if (source != null) - { - uri.AppendQuery("source", source, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateUpdateQnasRequest(string projectName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/qnas", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetUpdateQnasStatusRequest(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/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/qnas/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 CreateAddFeedbackRequest(string projectName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/query-knowledgebases/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/feedback", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetProjectsNextPageRequest(string nextLink, int? maxCount, int? skip, int? maxpagesize, 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, int? maxCount, int? skip, int? maxpagesize, 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; + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(body, nameof(body)); + + return await AddFeedbackAsync(projectName, body, cancellationToken.ToRequestContext()).ConfigureAwait(false); } - - internal HttpMessage CreateGetSynonymsNextPageRequest(string nextLink, string projectName, int? maxCount, int? skip, int? maxpagesize, 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 CreateGetSourcesNextPageRequest(string nextLink, string projectName, int? maxCount, int? skip, int? maxpagesize, 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 CreateGetQnasNextPageRequest(string nextLink, string projectName, int? maxCount, int? skip, int? maxpagesize, string source, 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 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 _responseClassifier200201; - private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); - private static ResponseClassifier _responseClassifier202; - private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); - private static ResponseClassifier _responseClassifier204; - private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClientOptions.cs index 930a706d2049..12f2a2a5f74d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClientOptions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringClientOptions.cs @@ -10,23 +10,13 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring { - /// Client options for QuestionAnsweringAuthoringClient. + /// Client options for . public partial class QuestionAnsweringAuthoringClientOptions : ClientOptions { private const ServiceVersion LatestVersion = ServiceVersion.V2025_05_15_Preview; - /// The version of the service to use. - public enum ServiceVersion - { - /// Service version "2023-04-01". - V2023_04_01 = 1, - /// Service version "2025-05-15-preview". - V2025_05_15_Preview = 2, - } - - internal string Version { get; } - - /// Initializes new instance of QuestionAnsweringAuthoringClientOptions. + /// Initializes a new instance of QuestionAnsweringAuthoringClientOptions. + /// The service version. public QuestionAnsweringAuthoringClientOptions(ServiceVersion version = LatestVersion) { Version = version switch @@ -36,5 +26,17 @@ public QuestionAnsweringAuthoringClientOptions(ServiceVersion version = LatestVe _ => throw new NotSupportedException() }; } + + /// Gets the Version. + internal string Version { get; } + + /// The version of the service to use. + public enum ServiceVersion + { + /// The 2023-04-01 API version. + V2023_04_01 = 1, + /// Version 2025-05-15-preview. + V2025_05_15_Preview = 2 + } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.Serialization.cs deleted file mode 100644 index e4cc0332d039..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.Serialization.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class QuestionAnsweringAuthoringError : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringError)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code.ToString()); - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - if (Optional.IsDefined(Target)) - { - writer.WritePropertyName("target"u8); - writer.WriteStringValue(Target); - } - if (Optional.IsCollectionDefined(Details)) - { - writer.WritePropertyName("details"u8); - writer.WriteStartArray(); - foreach (var item in Details) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(InnerError)) - { - writer.WritePropertyName("innererror"u8); - writer.WriteObjectValue(InnerError, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - QuestionAnsweringAuthoringError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeQuestionAnsweringAuthoringError(document.RootElement, options); - } - - internal static QuestionAnsweringAuthoringError DeserializeQuestionAnsweringAuthoringError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - QuestionAnsweringAuthoringErrorCode code = default; - string message = default; - string target = default; - IReadOnlyList details = default; - QuestionAnsweringAuthoringInnerErrorModel innererror = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = new QuestionAnsweringAuthoringErrorCode(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(DeserializeQuestionAnsweringAuthoringError(item, options)); - } - details = array; - continue; - } - if (property.NameEquals("innererror"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - innererror = QuestionAnsweringAuthoringInnerErrorModel.DeserializeQuestionAnsweringAuthoringInnerErrorModel(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringError( - 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, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringError)} does not support writing '{options.Format}' format."); - } - } - - QuestionAnsweringAuthoringError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringError)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringError FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringError(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.cs deleted file mode 100644 index 89ed4c2de40b..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringError.cs +++ /dev/null @@ -1,100 +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.Language.QuestionAnswering.Authoring -{ - /// The error object. - public partial class QuestionAnsweringAuthoringError - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 QuestionAnsweringAuthoringError(QuestionAnsweringAuthoringErrorCode 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 QuestionAnsweringAuthoringError(QuestionAnsweringAuthoringErrorCode code, string message, string target, IReadOnlyList details, QuestionAnsweringAuthoringInnerErrorModel innerError, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - Target = target; - Details = details; - InnerError = innerError; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringError() - { - } - - /// One of a server-defined set of error codes. - public QuestionAnsweringAuthoringErrorCode 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 QuestionAnsweringAuthoringInnerErrorModel InnerError { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringErrorCode.cs deleted file mode 100644 index 46aee50e01d4..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringErrorCode.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - /// Human-readable error code. - public readonly partial struct QuestionAnsweringAuthoringErrorCode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public QuestionAnsweringAuthoringErrorCode(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 QuestionAnsweringAuthoringErrorCode InvalidRequest { get; } = new QuestionAnsweringAuthoringErrorCode(InvalidRequestValue); - /// Invalid argument error. - public static QuestionAnsweringAuthoringErrorCode InvalidArgument { get; } = new QuestionAnsweringAuthoringErrorCode(InvalidArgumentValue); - /// Unauthorized access error. - public static QuestionAnsweringAuthoringErrorCode Unauthorized { get; } = new QuestionAnsweringAuthoringErrorCode(UnauthorizedValue); - /// Forbidden access error. - public static QuestionAnsweringAuthoringErrorCode Forbidden { get; } = new QuestionAnsweringAuthoringErrorCode(ForbiddenValue); - /// Not found error. - public static QuestionAnsweringAuthoringErrorCode NotFound { get; } = new QuestionAnsweringAuthoringErrorCode(NotFoundValue); - /// Project not found error. - public static QuestionAnsweringAuthoringErrorCode ProjectNotFound { get; } = new QuestionAnsweringAuthoringErrorCode(ProjectNotFoundValue); - /// Operation not found error. - public static QuestionAnsweringAuthoringErrorCode OperationNotFound { get; } = new QuestionAnsweringAuthoringErrorCode(OperationNotFoundValue); - /// Azure Cognitive Search not found error. - public static QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchNotFound { get; } = new QuestionAnsweringAuthoringErrorCode(AzureCognitiveSearchNotFoundValue); - /// Azure Cognitive Search index not found error. - public static QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchIndexNotFound { get; } = new QuestionAnsweringAuthoringErrorCode(AzureCognitiveSearchIndexNotFoundValue); - /// Too many requests error. - public static QuestionAnsweringAuthoringErrorCode TooManyRequests { get; } = new QuestionAnsweringAuthoringErrorCode(TooManyRequestsValue); - /// Azure Cognitive Search throttling error. - public static QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchThrottling { get; } = new QuestionAnsweringAuthoringErrorCode(AzureCognitiveSearchThrottlingValue); - /// Azure Cognitive Search index limit reached error. - public static QuestionAnsweringAuthoringErrorCode AzureCognitiveSearchIndexLimitReached { get; } = new QuestionAnsweringAuthoringErrorCode(AzureCognitiveSearchIndexLimitReachedValue); - /// Internal server error. - public static QuestionAnsweringAuthoringErrorCode InternalServerError { get; } = new QuestionAnsweringAuthoringErrorCode(InternalServerErrorValue); - /// Service unavailable error. - public static QuestionAnsweringAuthoringErrorCode ServiceUnavailable { get; } = new QuestionAnsweringAuthoringErrorCode(ServiceUnavailableValue); - /// Timeout error. - public static QuestionAnsweringAuthoringErrorCode Timeout { get; } = new QuestionAnsweringAuthoringErrorCode(TimeoutValue); - /// Quota exceeded error. - public static QuestionAnsweringAuthoringErrorCode QuotaExceeded { get; } = new QuestionAnsweringAuthoringErrorCode(QuotaExceededValue); - /// Conflict error. - public static QuestionAnsweringAuthoringErrorCode Conflict { get; } = new QuestionAnsweringAuthoringErrorCode(ConflictValue); - /// Warning error. - public static QuestionAnsweringAuthoringErrorCode Warning { get; } = new QuestionAnsweringAuthoringErrorCode(WarningValue); - /// Determines if two values are the same. - public static bool operator ==(QuestionAnsweringAuthoringErrorCode left, QuestionAnsweringAuthoringErrorCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(QuestionAnsweringAuthoringErrorCode left, QuestionAnsweringAuthoringErrorCode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator QuestionAnsweringAuthoringErrorCode(string value) => new QuestionAnsweringAuthoringErrorCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is QuestionAnsweringAuthoringErrorCode other && Equals(other); - /// - public bool Equals(QuestionAnsweringAuthoringErrorCode 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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.Serialization.cs deleted file mode 100644 index c81e8b6031d0..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringExportJobState.Serialization.cs +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class QuestionAnsweringAuthoringExportJobState : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support writing '{format}' format."); - } - - 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(LastUpdated, "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(); - } - writer.WritePropertyName("resultUrl"u8); - writer.WriteStringValue(ResultUrl); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - QuestionAnsweringAuthoringExportJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeQuestionAnsweringAuthoringExportJobState(document.RootElement, options); - } - - internal static QuestionAnsweringAuthoringExportJobState DeserializeQuestionAnsweringAuthoringExportJobState(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset createdDateTime = default; - DateTimeOffset? expirationDateTime = default; - string jobId = default; - DateTimeOffset lastUpdatedDateTime = default; - QuestionAnsweringAuthoringJobStatus status = default; - IReadOnlyList errors = default; - string resultUrl = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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 QuestionAnsweringAuthoringJobStatus(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(QuestionAnsweringAuthoringError.DeserializeQuestionAnsweringAuthoringError(item, options)); - } - errors = array; - continue; - } - if (property.NameEquals("resultUrl"u8)) - { - resultUrl = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringExportJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors ?? new ChangeTrackingList(), - resultUrl, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support writing '{options.Format}' format."); - } - } - - QuestionAnsweringAuthoringExportJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringExportJobState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringExportJobState)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringExportJobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringExportJobState(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorCode.cs deleted file mode 100644 index 0a25f45d36bc..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorCode.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - /// Human-readable error code. - public readonly partial struct QuestionAnsweringAuthoringInnerErrorCode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public QuestionAnsweringAuthoringInnerErrorCode(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 QuestionAnsweringAuthoringInnerErrorCode InvalidRequest { get; } = new QuestionAnsweringAuthoringInnerErrorCode(InvalidRequestValue); - /// Invalid parameter value error. - public static QuestionAnsweringAuthoringInnerErrorCode InvalidParameterValue { get; } = new QuestionAnsweringAuthoringInnerErrorCode(InvalidParameterValueValue); - /// Knowledge base not found error. - public static QuestionAnsweringAuthoringInnerErrorCode KnowledgeBaseNotFound { get; } = new QuestionAnsweringAuthoringInnerErrorCode(KnowledgeBaseNotFoundValue); - /// Azure Cognitive Search not found error. - public static QuestionAnsweringAuthoringInnerErrorCode AzureCognitiveSearchNotFound { get; } = new QuestionAnsweringAuthoringInnerErrorCode(AzureCognitiveSearchNotFoundValue); - /// Azure Cognitive Search throttling error. - public static QuestionAnsweringAuthoringInnerErrorCode AzureCognitiveSearchThrottling { get; } = new QuestionAnsweringAuthoringInnerErrorCode(AzureCognitiveSearchThrottlingValue); - /// Extraction failure error. - public static QuestionAnsweringAuthoringInnerErrorCode ExtractionFailure { get; } = new QuestionAnsweringAuthoringInnerErrorCode(ExtractionFailureValue); - /// Invalid request body format error. - public static QuestionAnsweringAuthoringInnerErrorCode InvalidRequestBodyFormat { get; } = new QuestionAnsweringAuthoringInnerErrorCode(InvalidRequestBodyFormatValue); - /// Empty request error. - public static QuestionAnsweringAuthoringInnerErrorCode EmptyRequest { get; } = new QuestionAnsweringAuthoringInnerErrorCode(EmptyRequestValue); - /// Missing input documents error. - public static QuestionAnsweringAuthoringInnerErrorCode MissingInputDocuments { get; } = new QuestionAnsweringAuthoringInnerErrorCode(MissingInputDocumentsValue); - /// Invalid document error. - public static QuestionAnsweringAuthoringInnerErrorCode InvalidDocument { get; } = new QuestionAnsweringAuthoringInnerErrorCode(InvalidDocumentValue); - /// Model version incorrect error. - public static QuestionAnsweringAuthoringInnerErrorCode ModelVersionIncorrect { get; } = new QuestionAnsweringAuthoringInnerErrorCode(ModelVersionIncorrectValue); - /// Invalid document batch error. - public static QuestionAnsweringAuthoringInnerErrorCode InvalidDocumentBatch { get; } = new QuestionAnsweringAuthoringInnerErrorCode(InvalidDocumentBatchValue); - /// Unsupported language code error. - public static QuestionAnsweringAuthoringInnerErrorCode UnsupportedLanguageCode { get; } = new QuestionAnsweringAuthoringInnerErrorCode(UnsupportedLanguageCodeValue); - /// Invalid country hint error. - public static QuestionAnsweringAuthoringInnerErrorCode InvalidCountryHint { get; } = new QuestionAnsweringAuthoringInnerErrorCode(InvalidCountryHintValue); - /// Determines if two values are the same. - public static bool operator ==(QuestionAnsweringAuthoringInnerErrorCode left, QuestionAnsweringAuthoringInnerErrorCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(QuestionAnsweringAuthoringInnerErrorCode left, QuestionAnsweringAuthoringInnerErrorCode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator QuestionAnsweringAuthoringInnerErrorCode(string value) => new QuestionAnsweringAuthoringInnerErrorCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is QuestionAnsweringAuthoringInnerErrorCode other && Equals(other); - /// - public bool Equals(QuestionAnsweringAuthoringInnerErrorCode 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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.Serialization.cs deleted file mode 100644 index 49e31812ca50..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.Serialization.cs +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class QuestionAnsweringAuthoringInnerErrorModel : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringInnerErrorModel)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code.ToString()); - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - if (Optional.IsCollectionDefined(Details)) - { - writer.WritePropertyName("details"u8); - writer.WriteStartObject(); - foreach (var item in Details) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(Target)) - { - writer.WritePropertyName("target"u8); - writer.WriteStringValue(Target); - } - if (Optional.IsDefined(Innererror)) - { - writer.WritePropertyName("innererror"u8); - writer.WriteObjectValue(Innererror, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - QuestionAnsweringAuthoringInnerErrorModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringInnerErrorModel)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeQuestionAnsweringAuthoringInnerErrorModel(document.RootElement, options); - } - - internal static QuestionAnsweringAuthoringInnerErrorModel DeserializeQuestionAnsweringAuthoringInnerErrorModel(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - QuestionAnsweringAuthoringInnerErrorCode code = default; - string message = default; - IReadOnlyDictionary details = default; - string target = default; - QuestionAnsweringAuthoringInnerErrorModel innererror = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = new QuestionAnsweringAuthoringInnerErrorCode(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 = DeserializeQuestionAnsweringAuthoringInnerErrorModel(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringInnerErrorModel( - 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, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringInnerErrorModel)} does not support writing '{options.Format}' format."); - } - } - - QuestionAnsweringAuthoringInnerErrorModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringInnerErrorModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringInnerErrorModel)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringInnerErrorModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringInnerErrorModel(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.cs deleted file mode 100644 index 63130e08b3fe..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringInnerErrorModel.cs +++ /dev/null @@ -1,104 +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.Language.QuestionAnswering.Authoring -{ - /// - /// 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 QuestionAnsweringAuthoringInnerErrorModel - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 QuestionAnsweringAuthoringInnerErrorModel(QuestionAnsweringAuthoringInnerErrorCode 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 QuestionAnsweringAuthoringInnerErrorModel(QuestionAnsweringAuthoringInnerErrorCode code, string message, IReadOnlyDictionary details, string target, QuestionAnsweringAuthoringInnerErrorModel innererror, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - Details = details; - Target = target; - Innererror = innererror; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QuestionAnsweringAuthoringInnerErrorModel() - { - } - - /// One of a server-defined set of error codes. - public QuestionAnsweringAuthoringInnerErrorCode 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 QuestionAnsweringAuthoringInnerErrorModel Innererror { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs deleted file mode 100644 index fa9d3db3fa0e..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateQnasJobState.Serialization.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class QuestionAnsweringAuthoringUpdateQnasJobState : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support writing '{format}' format."); - } - - 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 (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - QuestionAnsweringAuthoringUpdateQnasJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(document.RootElement, options); - } - - internal static QuestionAnsweringAuthoringUpdateQnasJobState DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset createdDateTime = default; - DateTimeOffset? expirationDateTime = default; - string jobId = default; - DateTimeOffset lastUpdatedDateTime = default; - QuestionAnsweringAuthoringJobStatus status = default; - IReadOnlyList errors = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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 QuestionAnsweringAuthoringJobStatus(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(QuestionAnsweringAuthoringError.DeserializeQuestionAnsweringAuthoringError(item, options)); - } - errors = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringUpdateQnasJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors ?? 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, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support writing '{options.Format}' format."); - } - } - - QuestionAnsweringAuthoringUpdateQnasJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateQnasJobState)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringUpdateQnasJobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringUpdateQnasJobState(document.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.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs deleted file mode 100644 index 02c256c6c1f1..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/QuestionAnsweringAuthoringUpdateSourcesJobState.Serialization.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class QuestionAnsweringAuthoringUpdateSourcesJobState : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support writing '{format}' format."); - } - - 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 (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - QuestionAnsweringAuthoringUpdateSourcesJobState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(document.RootElement, options); - } - - internal static QuestionAnsweringAuthoringUpdateSourcesJobState DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset createdDateTime = default; - DateTimeOffset? expirationDateTime = default; - string jobId = default; - DateTimeOffset lastUpdatedDateTime = default; - QuestionAnsweringAuthoringJobStatus status = default; - IReadOnlyList errors = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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 QuestionAnsweringAuthoringJobStatus(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(QuestionAnsweringAuthoringError.DeserializeQuestionAnsweringAuthoringError(item, options)); - } - errors = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new QuestionAnsweringAuthoringUpdateSourcesJobState( - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors ?? 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, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support writing '{options.Format}' format."); - } - } - - QuestionAnsweringAuthoringUpdateSourcesJobState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(QuestionAnsweringAuthoringUpdateSourcesJobState)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static QuestionAnsweringAuthoringUpdateSourcesJobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQuestionAnsweringAuthoringUpdateSourcesJobState(document.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.QuestionAnswering.Authoring/src/Generated/SynonymAssets.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SynonymAssets.Serialization.cs deleted file mode 100644 index 1f14a0e1a1c6..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SynonymAssets.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class SynonymAssets : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SynonymAssets)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink.AbsoluteUri); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SynonymAssets IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SynonymAssets)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSynonymAssets(document.RootElement, options); - } - - internal static SynonymAssets DeserializeSynonymAssets(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList value = default; - Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(WordAlterationsGroups.DeserializeWordAlterationsGroups(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nextLink = new Uri(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SynonymAssets(value, nextLink, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(SynonymAssets)} does not support writing '{options.Format}' format."); - } - } - - SynonymAssets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSynonymAssets(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SynonymAssets)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static SynonymAssets FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSynonymAssets(document.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.QuestionAnswering.Authoring/src/Generated/SynonymAssets.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SynonymAssets.cs deleted file mode 100644 index d86e2292c9bf..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/SynonymAssets.cs +++ /dev/null @@ -1,80 +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.Language.QuestionAnswering.Authoring -{ - /// Request payload for updating synonyms. - public partial class SynonymAssets - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 WordAlterations items on this page. - /// is null. - public SynonymAssets(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// The WordAlterations items on this page. - /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal SynonymAssets(IList value, Uri nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal SynonymAssets() - { - } - - /// The WordAlterations items on this page. - public IList Value { get; } - /// The link to the next page of items. - public Uri NextLink { get; set; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.Serialization.cs deleted file mode 100644 index 0c090969d90d..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.Serialization.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - public partial class WordAlterationsGroups : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("alterations"u8); - writer.WriteStartArray(); - foreach (var item in Alterations) - { - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - WordAlterationsGroups IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWordAlterationsGroups(document.RootElement, options); - } - - internal static WordAlterationsGroups DeserializeWordAlterationsGroups(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList alterations = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("alterations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - alterations = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WordAlterationsGroups(alterations, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureAILanguageQuestionAnsweringAuthoringContext.Default); - default: - throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support writing '{options.Format}' format."); - } - } - - WordAlterationsGroups IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeWordAlterationsGroups(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WordAlterationsGroups)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static WordAlterationsGroups FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeWordAlterationsGroups(document.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.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.cs deleted file mode 100644 index 2b77d9b8cc3d..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/Generated/WordAlterationsGroups.cs +++ /dev/null @@ -1,76 +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.Language.QuestionAnswering.Authoring -{ - /// Collection of word alterations. - public partial class WordAlterationsGroups - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload 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 . - /// Collection of word alterations. - /// is null. - public WordAlterationsGroups(IEnumerable alterations) - { - Argument.AssertNotNull(alterations, nameof(alterations)); - - Alterations = alterations.ToList(); - } - - /// Initializes a new instance of . - /// Collection of word alterations. - /// Keeps track of any properties unknown to the library. - internal WordAlterationsGroups(IList alterations, IDictionary serializedAdditionalRawData) - { - Alterations = alterations; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal WordAlterationsGroups() - { - } - - /// Collection of word alterations. - public IList Alterations { get; } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ImportContentType.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ImportContentType.cs new file mode 100644 index 000000000000..91bf70e8cee2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ImportContentType.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + /// Body parameter's content type. + public readonly partial struct ImportContentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ImportContentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ApplicationJsonValue = "application/json"; + + /// application/json. + public static ImportContentType ApplicationJson { get; } = new ImportContentType(ApplicationJsonValue); + + /// Determines if two values are the same. + public static bool operator ==(ImportContentType left, ImportContentType right) => left.Equals(right); + + /// Determines if two values are not the same. + public static bool operator !=(ImportContentType left, ImportContentType right) => !left.Equals(right); + + /// Converts a string to a . + public static implicit operator ImportContentType(string value) => new ImportContentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ImportContentType other && Equals(other); + + /// + public bool Equals(ImportContentType 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.QuestionAnswering.Authoring/src/KnowledgeBaseFile.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/KnowledgeBaseFile.cs deleted file mode 100644 index 015972c5c2ce..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/KnowledgeBaseFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - [CodeGenType("File")] - public partial class KnowledgeBaseFile - {} -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ProjectDeploymentJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ProjectDeploymentJobState.cs deleted file mode 100644 index cc6913f975c4..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/ProjectDeploymentJobState.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - [CodeGenType("QuestionAnsweringAuthoringProjectDeploymentJobState")] - public partial class ProjectDeploymentJobState{} -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClient.cs index d01ff09ce02a..d22e9fc6dbdf 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClient.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; @@ -11,13 +10,6 @@ namespace Azure.AI.Language.QuestionAnswering.Authoring /// /// Hand-authored extensions for . /// - [CodeGenSuppress("QuestionAnsweringAuthoringClient", typeof(Uri), typeof(TokenCredential))] - [CodeGenSuppress( - "QuestionAnsweringAuthoringClient", - typeof(Uri), - typeof(TokenCredential), - typeof(QuestionAnsweringAuthoringClientOptions) - )] public partial class QuestionAnsweringAuthoringClient { /// @@ -52,7 +44,7 @@ public QuestionAnsweringAuthoringClient( ClientDiagnostics = new ClientDiagnostics(options, true); _tokenCredential = credential; - _pipeline = HttpPipelineBuilder.Build( + Pipeline = HttpPipelineBuilder.Build( options, Array.Empty(), new HttpPipelinePolicy[] diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs new file mode 100644 index 000000000000..873bfbf563c4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.AI.Language.QuestionAnswering.Authoring +{ + public partial class QuestionAnsweringAuthoringClient + { + /// Import project assets - helper overload. + private Operation Import(WaitUntil waitUntil, string projectName, ImportJobOptions body, string format, string assetKind, string contentType, RequestContext context) + { + RequestContent content = body != null ? RequestContent.Create(body, ModelSerializationExtensions.WireOptions) : null; + return Import(waitUntil, projectName, content, format, assetKind, context); + } + + /// Import project assets - helper overload. + private async Task ImportAsync(WaitUntil waitUntil, string projectName, ImportJobOptions body, string format, string assetKind, string contentType, RequestContext context) + { + RequestContent content = body != null ? RequestContent.Create(body, ModelSerializationExtensions.WireOptions) : null; + return await ImportAsync(waitUntil, projectName, content, format, assetKind, context).ConfigureAwait(false); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringError.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringError.cs deleted file mode 100644 index 100f2d43ebeb..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringError.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - [CodeGenType("Error")] - public partial class QuestionAnsweringAuthoringError{} -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringErrorCode.cs deleted file mode 100644 index fd1c0530f0b0..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringErrorCode.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - [CodeGenModel("ErrorCode")] - public readonly partial struct QuestionAnsweringAuthoringErrorCode {} -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorCode.cs deleted file mode 100644 index b38c1d335692..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorCode.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - [CodeGenModel("InnerErrorCode")] - public readonly partial struct QuestionAnsweringAuthoringInnerErrorCode{} -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorModel.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorModel.cs deleted file mode 100644 index 4626fa3d0781..000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringInnerErrorModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.Language.QuestionAnswering.Authoring -{ - [CodeGenModel("InnerErrorModel")] - public partial class QuestionAnsweringAuthoringInnerErrorModel{} -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml index 6810e81c7d16..70a8d82a6c92 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml @@ -2,5 +2,4 @@ directory: specification/cognitiveservices/data-plane/LanguageQuestionAnsweringA additionalDirectories: [] repo: Azure/azure-rest-api-specs commit: 3d6f009ea2c460e9bf764f909791fd20e0a252be - -emitterPackageJsonPath: eng/legacy-emitter-package.json +emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-emitter-package.json From 287f91709bed9b2a652c10a7bbc7170a6bc5d73f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Dec 2025 03:33:16 +0000 Subject: [PATCH 3/5] Address code review feedback - add pragma for unused parameter warning Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../QuestionAnsweringAuthoringClientCustomizations.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs index 873bfbf563c4..8c4eba130a36 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/src/QuestionAnsweringAuthoringClientCustomizations.cs @@ -6,18 +6,22 @@ using System.Threading.Tasks; using Azure.Core; +#pragma warning disable IDE0060 // Remove unused parameter + namespace Azure.AI.Language.QuestionAnswering.Authoring { public partial class QuestionAnsweringAuthoringClient { - /// Import project assets - helper overload. + /// Import project assets - helper overload for generated convenience methods. + /// The contentType parameter is required to match the generated code signature but is handled by the protocol method. private Operation Import(WaitUntil waitUntil, string projectName, ImportJobOptions body, string format, string assetKind, string contentType, RequestContext context) { RequestContent content = body != null ? RequestContent.Create(body, ModelSerializationExtensions.WireOptions) : null; return Import(waitUntil, projectName, content, format, assetKind, context); } - /// Import project assets - helper overload. + /// Import project assets - helper overload for generated convenience methods. + /// The contentType parameter is required to match the generated code signature but is handled by the protocol method. private async Task ImportAsync(WaitUntil waitUntil, string projectName, ImportJobOptions body, string format, string assetKind, string contentType, RequestContext context) { RequestContent content = body != null ? RequestContent.Create(body, ModelSerializationExtensions.WireOptions) : null; @@ -25,3 +29,5 @@ private async Task ImportAsync(WaitUntil waitUntil, string projectNam } } } + +#pragma warning restore IDE0060 // Remove unused parameter From 1c91b498f571843449a366eeb7d5f20a8b75a706 Mon Sep 17 00:00:00 2001 From: jolov Date: Fri, 5 Dec 2025 11:10:51 -0800 Subject: [PATCH 4/5] regen --- .../tsp-location.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml index 70a8d82a6c92..9149c87e4484 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering.Authoring/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/cognitiveservices/data-plane/LanguageQuestionAnsweringAuthoring additionalDirectories: [] repo: Azure/azure-rest-api-specs -commit: 3d6f009ea2c460e9bf764f909791fd20e0a252be +commit: a43857e1fdbf606ac3ea8ee260dcb9552997e3b9 emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-emitter-package.json From 8f97b144595a961631def3afa3e25b3cd0b1f311 Mon Sep 17 00:00:00 2001 From: jolov Date: Fri, 5 Dec 2025 11:11:44 -0800 Subject: [PATCH 5/5] inventory --- doc/GeneratorMigration/Library_Inventory.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/GeneratorMigration/Library_Inventory.md b/doc/GeneratorMigration/Library_Inventory.md index 648679484990..2b6bdde9dcd4 100644 --- a/doc/GeneratorMigration/Library_Inventory.md +++ b/doc/GeneratorMigration/Library_Inventory.md @@ -19,8 +19,8 @@ - Old TypeSpec: 40 - Data Plane (DPG): 171 - Autorest/Swagger: 86 - - New Emitter (TypeSpec): 19 - - Old TypeSpec: 17 + - New Emitter (TypeSpec): 20 + - Old TypeSpec: 16 - No generator: 49 @@ -28,7 +28,7 @@ Libraries that provide client APIs for Azure services and have been migrated to the new TypeSpec emitter. -**Migration Status**: 19 / 36 (52.8%) +**Migration Status**: 20 / 36 (55.6%) | Service | Library | New Emitter | | ------- | ------- | ----------- | @@ -40,7 +40,7 @@ Libraries that provide client APIs for Azure services and have been migrated to | batch | Azure.Compute.Batch | | | cognitivelanguage | Azure.AI.Language.Conversations | | | cognitivelanguage | Azure.AI.Language.Conversations.Authoring | | -| cognitivelanguage | Azure.AI.Language.QuestionAnswering.Authoring | | +| cognitivelanguage | Azure.AI.Language.QuestionAnswering.Authoring | ✅ | | cognitivelanguage | Azure.AI.Language.QuestionAnswering.Inference | | | cognitivelanguage | Azure.AI.Language.Text | | | cognitivelanguage | Azure.AI.Language.Text.Authoring | |