From 64f1db21ebd1e9d80aaa9bf6f482eec0ad0cd3aa Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Wed, 7 Oct 2020 23:26:56 +0530 Subject: [PATCH 01/24] Swagger specs and examples for QnAMakerV5.0-preview.1 --- .../preview/v5.0-preview.1/QnAMaker.json | 1833 +++++++++++++++++ .../v5.0-preview.1/QnAMakerRuntime.json | 540 +++++ .../examples/SuccessfulCreateKb.json | 93 + .../examples/SuccessfulDelKb.json | 11 + .../examples/SuccessfulDownloadKb.json | 92 + .../examples/SuccessfulGenAns.json | 45 + .../examples/SuccessfulGetAlts.json | 34 + .../examples/SuccessfulGetEpKeys.json | 18 + .../examples/SuccessfulGetEpSettings.json | 17 + .../examples/SuccessfulGetKb.json | 30 + .../examples/SuccessfulGetOps.json | 21 + .../examples/SuccessfulKbsResponse.json | 33 + .../examples/SuccessfulPubKb.json | 11 + .../examples/SuccessfulRepKb.json | 38 + .../examples/SuccessfulSetAlts.json | 32 + .../examples/SuccessfulSetEpKeys.json | 19 + .../examples/SuccessfulSetEpSettings.json | 15 + .../examples/SuccessfulTrain.json | 20 + .../examples/SuccessfulUpdKb.json | 155 ++ 19 files changed, 3057 insertions(+) create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulCreateKb.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDelKb.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpKeys.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpSettings.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetKb.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetOps.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulKbsResponse.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulPubKb.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulRepKb.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpKeys.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpSettings.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulUpdKb.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json new file mode 100644 index 000000000000..10170f88e5d3 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -0,0 +1,1833 @@ +{ + "swagger": "2.0", + "info": { + "version": "v5.0-preview.1", + "title": "QnAMaker Client", + "description": "An API for QnAMaker Service" + }, + "securityDefinitions": { + "apim_key": { + "type": "apiKey", + "name": "Ocp-Apim-Subscription-Key", + "in": "header" + } + }, + "security": [ + { + "apim_key": [] + } + ], + "x-ms-parameterized-host": { + "hostTemplate": "{Endpoint}/qnamaker/v5.0-preview.1", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + }, + "paths": { + "/endpointSettings": { + "get": { + "summary": "Gets endpoint settings for an endpoint.", + "operationId": "EndpointSettings_GetSettings", + "parameters": [], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Response with endpoint settings info in it.", + "schema": { + "$ref": "#/definitions/EndpointSettingsDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGetEpSettings.json" + } + } + }, + "patch": { + "tags": [ + "EndpointKeys" + ], + "summary": "Updates endpoint settings for an endpoint.", + "operationId": "EndpointSettings_UpdateSettings", + "parameters": [ + { + "$ref": "#/parameters/EndpointSettingsPayload" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No Content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulSetEpSettings.json" + } + } + } + }, + "/endpointkeys": { + "get": { + "summary": "Gets endpoint keys for an endpoint", + "operationId": "EndpointKeys_GetKeys", + "parameters": [], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Response with endpoint info in it.", + "schema": { + "$ref": "#/definitions/EndpointKeysDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGetEpKeys.json" + } + } + } + }, + "/endpointkeys/{keyType}": { + "patch": { + "tags": [ + "EndpointKeys" + ], + "summary": "Re-generates an endpoint key.", + "operationId": "EndpointKeys_RefreshKeys", + "parameters": [ + { + "$ref": "#/parameters/KeyType" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Details of the endpoint keys generated.", + "schema": { + "$ref": "#/definitions/EndpointKeysDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulSetEpKeys.json" + } + } + } + }, + "/alterations/{kbId}": { + "get": { + "tags": [ + "Alterations" + ], + "summary": "Download alterations from runtime or use kbId parameter (for QnAMakerV2 resource only) to download alterations for a specific knowledgebase.", + "operationId": "Alterations_Get", + "parameters": [ + { + "schema": { + "$ref": "#/parameters/AlterationsKbId" + }, + "required": false, + "in": "path", + "name": "kbId" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Alterations data.", + "schema": { + "$ref": "#/definitions/WordAlterationsDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGetAlts.json" + } + } + }, + "put": { + "tags": [ + "Alterations" + ], + "summary": "Replace alterations data or use kbId parameter to replace alterations of a specific knowledgebase.", + "operationId": "Alterations_Replace", + "parameters": [ + { + "$ref": "#/parameters/AlterationsKbId" + }, + { + "$ref": "#/parameters/WordAlterations" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No Content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulSetAlts.json" + } + } + } + }, + "/knowledgebases": { + "get": { + "tags": [ + "Knowledgebases" + ], + "summary": "Gets all knowledgebases for a user.", + "operationId": "Knowledgebase_ListAll", + "parameters": [], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Collection of knowledgebases.", + "schema": { + "$ref": "#/definitions/KnowledgebasesDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulKbsResponse.json" + } + } + } + }, + "/operations/{operationId}": { + "get": { + "tags": [ + "Operations" + ], + "summary": "Gets details of a specific long running operation.", + "operationId": "Operations_GetDetails", + "parameters": [ + { + "$ref": "#/parameters/OperationId" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Details of the long running operation.", + "schema": { + "$ref": "#/definitions/Operation" + }, + "x-nullable": true, + "headers": { + "RetryAfter": { + "type": "integer", + "description": "Indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet." + } + } + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGetOps.json" + } + } + } + }, + "/knowledgebases/{kbId}": { + "get": { + "tags": [ + "Knowledgebases" + ], + "summary": "Gets details of a specific knowledgebase.", + "operationId": "Knowledgebase_GetDetails", + "parameters": [ + { + "$ref": "#/parameters/KbId" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Details of the knowledgebase.", + "schema": { + "$ref": "#/definitions/KnowledgebaseDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGetKb.json" + } + } + }, + "delete": { + "tags": [ + "Knowledgebases" + ], + "summary": "Deletes the knowledgebase and all its data.", + "operationId": "Knowledgebase_Delete", + "parameters": [ + { + "$ref": "#/parameters/KbId" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulDelKb.json" + } + } + }, + "post": { + "tags": [ + "Knowledgebases" + ], + "summary": "Publishes all changes in test index of a knowledgebase to its prod index.", + "operationId": "Knowledgebase_Publish", + "parameters": [ + { + "$ref": "#/parameters/KbId" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulPubKb.json" + } + } + }, + "put": { + "tags": [ + "Knowledgebases" + ], + "summary": "Replace knowledgebase contents.", + "operationId": "Knowledgebase_Replace", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/ReplaceKb" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulRepKb.json" + } + } + }, + "patch": { + "tags": [ + "Knowledgebases" + ], + "summary": "Asynchronous operation to modify a knowledgebase.", + "operationId": "Knowledgebase_Update", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/UpdateKb" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "202": { + "description": "Details of the asynchronous operation.", + "schema": { + "$ref": "#/definitions/Operation" + }, + "x-nullable": true, + "headers": { + "Location": { + "type": "string", + "description": "Relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation." + } + } + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulUpdKb.json" + } + } + } + }, + "/knowledgebases/create": { + "post": { + "tags": [ + "Knowledgebases" + ], + "summary": "Asynchronous operation to create a new knowledgebase.", + "operationId": "Knowledgebase_Create", + "parameters": [ + { + "$ref": "#/parameters/CreateKbPayload" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "202": { + "description": "Details of the asynchronous operation.", + "schema": { + "$ref": "#/definitions/Operation" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulCreateKb.json" + } + } + } + }, + "/knowledgebases/{kbId}/{environment}/qna": { + "get": { + "tags": [ + "Knowledgebases" + ], + "summary": "Download the knowledgebase.", + "operationId": "Knowledgebase_Download", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/Environment" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Collection of all Q-A in the knowledgebase.", + "schema": { + "$ref": "#/definitions/QnADocumentsDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulDownloadKb.json" + } + } + } + }, + "/knowledgebases/{kbId}/generateAnswer": { + "post": { + "tags": [ + "Knowledgebases" + ], + "summary": "GenerateAnswer call to query the knowledgebase created on QnAMaker V2 - Private Preview Azure Cognitive Service resource.", + "operationId": "Runtime_GenerateAnswer", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/GenerateAnswerPayload" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "GenerateAnswer call response.", + "schema": { + "$ref": "#/definitions/QnASearchResultList" + } + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGenAns.json" + } + } + } + }, + "/knowledgebases/{kbId}/train": { + "post": { + "tags": [ + "Knowledgebases" + ], + "summary": "Train call to add suggestions to the knowledgebase created on QnAMaker V2 - Private Preview Azure Cognitive Service resource.", + "operationId": "Runtime_Train", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/TrainPayload" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No Content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulTrain.json" + } + } + } + } + }, + "definitions": { + "UpdateKbOperationDTO": { + "type": "object", + "description": "Contains list of QnAs to be updated", + "additionalProperties": false, + "properties": { + "add": { + "description": "An instance of CreateKbInputDTO for add operation", + "allOf": [ + { + "$ref": "#/definitions/CreateKbInputDTO" + } + ] + }, + "delete": { + "description": "An instance of DeleteKbContentsDTO for delete Operation", + "allOf": [ + { + "$ref": "#/definitions/DeleteKbContentsDTO" + } + ] + }, + "update": { + "description": "An instance of UpdateKbContentsDTO for Update Operation", + "allOf": [ + { + "$ref": "#/definitions/UpdateKbContentsDTO" + } + ] + }, + "enableHierarchicalExtraction": { + "type": "boolean", + "description": "Enable hierarchical extraction of Q-A from files and urls. The value set during KB creation will be used if this field is not present." + }, + "defaultAnswerUsedForExtraction": { + "type": "string", + "description": "Text string to be used as the answer in any Q-A which has no extracted answer from the document but has a hierarchy. Required when EnableHierarchicalExtraction field is set to True.", + "maxLength": 300, + "minLength": 1 + } + } + }, + "UpdateKbContentsDTO": { + "type": "object", + "description": "PATCH body schema for Update operation in Update Kb", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "Friendly name for the knowledgebase." + }, + "qnaList": { + "type": "array", + "description": "List of Q-A (UpdateQnaDTO) to be added to the knowledgebase.", + "items": { + "$ref": "#/definitions/UpdateQnaDTO" + } + }, + "urls": { + "type": "array", + "description": "List of existing URLs to be refreshed. The content will be extracted again and re-indexed.", + "maxLength": 10, + "items": { + "type": "string" + } + } + } + }, + "UpdateQnaDTO": { + "type": "object", + "description": "PATCH Body schema for Update Qna List", + "additionalProperties": false, + "properties": { + "id": { + "type": "integer", + "description": "Unique id for the Q-A", + "format": "int32", + "maximum": 2147483647, + "minimum": 0 + }, + "answer": { + "type": "string", + "description": "Answer text" + }, + "source": { + "type": "string", + "description": "Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs", + "maxLength": 300 + }, + "questions": { + "description": "List of questions associated with the answer.", + "allOf": [ + { + "$ref": "#/definitions/UpdateQuestionsDTO" + } + ] + }, + "metadata": { + "description": "List of metadata associated with the answer to be updated", + "allOf": [ + { + "$ref": "#/definitions/UpdateMetadataDTO" + } + ] + }, + "context": { + "description": "Context associated with Qna to be updated.", + "allOf": [ + { + "$ref": "#/definitions/UpdateContextDTO" + } + ] + } + } + }, + "UpdateQuestionsDTO": { + "type": "object", + "description": "PATCH Body schema for Update Kb which contains list of questions to be added and deleted", + "additionalProperties": false, + "properties": { + "add": { + "type": "array", + "description": "List of questions to be added", + "maxLength": 100, + "items": { + "type": "string" + } + }, + "delete": { + "type": "array", + "description": "List of questions to be deleted.", + "maxLength": 100, + "items": { + "type": "string" + } + } + } + }, + "UpdateMetadataDTO": { + "type": "object", + "description": "PATCH Body schema to represent list of Metadata to be updated", + "additionalProperties": false, + "properties": { + "delete": { + "type": "array", + "description": "List of Metadata associated with answer to be deleted", + "maxLength": 100, + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "add": { + "type": "array", + "description": "List of metadata associated with answer to be added", + "maxLength": 100, + "items": { + "$ref": "#/definitions/MetadataDTO" + } + } + } + }, + "UpdateContextDTO": { + "type": "object", + "description": "Update Body schema to represent context to be updated", + "properties": { + "promptsToDelete": { + "type": "array", + "description": "List of prompts associated with qna to be deleted", + "items": { + "type": "integer", + "format": "int32" + } + }, + "promptsToAdd": { + "type": "array", + "description": "List of prompts to be added to the qna.", + "items": { + "$ref": "#/definitions/PromptDTO" + } + }, + "isContextOnly": { + "type": "boolean", + "description": "To mark if a prompt is relevant only with a previous question or not.\ntrue - Do not include this QnA as search result for queries without context\nfalse - ignores context and includes this QnA in search result" + } + } + }, + "DeleteKbContentsDTO": { + "type": "object", + "description": "PATCH body schema of Delete Operation in UpdateKb", + "additionalProperties": false, + "properties": { + "ids": { + "type": "array", + "description": "List of Qna Ids to be deleted", + "items": { + "type": "integer", + "format": "int32" + } + }, + "sources": { + "type": "array", + "description": "List of sources to be deleted from knowledgebase.", + "maxLength": 300, + "minLength": 1, + "items": { + "type": "string" + } + } + } + }, + "CreateKbInputDTO": { + "type": "object", + "description": "Input to create KB.", + "additionalProperties": false, + "properties": { + "qnaList": { + "type": "array", + "description": "List of QNA to be added to the index. Ids are generated by the service and should be omitted.", + "items": { + "$ref": "#/definitions/QnADTO" + } + }, + "urls": { + "type": "array", + "description": "List of URLs to be added to knowledgebase.", + "maxLength": 10, + "items": { + "type": "string" + } + }, + "files": { + "type": "array", + "description": "List of files to be added to knowledgebase.", + "maxLength": 10, + "items": { + "$ref": "#/definitions/FileDTO" + } + } + } + }, + "QnADocumentsDTO": { + "type": "object", + "description": "List of QnADTO", + "additionalProperties": false, + "properties": { + "qnaDocuments": { + "type": "array", + "description": "List of answers.", + "items": { + "$ref": "#/definitions/QnADTO" + } + } + } + }, + "CreateKbDTO": { + "type": "object", + "description": "Post body schema for CreateKb operation.", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Friendly name for the knowledgebase.", + "maxLength": 100, + "minLength": 1 + }, + "qnaList": { + "type": "array", + "description": "List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted.", + "maxLength": 1000, + "items": { + "$ref": "#/definitions/QnADTO" + } + }, + "urls": { + "type": "array", + "description": "List of URLs to be used for extracting Q-A.", + "maxLength": 10, + "items": { + "type": "string" + } + }, + "files": { + "type": "array", + "description": "List of files from which to Extract Q-A.", + "maxLength": 10, + "items": { + "$ref": "#/definitions/FileDTO" + } + }, + "enableHierarchicalExtraction": { + "type": "boolean", + "description": "Enable hierarchical extraction of Q-A from files and urls. Value to be considered False if this field is not present." + }, + "defaultAnswerUsedForExtraction": { + "type": "string", + "description": "Text string to be used as the answer in any Q-A which has no extracted answer from the document but has a hierarchy. Required when EnableHierarchicalExtraction field is set to True.", + "maxLength": 300, + "minLength": 1 + }, + "language": { + "type": "string", + "description": "Language of the knowledgebase. Please find the list of supported languages here.", + "maxLength": 100, + "minLength": 1 + } + } + }, + "FileDTO": { + "type": "object", + "description": "DTO to hold details of uploaded files.", + "additionalProperties": false, + "required": [ + "fileName", + "fileUri" + ], + "properties": { + "fileName": { + "type": "string", + "description": "File name. Supported file types are \".tsv\", \".pdf\", \".txt\", \".docx\", \".xlsx\".", + "maxLength": 200, + "minLength": 1 + }, + "fileUri": { + "type": "string", + "description": "Public URI of the file." + } + } + }, + "ReplaceKbDTO": { + "type": "object", + "description": "Post body schema for Replace KB operation.", + "additionalProperties": false, + "required": [ + "qnAList" + ], + "properties": { + "qnAList": { + "type": "array", + "description": "List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted.", + "items": { + "$ref": "#/definitions/QnADTO" + } + } + } + }, + "QnADTO": { + "type": "object", + "description": "Q-A object.", + "additionalProperties": false, + "required": [ + "answer", + "questions" + ], + "properties": { + "id": { + "type": "integer", + "description": "Unique id for the Q-A.", + "format": "int32" + }, + "answer": { + "type": "string", + "description": "Answer text", + "maxLength": 25000, + "minLength": 1 + }, + "source": { + "type": "string", + "description": "Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs", + "maxLength": 300 + }, + "questions": { + "type": "array", + "description": "List of questions associated with the answer.", + "maxLength": 100, + "minLength": 1, + "items": { + "type": "string" + } + }, + "metadata": { + "type": "array", + "description": "List of metadata associated with the answer.", + "maxLength": 10, + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "context": { + "description": "Context of a QnA", + "allOf": [ + { + "$ref": "#/definitions/ContextDTO" + } + ] + } + } + }, + "ContextDTO": { + "type": "object", + "description": "Context associated with Qna.", + "properties": { + "isContextOnly": { + "type": "boolean", + "description": "To mark if a prompt is relevant only with a previous question or not.\ntrue - Do not include this QnA as search result for queries without context\nfalse - ignores context and includes this QnA in search result" + }, + "prompts": { + "type": "array", + "description": "List of prompts associated with the answer.", + "maxItems": 20, + "items": { + "$ref": "#/definitions/PromptDTO" + } + } + } + }, + "PromptDTO": { + "type": "object", + "description": "Prompt for an answer.", + "properties": { + "displayOrder": { + "type": "integer", + "description": "Index of the prompt - used in ordering of the prompts", + "format": "int32" + }, + "qnaId": { + "type": "integer", + "description": "Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.", + "format": "int32" + }, + "qna": { + "description": "QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object", + "allOf": [ + { + "$ref": "#/definitions/QnADTO" + } + ] + }, + "displayText": { + "type": "string", + "description": "Text displayed to represent a follow up question prompt", + "maxLength": 200 + } + } + }, + "MetadataDTO": { + "type": "object", + "description": "Name - value pair of metadata.", + "additionalProperties": false, + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string", + "description": "Metadata name.", + "maxLength": 100, + "minLength": 1 + }, + "value": { + "type": "string", + "description": "Metadata value.", + "maxLength": 500, + "minLength": 1 + } + } + }, + "ErrorResponse": { + "type": "object", + "description": "Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "additionalProperties": false, + "properties": { + "error": { + "description": "The error object.", + "allOf": [ + { + "$ref": "#/definitions/Error" + } + ] + } + } + }, + "Error": { + "type": "object", + "description": "The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "additionalProperties": false, + "required": [ + "code" + ], + "properties": { + "code": { + "description": "One of a server-defined set of error codes.", + "$ref": "#/definitions/ErrorCode" + }, + "message": { + "type": "string", + "description": "A human-readable representation of the error." + }, + "target": { + "type": "string", + "description": "The target of the error." + }, + "details": { + "type": "array", + "description": "An array of details about specific errors that led to this reported error.", + "items": { + "$ref": "#/definitions/Error" + } + }, + "innerError": { + "description": "An object containing more specific information than the current object about the error.", + "$ref": "#/definitions/InnerErrorModel" + } + } + }, + "ErrorCode": { + "type": "string", + "description": "Human readable error code.", + "x-ms-enum": { + "name": "ErrorCodeType", + "modelAsString": true + }, + "enum": [ + "BadArgument", + "Forbidden", + "NotFound", + "KbNotFound", + "Unauthorized", + "Unspecified", + "EndpointKeysError", + "QuotaExceeded", + "QnaRuntimeError", + "SKULimitExceeded", + "OperationNotFound", + "ServiceError", + "ValidationFailure", + "ExtractionFailure" + ] + }, + "InnerErrorModel": { + "type": "object", + "description": "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.", + "additionalProperties": false, + "properties": { + "code": { + "type": "string", + "description": "A more specific error code than was provided by the containing error." + }, + "innerError": { + "description": "An object containing more specific information than the current object about the error.", + "$ref": "#/definitions/InnerErrorModel" + } + } + }, + "Operation": { + "type": "object", + "description": "Record to track long running operation.", + "additionalProperties": false, + "properties": { + "operationState": { + "description": "Operation state.", + "$ref": "#/definitions/OperationState" + }, + "createdTimestamp": { + "type": "string", + "description": "Timestamp when the operation was created." + }, + "lastActionTimestamp": { + "type": "string", + "description": "Timestamp when the current state was entered." + }, + "resourceLocation": { + "type": "string", + "description": "Relative URI to the target resource location for completed resources." + }, + "userId": { + "type": "string", + "description": "User Id" + }, + "operationId": { + "type": "string", + "description": "Operation Id." + }, + "errorResponse": { + "description": "Error details in case of failures.", + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "OperationState": { + "type": "string", + "description": "Enumeration of operation states.", + "x-ms-enum": { + "name": "OperationStateType", + "modelAsString": true + }, + "enum": [ + "Failed", + "NotStarted", + "Running", + "Succeeded" + ] + }, + "KnowledgebasesDTO": { + "type": "object", + "description": "Collection of knowledgebases owned by a user.", + "additionalProperties": false, + "properties": { + "knowledgebases": { + "type": "array", + "description": "Collection of knowledgebase records.", + "items": { + "$ref": "#/definitions/KnowledgebaseDTO" + } + } + } + }, + "KnowledgebaseDTO": { + "type": "object", + "description": "Response schema for CreateKb operation.", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Unique id that identifies a knowledgebase." + }, + "hostName": { + "type": "string", + "description": "URL host name at which the knowledgebase is hosted." + }, + "lastAccessedTimestamp": { + "type": "string", + "description": "Time stamp at which the knowledgebase was last accessed (UTC)." + }, + "lastChangedTimestamp": { + "type": "string", + "description": "Time stamp at which the knowledgebase was last modified (UTC)." + }, + "lastPublishedTimestamp": { + "type": "string", + "description": "Time stamp at which the knowledgebase was last published (UTC)." + }, + "name": { + "type": "string", + "description": "Friendly name of the knowledgebase." + }, + "userId": { + "type": "string", + "description": "User who created / owns the knowledgebase." + }, + "urls": { + "type": "array", + "description": "URL sources from which Q-A were extracted and added to the knowledgebase.", + "items": { + "type": "string" + } + }, + "sources": { + "type": "array", + "description": "Custom sources from which Q-A were extracted or explicitly added to the knowledgebase.", + "items": { + "type": "string" + } + } + } + }, + "EndpointSettingsDTO": { + "type": "object", + "description": "Endpoint settings.", + "additionalProperties": false, + "properties": { + "activeLearning": { + "description": "Active Learning settings of the endpoint.", + "allOf": [ + { + "$ref": "#/definitions/ActiveLearningSettingsDTO" + } + ] + } + } + }, + "ActiveLearningSettingsDTO": { + "type": "object", + "description": "Active Learning settings of the endpoint.", + "additionalProperties": false, + "properties": { + "enable": { + "type": "string", + "description": "True/False string providing Active Learning" + } + } + }, + "WordAlterationsDTO": { + "type": "object", + "description": "Collection of word alterations.", + "additionalProperties": false, + "required": [ + "wordAlterations" + ], + "properties": { + "wordAlterations": { + "type": "array", + "description": "Collection of word alterations.", + "maxLength": 10000, + "items": { + "$ref": "#/definitions/AlterationsDTO" + } + } + } + }, + "AlterationsDTO": { + "type": "object", + "description": "Collection of words that are synonyms.", + "additionalProperties": false, + "required": [ + "alterations" + ], + "properties": { + "alterations": { + "type": "array", + "description": "Words that are synonymous with each other.", + "maxLength": 20, + "minLength": 1, + "items": { + "type": "string" + } + } + } + }, + "EndpointKeysDTO": { + "type": "object", + "description": "Schema for EndpointKeys generate/refresh operations.", + "additionalProperties": false, + "properties": { + "primaryEndpointKey": { + "type": "string", + "description": "Primary Access Key." + }, + "secondaryEndpointKey": { + "type": "string", + "description": "Secondary Access Key." + }, + "installedVersion": { + "type": "string", + "description": "Current version of runtime." + }, + "lastStableVersion": { + "type": "string", + "description": "Latest version of runtime." + }, + "language": { + "type": "string", + "description": "Language setting of runtime." + } + } + }, + "QueryDTO": { + "type": "object", + "description": "POST body schema to query the knowledgebase.", + "additionalProperties": false, + "properties": { + "qnaId": { + "type": "string", + "description": "Exact qnaId to fetch from the knowledgebase, this field takes priority over question." + }, + "question": { + "type": "string", + "description": "User question to query against the knowledge base." + }, + "top": { + "type": "integer", + "description": "Max number of answers to be returned for the question.", + "format": "int32" + }, + "userId": { + "type": "string", + "description": "Unique identifier for the user." + }, + "isTest": { + "type": "boolean", + "description": "Query against the test index." + }, + "scoreThreshold": { + "type": "number", + "description": "Threshold for answers returned based on score." + }, + "context": { + "description": "Context object with previous QnA's information.", + "allOf": [ + { + "$ref": "#/definitions/QueryContextDTO" + } + ] + }, + "rankerType": { + "type": "string", + "description": "Optional field. Set to 'QuestionOnly' for using a question only Ranker." + }, + "strictFilters": { + "type": "array", + "description": "Find only answers that contain these metadata.", + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "strictFiltersCompoundOperationType": { + "type": "string", + "description": "Optional field. Set to for using OR as Operation for Strict Filters.", + "x-ms-enum": { + "name": "StrictFiltersCompoundOperationType", + "modelAsString": true + }, + "enum": [ + "AND", + "OR" + ] + }, + "answerSpanRequest": { + "description": "To enable/configure answer span prediction.", + "allOf": [ + { + "$ref": "#/definitions/AnswerSpanRequestDTO" + } + ] + } + } + }, + "QueryContextDTO": { + "type": "object", + "description": "Context object with previous QnA's information.", + "additionalProperties": false, + "properties": { + "previousQnaId": { + "type": "string", + "description": "Previous QnA Id - qnaId of the top result." + }, + "previousUserQuery": { + "type": "string", + "description": "Previous user query." + } + } + }, + "QnASearchResultList": { + "type": "object", + "description": "Represents List of Question Answers.", + "additionalProperties": false, + "properties": { + "answers": { + "type": "array", + "description": "Represents Search Result list.", + "items": { + "$ref": "#/definitions/QnASearchResult" + } + } + } + }, + "QnASearchResult": { + "type": "object", + "description": "Represents Search Result.", + "additionalProperties": false, + "properties": { + "questions": { + "type": "array", + "description": "List of questions.", + "items": { + "type": "string" + } + }, + "answer": { + "type": "string", + "description": "Answer." + }, + "score": { + "type": "number", + "description": "Search result score." + }, + "id": { + "type": "integer", + "description": "Id of the QnA result.", + "format": "int32" + }, + "source": { + "type": "string", + "description": "Source of QnA result." + }, + "metadata": { + "type": "array", + "description": "List of metadata.", + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "context": { + "type": "object", + "description": "Context object of the QnA", + "allOf": [ + { + "$ref": "#/definitions/ContextDTO" + } + ] + }, + "answerSpan": { + "type": "object", + "description": "Answer span object of QnA with respect to user's question.", + "allOf": [ + { + "$ref": "#/definitions/AnswerSpanResponseDTO" + } + ] + } + } + }, + "FeedbackRecordsDTO": { + "type": "object", + "description": "Active learning feedback records.", + "additionalProperties": false, + "properties": { + "feedbackRecords": { + "type": "array", + "description": "List of feedback records.", + "maxLength": 1000, + "items": { + "$ref": "#/definitions/FeedbackRecordDTO" + } + } + } + }, + "FeedbackRecordDTO": { + "type": "object", + "description": "Active learning feedback record.", + "additionalProperties": false, + "properties": { + "userId": { + "type": "string", + "description": "Unique identifier for the user." + }, + "userQuestion": { + "type": "string", + "description": "The suggested question being provided as feedback.", + "maxLength": 1000 + }, + "qnaId": { + "type": "integer", + "description": "The qnaId for which the suggested question is provided as feedback.", + "format": "int32" + } + } + }, + "AnswerSpanRequestDTO": { + "type": "object", + "description": "To use Answer Span prediction feature.", + "additionalProperties": false, + "properties": { + "enable": { + "type": "boolean", + "description": "To enable Answer Span prediction feature." + }, + "scoreThreshold": { + "type": "number", + "format": "double", + "description": "Threshold for answer returned based on score." + }, + "topAnswersWithSpan": { + "type": "integer", + "description": "Number of top answers where span needs to be predicted.", + "format": "int32", + "maximum": 10, + "minimum": 1 + } + } + }, + "AnswerSpanResponseDTO": { + "type": "object", + "description": "Answer span object of QnA.", + "additionalProperties": false, + "properties": { + "text": { + "type": "string", + "description": "Predicted text of answer span." + }, + "score": { + "type": "integer", + "description": "Predicted score of answer span.", + "format":"int32" + }, + "startIndex": { + "type": "integer", + "description": "Start index of answer span in answer.", + "format":"int32" + }, + "endIndex": { + "type": "integer", + "description": "End index of answer span in answer.", + "format":"int32" + } + } + } + }, + "parameters": { + "Environment": { + "type": "string", + "name": "environment", + "in": "path", + "required": true, + "x-nullable": false, + "description": "Specifies whether environment is Test or Prod.", + "x-ms-enum": { + "name": "EnvironmentType", + "modelAsString": true + }, + "enum": [ + "Prod", + "Test" + ], + "x-ms-parameter-location": "method" + }, + "CreateKbPayload": { + "name": "createKbPayload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateKbDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + }, + "UpdateKb": { + "name": "updateKb", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UpdateKbOperationDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + }, + "ReplaceKb": { + "name": "replaceKb", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReplaceKbDTO" + }, + "x-nullable": true, + "description": "An instance of ReplaceKbDTO which contains list of qnas to be uploaded", + "x-ms-parameter-location": "method" + }, + "KbId": { + "type": "string", + "name": "kbId", + "in": "path", + "required": true, + "x-nullable": false, + "description": "Knowledgebase id.", + "x-ms-parameter-location": "method" + }, + "AlterationsKbId": { + "type": "string", + "name": "kbId", + "in": "path", + "required": false, + "x-nullable": false, + "description": "Knowledgebase id. This parameter is required for alterations operations on QnAMakerV2 resources.", + "x-ms-parameter-location": "method" + }, + "OperationId": { + "type": "string", + "name": "operationId", + "in": "path", + "required": true, + "x-nullable": false, + "description": "Operation id.", + "x-ms-parameter-location": "method" + }, + "WordAlterations": { + "name": "wordAlterations", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WordAlterationsDTO" + }, + "x-nullable": true, + "description": "New alterations data.", + "x-ms-parameter-location": "method" + }, + "KeyType": { + "type": "string", + "name": "keyType", + "in": "path", + "required": true, + "x-nullable": false, + "description": "Type of Key", + "x-ms-parameter-location": "method" + }, + "GenerateAnswerPayload": { + "name": "generateAnswerPayload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/QueryDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + }, + "TrainPayload": { + "name": "trainPayload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/FeedbackRecordsDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + }, + "Endpoint": { + "name": "Endpoint", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://.api.cognitive.microsoft.com).", + "x-ms-parameter-location": "client", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true + }, + "EndpointSettingsPayload": { + "name": "endpointSettingsPayload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/EndpointSettingsDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json new file mode 100644 index 000000000000..7149aeabb993 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json @@ -0,0 +1,540 @@ +{ + "swagger": "2.0", + "info": { + "version": "v5.0-preview.1", + "title": "QnAMaker Runtime Client", + "description": "An API for QnAMaker runtime" + }, + "securityDefinitions": { + "auth_key": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + }, + "security": [ + { + "auth_key": [] + } + ], + "x-ms-parameterized-host": { + "hostTemplate": "{RuntimeEndpoint}/qnamaker", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/RuntimeEndpoint" + } + ] + }, + "paths": { + "/knowledgebases/{kbId}/generateAnswer": { + "post": { + "tags": [ + "Knowledgebases" + ], + "summary": "GenerateAnswer call to query the knowledgebase.", + "operationId": "Runtime_GenerateAnswer", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/GenerateAnswerPayload" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "GenerateAnswer call response.", + "schema": { + "$ref": "#/definitions/QnASearchResultList" + } + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGenAns.json" + } + } + } + }, + "/knowledgebases/{kbId}/train": { + "post": { + "tags": [ + "Knowledgebases" + ], + "summary": "Train call to add suggestions to the knowledgebase.", + "operationId": "Runtime_Train", + "parameters": [ + { + "$ref": "#/parameters/KbId" + }, + { + "$ref": "#/parameters/TrainPayload" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No Content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulTrain.json" + } + } + } + } + }, + "definitions": { + "QnADTO": { + "type": "object", + "description": "Q-A object.", + "additionalProperties": false, + "required": [ + "answer", + "questions" + ], + "properties": { + "id": { + "type": "integer", + "description": "Unique id for the Q-A.", + "format": "int32" + }, + "answer": { + "type": "string", + "description": "Answer text", + "maxLength": 25000, + "minLength": 1 + }, + "source": { + "type": "string", + "description": "Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs", + "maxLength": 300 + }, + "questions": { + "type": "array", + "description": "List of questions associated with the answer.", + "maxLength": 100, + "minLength": 1, + "items": { + "type": "string" + } + }, + "metadata": { + "type": "array", + "description": "List of metadata associated with the answer.", + "maxLength": 10, + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "context": { + "description": "Context of a QnA", + "allOf": [ + { + "$ref": "#/definitions/ContextDTO" + } + ] + } + } + }, + "ContextDTO": { + "type": "object", + "description": "Context associated with Qna.", + "properties": { + "isContextOnly": { + "type": "boolean", + "description": "To mark if a prompt is relevant only with a previous question or not.\ntrue - Do not include this QnA as search result for queries without context\nfalse - ignores context and includes this QnA in search result" + }, + "prompts": { + "type": "array", + "description": "List of prompts associated with the answer.", + "maxItems": 20, + "items": { + "$ref": "#/definitions/PromptDTO" + } + } + } + }, + "PromptDTO": { + "type": "object", + "description": "Prompt for an answer.", + "properties": { + "displayOrder": { + "type": "integer", + "description": "Index of the prompt - used in ordering of the prompts", + "format": "int32" + }, + "qnaId": { + "type": "integer", + "description": "Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.", + "format": "int32" + }, + "qna": { + "description": "QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object", + "allOf": [ + { + "$ref": "#/definitions/QnADTO" + } + ] + }, + "displayText": { + "type": "string", + "description": "Text displayed to represent a follow up question prompt", + "maxLength": 200 + } + } + }, + "MetadataDTO": { + "type": "object", + "description": "Name - value pair of metadata.", + "additionalProperties": false, + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string", + "description": "Metadata name.", + "maxLength": 100, + "minLength": 1 + }, + "value": { + "type": "string", + "description": "Metadata value.", + "maxLength": 500, + "minLength": 1 + } + } + }, + "ErrorResponse": { + "type": "object", + "description": "Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "additionalProperties": false, + "properties": { + "error": { + "description": "The error object.", + "allOf": [ + { + "$ref": "#/definitions/Error" + } + ] + } + } + }, + "Error": { + "type": "object", + "description": "The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "additionalProperties": false, + "required": [ + "code" + ], + "properties": { + "code": { + "description": "One of a server-defined set of error codes.", + "$ref": "#/definitions/ErrorCode" + }, + "message": { + "type": "string", + "description": "A human-readable representation of the error." + }, + "target": { + "type": "string", + "description": "The target of the error." + }, + "details": { + "type": "array", + "description": "An array of details about specific errors that led to this reported error.", + "items": { + "$ref": "#/definitions/Error" + } + }, + "innerError": { + "description": "An object containing more specific information than the current object about the error.", + "$ref": "#/definitions/InnerErrorModel" + } + } + }, + "ErrorCode": { + "type": "string", + "description": "Human readable error code.", + "x-ms-enum": { + "name": "ErrorCodeType", + "modelAsString": true + }, + "enum": [ + "BadArgument", + "Forbidden", + "NotFound", + "KbNotFound", + "Unauthorized", + "Unspecified", + "EndpointKeysError", + "QuotaExceeded", + "QnaRuntimeError", + "SKULimitExceeded", + "OperationNotFound", + "ServiceError", + "ValidationFailure", + "ExtractionFailure" + ] + }, + "InnerErrorModel": { + "type": "object", + "description": "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.", + "additionalProperties": false, + "properties": { + "code": { + "type": "string", + "description": "A more specific error code than was provided by the containing error." + }, + "innerError": { + "description": "An object containing more specific information than the current object about the error.", + "$ref": "#/definitions/InnerErrorModel" + } + } + }, + "QueryDTO": { + "type": "object", + "description": "POST body schema to query the knowledgebase.", + "additionalProperties": false, + "properties": { + "qnaId": { + "type": "string", + "description": "Exact qnaId to fetch from the knowledgebase, this field takes priority over question." + }, + "question": { + "type": "string", + "description": "User question to query against the knowledge base." + }, + "top": { + "type": "integer", + "description": "Max number of answers to be returned for the question.", + "format": "int32" + }, + "userId": { + "type": "string", + "description": "Unique identifier for the user. Optional parameter for telemetry. For more information, refer Analytics and Telemetry." + }, + "isTest": { + "type": "boolean", + "description": "Query against the test index." + }, + "scoreThreshold": { + "type": "number", + "description": "Threshold for answers returned based on score." + }, + "context": { + "description": "Context object with previous QnA's information.", + "allOf": [ + { + "$ref": "#/definitions/QueryContextDTO" + } + ] + }, + "rankerType": { + "type": "string", + "description": "Optional field. Set to 'QuestionOnly' for using a question only Ranker." + }, + "strictFilters": { + "type": "array", + "description": "Find only answers that contain these metadata.", + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "strictFiltersCompoundOperationType": { + "type": "string", + "description": "Optional field. Set to OR for using OR as Operation for Strict Filters.", + "x-ms-enum": { + "name": "StrictFiltersCompoundOperationType", + "modelAsString": true + }, + "enum": [ + "AND", + "OR" + ] + } + } + }, + "QueryContextDTO": { + "type": "object", + "description": "Context object with previous QnA's information.", + "additionalProperties": false, + "properties": { + "previousQnaId": { + "type": "string", + "description": "Previous QnA Id - qnaId of the top result." + }, + "previousUserQuery": { + "type": "string", + "description": "Previous user query." + } + } + }, + "QnASearchResultList": { + "type": "object", + "description": "Represents List of Question Answers.", + "additionalProperties": false, + "properties": { + "answers": { + "type": "array", + "description": "Represents Search Result list.", + "items": { + "$ref": "#/definitions/QnASearchResult" + } + } + } + }, + "QnASearchResult": { + "type": "object", + "description": "Represents Search Result.", + "additionalProperties": false, + "properties": { + "questions": { + "type": "array", + "description": "List of questions.", + "items": { + "type": "string" + } + }, + "answer": { + "type": "string", + "description": "Answer." + }, + "score": { + "type": "number", + "description": "Search result score." + }, + "id": { + "type": "integer", + "description": "Id of the QnA result.", + "format": "int32" + }, + "source": { + "type": "string", + "description": "Source of QnA result." + }, + "metadata": { + "type": "array", + "description": "List of metadata.", + "items": { + "$ref": "#/definitions/MetadataDTO" + } + }, + "context": { + "type": "object", + "description": "Context object of the QnA", + "allOf": [ + { + "$ref": "#/definitions/ContextDTO" + } + ] + } + } + }, + "FeedbackRecordsDTO": { + "type": "object", + "description": "Active learning feedback records.", + "additionalProperties": false, + "properties": { + "feedbackRecords": { + "type": "array", + "description": "List of feedback records.", + "maxLength": 1000, + "items": { + "$ref": "#/definitions/FeedbackRecordDTO" + } + } + } + }, + "FeedbackRecordDTO": { + "type": "object", + "description": "Active learning feedback record.", + "additionalProperties": false, + "properties": { + "userId": { + "type": "string", + "description": "Unique identifier for the user." + }, + "userQuestion": { + "type": "string", + "description": "The suggested question being provided as feedback.", + "maxLength": 1000 + }, + "qnaId": { + "type": "integer", + "description": "The qnaId for which the suggested question is provided as feedback.", + "format": "int32" + } + } + } + }, + "parameters": { + "KbId": { + "type": "string", + "name": "kbId", + "in": "path", + "required": true, + "x-nullable": false, + "description": "Knowledgebase id.", + "x-ms-parameter-location": "method" + }, + "RuntimeEndpoint": { + "name": "RuntimeEndpoint", + "description": "QnA Maker App Service endpoint (for example: https://{qnaservice-hostname}.azurewebsites.net).", + "x-ms-parameter-location": "client", + "required": true, + "type": "string", + "in": "path", + "x-ms-skip-url-encoding": true + }, + "GenerateAnswerPayload": { + "name": "generateAnswerPayload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/QueryDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + }, + "TrainPayload": { + "name": "trainPayload", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/FeedbackRecordsDTO" + }, + "x-nullable": true, + "description": "Post body of the request.", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulCreateKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulCreateKb.json new file mode 100644 index 000000000000..2f0bc8e9ee82 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulCreateKb.json @@ -0,0 +1,93 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "createKbPayload": { + "name": "QnA Maker FAQ", + "qnaList": [ + { + "id": 0, + "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle", + "source": "Custom Editorial", + "questions": [ + "How can I change the default message from QnA Maker?" + ], + "metadata": [] + }, + { + "id": 0, + "answer": "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create", + "source": "Custom Editorial", + "questions": [ + "How do I programmatically create a KB?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ], + "context": { + "isContextOnly": false, + "prompts": [ + { + "displayOrder": 1, + "displayText": "Update KB", + "qna": { + "answer": "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update", + "questions": [ + "How do I programmatically update my KB?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ], + "context": { + "isContextOnly": false, + "prompts": [ + { + "displayOrder": 1, + "displayText": "Refresh Endpoint Keys", + "qna": { + "answer": "You can use our REST apis to refresh endpoint keys. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/endpointkeys/refreshkeys", + "questions": [ + "How do I programmatically refresh endpoint keys?" + ] + } + } + ] + } + } + } + ] + } + } + ], + "urls": [ + "https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs", + "https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq" + ], + "files": [ + { + "fileName": "SurfaceManual.pdf", + "fileUri": "https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf" + } + ] + } + }, + "responses": { + "202": { + "headers": {}, + "body": { + "operationState": "NotStarted", + "createdTimestamp": "2018-03-19T07:38:46Z", + "lastActionTimestamp": "2018-03-19T07:39:29Z", + "userId": "86bb8390-56c0-42c2-9f81-3de161981191", + "operationId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDelKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDelKb.json new file mode 100644 index 000000000000..bcd50173c37b --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDelKb.json @@ -0,0 +1,11 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json new file mode 100644 index 000000000000..0413615b20ca --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json @@ -0,0 +1,92 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "environment": "Test" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "qnaDocuments": [ + { + "id": 1, + "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle", + "source": "Custom Editorial", + "questions": [ + "How can I change the default message from QnA Maker?" + ], + "metadata": [], + "context": { + "isContextOnly": false, + "prompts": [] + } + }, + { + "id": 2, + "answer": "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create", + "source": "Custom Editorial", + "questions": [ + "How do I programmatically create a KB?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ], + "context": { + "isContextOnly": false, + "prompts": [ + { + "displayOrder": 1, + "qnaId": 3, + "displayText": "Update KB" + } + ] + } + }, + { + "id": 3, + "answer": "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update", + "source": "Editorial", + "questions": [ + "How do I programmatically update my KB?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ], + "context": { + "isContextOnly": false, + "prompts": [ + { + "displayOrder": 1, + "qnaId": 4, + "displayText": "Refresh Endpoint Keys" + } + ] + } + }, + { + "id": 4, + "answer": "You can use our REST apis to refresh endpoint keys. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/endpointkeys/refreshkeys", + "source": "Editorial", + "questions": [ + "How do I programmatically refresh endpoint keys?" + ], + "metadata": [], + "context": { + "isContextOnly": false, + "prompts": [] + } + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json new file mode 100644 index 000000000000..63e0a9556c49 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "RuntimeEndpoint": "{RuntimeEndpoint}", + "Authorization": "EndpointKey {Primary/Secondary EndpointKey}", + "Content-Type": "application/json", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "generateAnswerPayload": { + "question": "qna maker and luis", + "top": 6, + "isTest": true, + "scoreThreshold": 20, + "strictFilters": [ + { + "name": "category", + "value": "api" + } + ], + "userId": "sd53lsY=" + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "answers": [ + { + "score": 28.54820341616869, + "id": 20, + "answer": "There is no direct integration of LUIS with QnA Maker. But, in your bot code, you can use LUIS and QnA Maker together.", + "source": "Custom Editorial", + "questions": [ + "How can I integrate LUIS with QnA Maker?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ] + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json new file mode 100644 index 000000000000..465b1152950e --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json @@ -0,0 +1,34 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "wordAlterations": [ + { + "alterations": [ + "qnamaker", + "qna maker" + ] + }, + { + "alterations": [ + "botframework", + "bot framework" + ] + }, + { + "alterations": [ + "webchat", + "web chat" + ] + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpKeys.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpKeys.json new file mode 100644 index 000000000000..a32d6baa42de --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpKeys.json @@ -0,0 +1,18 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "primaryEndpointKey": "73e88a14-694a-44d5-883b-184a68aa8530", + "secondaryEndpointKey": "b2c98c16-ca31-4294-8626-6c57454a5063", + "installedVersion": "4.0.5", + "lastStableVersion": "4.0.6" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpSettings.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpSettings.json new file mode 100644 index 000000000000..97cc7fcac360 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetEpSettings.json @@ -0,0 +1,17 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "activeLearning": { + "enable": "True" + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetKb.json new file mode 100644 index 000000000000..fbec604c70f5 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetKb.json @@ -0,0 +1,30 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "hostName": "https://myqnamakerbot.azurewebsites.net", + "lastAccessedTimestamp": "2018-03-16T10:59:46Z", + "lastChangedTimestamp": "2018-03-16T10:58:10Z", + "lastPublishedTimestamp": "2018-03-16T10:59:56Z", + "name": "My QnA Maker Bot", + "userId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1", + "urls": [ + "https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs", + "https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq" + ], + "sources": [ + "Custom Editorial", + "SurfaceManual.pdf" + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetOps.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetOps.json new file mode 100644 index 000000000000..85e84d90aed9 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetOps.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "operationId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "operationState": "Succeeded", + "createdTimestamp": "2018-03-19T07:38:46Z", + "lastActionTimestamp": "2018-03-19T07:39:29Z", + "resourceLocation": "https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "userId": "86bb8390-56c0-42c2-9f81-3de161981191", + "operationId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulKbsResponse.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulKbsResponse.json new file mode 100644 index 000000000000..aab19445e730 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulKbsResponse.json @@ -0,0 +1,33 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "knowledgebases": [ + { + "id": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "hostName": "https://myqnamakerbot.azurewebsites.net", + "lastAccessedTimestamp": "2018-03-16T10:59:46Z", + "lastChangedTimestamp": "2018-03-16T10:58:10Z", + "lastPublishedTimestamp": "2018-03-16T10:59:56Z", + "name": "My QnA Maker Bot", + "userId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1", + "urls": [ + "https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs", + "https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq" + ], + "sources": [ + "Custom Editorial", + "SurfaceManual.pdf" + ] + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulPubKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulPubKb.json new file mode 100644 index 000000000000..bcd50173c37b --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulPubKb.json @@ -0,0 +1,11 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff" + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulRepKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulRepKb.json new file mode 100644 index 000000000000..fd6ba1224539 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulRepKb.json @@ -0,0 +1,38 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "replaceKb": { + "qnAList": [ + { + "id": 0, + "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle", + "source": "Custom Editorial", + "questions": [ + "How can I change the default message from QnA Maker?" + ], + "metadata": [] + }, + { + "id": 0, + "answer": "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create", + "source": "Custom Editorial", + "questions": [ + "How do I programmatically create a KB?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ] + } + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json new file mode 100644 index 000000000000..ba8facefde92 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json @@ -0,0 +1,32 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "wordAlterations": { + "wordAlterations": [ + { + "alterations": [ + "qnamaker", + "qna maker" + ] + }, + { + "alterations": [ + "botframework", + "bot framework" + ] + }, + { + "alterations": [ + "webchat", + "web chat" + ] + } + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpKeys.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpKeys.json new file mode 100644 index 000000000000..925d4f65d77d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpKeys.json @@ -0,0 +1,19 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "keyType": "PrimaryKey" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "primaryEndpointKey": "73e88a14-694a-44d5-883b-184a68aa8530", + "secondaryEndpointKey": "b2c98c16-ca31-4294-8626-6c57454a5063", + "installedVersion": "4.0.5", + "lastStableVersion": "4.0.6" + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpSettings.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpSettings.json new file mode 100644 index 000000000000..468c0b59680a --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetEpSettings.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "endpointSettingsPayload": { + "activeLearning": { + "enable": "True" + } + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json new file mode 100644 index 000000000000..3448a4009b3d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json @@ -0,0 +1,20 @@ +{ + "parameters": { + "RuntimeEndpoint": "{RuntimeEndpoint}", + "Authorization": "EndpointKey {Primary/Secondary Endpoint Key}", + "Content-Type": "application/json", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "trainPayload": { + "feedbackRecords": [ + { + "userId": "sd53lsY=", + "userQuestion": "qna maker with luis", + "qnaId": 4 + } + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulUpdKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulUpdKb.json new file mode 100644 index 000000000000..3c717ca27123 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulUpdKb.json @@ -0,0 +1,155 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "updateKb": { + "add": { + "qnaList": [ + { + "id": 0, + "answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle", + "source": "Custom Editorial", + "questions": [ + "How can I change the default message from QnA Maker?" + ], + "metadata": [] + } + ], + "urls": [ + "https://docs.microsoft.com/en-us/azure/cognitive-services/Emotion/FAQ" + ], + "files": [ + { + "fileName": "SurfaceManual.pdf", + "fileUri": "https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf" + } + ] + }, + "delete": { + "ids": [ + 13, + 35 + ] + }, + "update": { + "name": "QnA Maker FAQ Prompts Bot", + "qnaList": [ + { + "id": 2, + "answer": "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create", + "source": "Custom Editorial", + "questions": { + "add": [], + "delete": [] + }, + "metadata": { + "add": [], + "delete": [] + }, + "context": { + "isContextOnly": false, + "promptsToAdd": [ + { + "displayText": "Add Prompts", + "displayOrder": 0, + "qna": { + "id": 0, + "answer": "Click here to know more https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation", + "source": "Editorial", + "questions": [ + "How can I add prompts?" + ], + "metadata": [], + "context": { + "isContextOnly": false, + "prompts": [] + } + }, + "qnaId": 0 + }, + { + "displayText": "Delete Prompts", + "displayOrder": 0, + "qna": { + "id": 0, + "answer": "Click here to know more https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation", + "source": "Editorial", + "questions": [ + "How can I delete delete prompts?" + ], + "metadata": [], + "context": { + "isContextOnly": false, + "prompts": [] + } + }, + "qnaId": 0 + }, + { + "displayText": "Update Knowledgebase", + "displayOrder": 0, + "qna": null, + "qnaId": 3 + } + ], + "promptsToDelete": [ + 3 + ] + } + }, + { + "id": 3, + "answer": "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update", + "source": "Custom Editorial", + "questions": { + "add": [], + "delete": [] + }, + "metadata": { + "delete": [ + { + "name": "category", + "value": "api" + } + ], + "add": [ + { + "name": "category", + "value": "programmatic" + } + ] + }, + "context": { + "isContextOnly": false, + "promptsToAdd": [ + { + "displayText": "Regenerate Endpoint keys", + "displayOrder": 1, + "qna": null, + "qnaId": 4 + } + ], + "promptsToDelete": [ + 4 + ] + } + } + ] + } + } + }, + "responses": { + "202": { + "headers": {}, + "body": { + "operationState": "NotStarted", + "createdTimestamp": "2018-03-19T07:38:46Z", + "lastActionTimestamp": "2018-03-19T07:39:29Z", + "userId": "86bb8390-56c0-42c2-9f81-3de161981191", + "operationId": "03a4f4ce-30a6-4ec6-b436-02bcdf6153e1" + } + } + } +} From 63ed1f804b6c1cb044661c1ca78630a241d17d80 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 00:27:46 +0530 Subject: [PATCH 02/24] examples and read me files --- .../src/Generated/Alterations.cs | 339 +++++ .../src/Generated/AlterationsExtensions.cs | 57 + .../src/Generated/EndpointKeys.cs | 351 +++++ .../src/Generated/EndpointKeysExtensions.cs | 60 + .../src/Generated/EndpointSettings.cs | 335 +++++ .../Generated/EndpointSettingsExtensions.cs | 57 + .../src/Generated/IAlterations.cs | 64 + .../src/Generated/IEndpointKeys.cs | 67 + .../src/Generated/IEndpointSettings.cs | 64 + .../src/Generated/IKnowledgebase.cs | 202 +++ .../src/Generated/IOperations.cs | 48 + .../src/Generated/IQnAMakerClient.cs | 75 + .../src/Generated/IQnAMakerRuntimeClient.cs | 55 + .../src/Generated/IRuntime.cs | 73 + .../src/Generated/Knowledgebase.cs | 1270 +++++++++++++++++ .../src/Generated/KnowledgebaseExtensions.cs | 181 +++ .../Models/ActiveLearningSettingsDTO.cs | 52 + .../src/Generated/Models/AlterationsDTO.cs | 68 + .../src/Generated/Models/ContextDTO.cs | 95 ++ .../src/Generated/Models/CreateKbDTO.cs | 187 +++ .../src/Generated/Models/CreateKbInputDTO.cs | 73 + .../Generated/Models/DeleteKbContentsDTO.cs | 62 + .../src/Generated/Models/EndpointKeysDTO.cs | 83 ++ .../Generated/Models/EndpointSettingsDTO.cs | 52 + .../EndpointSettingsDTOActiveLearning.cs | 47 + .../src/Generated/Models/EnvironmentType.cs | 22 + .../src/Generated/Models/Error.cs | 125 ++ .../src/Generated/Models/ErrorCodeType.cs | 34 + .../src/Generated/Models/ErrorResponse.cs | 52 + .../Generated/Models/ErrorResponseError.cs | 68 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/FeedbackRecordDTO.cs | 87 ++ .../Generated/Models/FeedbackRecordsDTO.cs | 53 + .../src/Generated/Models/FileDTO.cs | 90 ++ .../src/Generated/Models/InnerErrorModel.cs | 65 + .../src/Generated/Models/KnowledgebaseDTO.cs | 129 ++ .../Models/KnowledgebaseUpdateHeaders.cs | 55 + .../src/Generated/Models/KnowledgebasesDTO.cs | 54 + .../src/Generated/Models/MetadataDTO.cs | 99 ++ .../src/Generated/Models/Operation.cs | 106 ++ .../Generated/Models/OperationStateType.cs | 24 + .../Models/OperationsGetDetailsHeaders.cs | 57 + .../src/Generated/Models/PromptDTO.cs | 103 ++ .../src/Generated/Models/PromptDTOQna.cs | 65 + .../src/Generated/Models/QnADTO.cs | 147 ++ .../src/Generated/Models/QnADTOContext.cs | 63 + .../src/Generated/Models/QnADocumentsDTO.cs | 53 + .../src/Generated/Models/QnASearchResult.cs | 101 ++ .../Models/QnASearchResultContext.cs | 63 + .../Generated/Models/QnASearchResultList.cs | 53 + .../src/Generated/Models/QueryContextDTO.cs | 60 + .../src/Generated/Models/QueryDTO.cs | 143 ++ .../src/Generated/Models/QueryDTOContext.cs | 46 + .../src/Generated/Models/ReplaceKbDTO.cs | 80 ++ .../StrictFiltersCompoundOperationType.cs | 22 + .../src/Generated/Models/UpdateContextDTO.cs | 80 ++ .../Generated/Models/UpdateKbContentsDTO.cs | 73 + .../Generated/Models/UpdateKbOperationDTO.cs | 118 ++ .../Models/UpdateKbOperationDTOAdd.cs | 51 + .../Models/UpdateKbOperationDTODelete.cs | 48 + .../Models/UpdateKbOperationDTOUpdate.cs | 50 + .../src/Generated/Models/UpdateMetadataDTO.cs | 63 + .../src/Generated/Models/UpdateQnaDTO.cs | 125 ++ .../Generated/Models/UpdateQnaDTOContext.cs | 55 + .../Generated/Models/UpdateQnaDTOMetadata.cs | 49 + .../Generated/Models/UpdateQnaDTOQuestions.cs | 47 + .../Generated/Models/UpdateQuestionsDTO.cs | 62 + .../Generated/Models/WordAlterationsDTO.cs | 78 + .../src/Generated/Operations.cs | 220 +++ .../src/Generated/OperationsExtensions.cs | 43 + .../src/Generated/QnAMakerClient.cs | 239 ++++ .../src/Generated/QnAMakerRuntimeClient.cs | 215 +++ .../src/Generated/Runtime.cs | 367 +++++ .../src/Generated/RuntimeExtensions.cs | 66 + .../data-plane/QnAMaker/readme.md | 28 + 75 files changed, 8275 insertions(+) create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs new file mode 100644 index 000000000000..ddb65cca37af --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs @@ -0,0 +1,339 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Alterations operations. + /// + public partial class Alterations : IServiceOperations, IAlterations + { + /// + /// Initializes a new instance of the Alterations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Alterations(QnAMakerClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the QnAMakerClient + /// + public QnAMakerClient Client { get; private set; } + + /// + /// Download alterations from runtime. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "alterations"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Replace alterations data. + /// + /// + /// New alterations data. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ReplaceWithHttpMessagesAsync(WordAlterationsDTO wordAlterations, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (wordAlterations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "wordAlterations"); + } + if (wordAlterations != null) + { + wordAlterations.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("wordAlterations", wordAlterations); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Replace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "alterations"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(wordAlterations != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(wordAlterations, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs new file mode 100644 index 000000000000..f1fc89cb4045 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Alterations. + /// + public static partial class AlterationsExtensions + { + /// + /// Download alterations from runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAlterations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Replace alterations data. + /// + /// + /// The operations group for this extension method. + /// + /// + /// New alterations data. + /// + /// + /// The cancellation token. + /// + public static async Task ReplaceAsync(this IAlterations operations, WordAlterationsDTO wordAlterations, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReplaceWithHttpMessagesAsync(wordAlterations, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs new file mode 100644 index 000000000000..af6ccaa0d9b7 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs @@ -0,0 +1,351 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EndpointKeys operations. + /// + public partial class EndpointKeys : IServiceOperations, IEndpointKeys + { + /// + /// Initializes a new instance of the EndpointKeys class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public EndpointKeys(QnAMakerClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the QnAMakerClient + /// + public QnAMakerClient Client { get; private set; } + + /// + /// Gets endpoint keys for an endpoint + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetKeysWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetKeys", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointkeys"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Re-generates an endpoint key. + /// + /// + /// Type of Key + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> RefreshKeysWithHttpMessagesAsync(string keyType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (keyType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyType"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("keyType", keyType); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RefreshKeys", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointkeys/{keyType}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{keyType}", System.Uri.EscapeDataString(keyType)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs new file mode 100644 index 000000000000..3fb365dae349 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EndpointKeys. + /// + public static partial class EndpointKeysExtensions + { + /// + /// Gets endpoint keys for an endpoint + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetKeysAsync(this IEndpointKeys operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetKeysWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Re-generates an endpoint key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Type of Key + /// + /// + /// The cancellation token. + /// + public static async Task RefreshKeysAsync(this IEndpointKeys operations, string keyType, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RefreshKeysWithHttpMessagesAsync(keyType, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs new file mode 100644 index 000000000000..42098991d6b3 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs @@ -0,0 +1,335 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EndpointSettings operations. + /// + public partial class EndpointSettings : IServiceOperations, IEndpointSettings + { + /// + /// Initializes a new instance of the EndpointSettings class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public EndpointSettings(QnAMakerClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the QnAMakerClient + /// + public QnAMakerClient Client { get; private set; } + + /// + /// Gets endpoint settings for an endpoint. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetSettingsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointSettings"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates endpoint settings for an endpoint. + /// + /// + /// Post body of the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task UpdateSettingsWithHttpMessagesAsync(EndpointSettingsDTO endpointSettingsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (endpointSettingsPayload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endpointSettingsPayload"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("endpointSettingsPayload", endpointSettingsPayload); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointSettings"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(endpointSettingsPayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(endpointSettingsPayload, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs new file mode 100644 index 000000000000..07b8a7a6d430 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EndpointSettings. + /// + public static partial class EndpointSettingsExtensions + { + /// + /// Gets endpoint settings for an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetSettingsAsync(this IEndpointSettings operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSettingsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates endpoint settings for an endpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Post body of the request. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateSettingsAsync(this IEndpointSettings operations, EndpointSettingsDTO endpointSettingsPayload, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateSettingsWithHttpMessagesAsync(endpointSettingsPayload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs new file mode 100644 index 000000000000..6ffc7bf297d9 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Alterations operations. + /// + public partial interface IAlterations + { + /// + /// Download alterations from runtime. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Replace alterations data. + /// + /// + /// New alterations data. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReplaceWithHttpMessagesAsync(WordAlterationsDTO wordAlterations, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs new file mode 100644 index 000000000000..513695533962 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EndpointKeys operations. + /// + public partial interface IEndpointKeys + { + /// + /// Gets endpoint keys for an endpoint + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetKeysWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Re-generates an endpoint key. + /// + /// + /// Type of Key + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> RefreshKeysWithHttpMessagesAsync(string keyType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs new file mode 100644 index 000000000000..86fc48a9037e --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EndpointSettings operations. + /// + public partial interface IEndpointSettings + { + /// + /// Gets endpoint settings for an endpoint. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetSettingsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates endpoint settings for an endpoint. + /// + /// + /// Post body of the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateSettingsWithHttpMessagesAsync(EndpointSettingsDTO endpointSettingsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs new file mode 100644 index 000000000000..982fe8f5ba5e --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs @@ -0,0 +1,202 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Knowledgebase operations. + /// + public partial interface IKnowledgebase + { + /// + /// Gets all knowledgebases for a user. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets details of a specific knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetDetailsWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the knowledgebase and all its data. + /// + /// + /// Knowledgebase id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Publishes all changes in test index of a knowledgebase to its prod + /// index. + /// + /// + /// Knowledgebase id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PublishWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Replace knowledgebase contents. + /// + /// + /// Knowledgebase id. + /// + /// + /// An instance of ReplaceKbDTO which contains list of qnas to be + /// uploaded + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ReplaceWithHttpMessagesAsync(string kbId, ReplaceKbDTO replaceKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Asynchronous operation to modify a knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string kbId, UpdateKbOperationDTO updateKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Asynchronous operation to create a new knowledgebase. + /// + /// + /// Post body of the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(CreateKbDTO createKbPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download the knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Specifies whether environment is Test or Prod. Possible values + /// include: 'Prod', 'Test' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DownloadWithHttpMessagesAsync(string kbId, string environment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs new file mode 100644 index 000000000000..2a75e8668cf0 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Gets details of a specific long running operation. + /// + /// + /// Operation id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetDetailsWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs new file mode 100644 index 000000000000..8133122a671a --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + + /// + /// An API for QnAMaker Service + /// + public partial interface IQnAMakerClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Supported Cognitive Services endpoints (protocol and hostname, for + /// example: https://westus.api.cognitive.microsoft.com). + /// + string Endpoint { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the IEndpointSettings. + /// + IEndpointSettings EndpointSettings { get; } + + /// + /// Gets the IEndpointKeys. + /// + IEndpointKeys EndpointKeys { get; } + + /// + /// Gets the IAlterations. + /// + IAlterations Alterations { get; } + + /// + /// Gets the IKnowledgebase. + /// + IKnowledgebase Knowledgebase { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs new file mode 100644 index 000000000000..d406f3f737a8 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + + /// + /// An API for QnAMaker runtime + /// + public partial interface IQnAMakerRuntimeClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// QnA Maker App Service endpoint (for example: + /// https://{qnaservice-hostname}.azurewebsites.net). + /// + string RuntimeEndpoint { get; set; } + + /// + /// Subscription credentials which uniquely identify client + /// subscription. + /// + ServiceClientCredentials Credentials { get; } + + + /// + /// Gets the IRuntime. + /// + IRuntime Runtime { get; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs new file mode 100644 index 000000000000..fdf4d89ff567 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Runtime operations. + /// + public partial interface IRuntime + { + /// + /// GenerateAnswer call to query the knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GenerateAnswerWithHttpMessagesAsync(string kbId, QueryDTO generateAnswerPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Train call to add suggestions to the knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task TrainWithHttpMessagesAsync(string kbId, FeedbackRecordsDTO trainPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs new file mode 100644 index 000000000000..8d07f34a1f9d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs @@ -0,0 +1,1270 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Knowledgebase operations. + /// + public partial class Knowledgebase : IServiceOperations, IKnowledgebase + { + /// + /// Initializes a new instance of the Knowledgebase class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Knowledgebase(QnAMakerClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the QnAMakerClient + /// + public QnAMakerClient Client { get; private set; } + + /// + /// Gets all knowledgebases for a user. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets details of a specific knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDetailsWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDetails", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the knowledgebase and all its data. + /// + /// + /// Knowledgebase id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Publishes all changes in test index of a knowledgebase to its prod index. + /// + /// + /// Knowledgebase id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task PublishWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Publish", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Replace knowledgebase contents. + /// + /// + /// Knowledgebase id. + /// + /// + /// An instance of ReplaceKbDTO which contains list of qnas to be uploaded + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ReplaceWithHttpMessagesAsync(string kbId, ReplaceKbDTO replaceKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + if (replaceKb == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "replaceKb"); + } + if (replaceKb != null) + { + replaceKb.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("replaceKb", replaceKb); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Replace", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(replaceKb != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(replaceKb, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Asynchronous operation to modify a knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string kbId, UpdateKbOperationDTO updateKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + if (updateKb == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateKb"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("updateKb", updateKb); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(updateKb != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateKb, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Asynchronous operation to create a new knowledgebase. + /// + /// + /// Post body of the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(CreateKbDTO createKbPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (createKbPayload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createKbPayload"); + } + if (createKbPayload != null) + { + createKbPayload.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("createKbPayload", createKbPayload); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/create"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(createKbPayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createKbPayload, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Download the knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Specifies whether environment is Test or Prod. Possible values include: + /// 'Prod', 'Test' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DownloadWithHttpMessagesAsync(string kbId, string environment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + if (environment == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "environment"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("environment", environment); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Download", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}/{environment}/qna"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + _url = _url.Replace("{environment}", System.Uri.EscapeDataString(environment)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs new file mode 100644 index 000000000000..bfd8fa62c72a --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs @@ -0,0 +1,181 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Knowledgebase. + /// + public static partial class KnowledgebaseExtensions + { + /// + /// Gets all knowledgebases for a user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAllAsync(this IKnowledgebase operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets details of a specific knowledgebase. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// The cancellation token. + /// + public static async Task GetDetailsAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDetailsWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the knowledgebase and all its data. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Publishes all changes in test index of a knowledgebase to its prod index. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// The cancellation token. + /// + public static async Task PublishAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PublishWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Replace knowledgebase contents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// An instance of ReplaceKbDTO which contains list of qnas to be uploaded + /// + /// + /// The cancellation token. + /// + public static async Task ReplaceAsync(this IKnowledgebase operations, string kbId, ReplaceKbDTO replaceKb, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReplaceWithHttpMessagesAsync(kbId, replaceKb, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Asynchronous operation to modify a knowledgebase. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IKnowledgebase operations, string kbId, UpdateKbOperationDTO updateKb, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(kbId, updateKb, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Asynchronous operation to create a new knowledgebase. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Post body of the request. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IKnowledgebase operations, CreateKbDTO createKbPayload, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(createKbPayload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Download the knowledgebase. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// Specifies whether environment is Test or Prod. Possible values include: + /// 'Prod', 'Test' + /// + /// + /// The cancellation token. + /// + public static async Task DownloadAsync(this IKnowledgebase operations, string kbId, string environment, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DownloadWithHttpMessagesAsync(kbId, environment, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs new file mode 100644 index 000000000000..0fb5bd71670d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Active Learning settings of the endpoint. + /// + public partial class ActiveLearningSettingsDTO + { + /// + /// Initializes a new instance of the ActiveLearningSettingsDTO class. + /// + public ActiveLearningSettingsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActiveLearningSettingsDTO class. + /// + /// True/False string providing Active + /// Learning + public ActiveLearningSettingsDTO(string enable = default(string)) + { + Enable = enable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets true/False string providing Active Learning + /// + [JsonProperty(PropertyName = "enable")] + public string Enable { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs new file mode 100644 index 000000000000..b931630ed733 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Collection of words that are synonyms. + /// + public partial class AlterationsDTO + { + /// + /// Initializes a new instance of the AlterationsDTO class. + /// + public AlterationsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlterationsDTO class. + /// + /// Words that are synonymous with each + /// other. + public AlterationsDTO(IList alterations) + { + Alterations = alterations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets words that are synonymous with each other. + /// + [JsonProperty(PropertyName = "alterations")] + public IList Alterations { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Alterations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Alterations"); + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs new file mode 100644 index 000000000000..9a2b93b636cc --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Context associated with Qna. + /// + public partial class ContextDTO + { + /// + /// Initializes a new instance of the ContextDTO class. + /// + public ContextDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContextDTO class. + /// + /// To mark if a prompt is relevant only + /// with a previous question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search + /// result + /// List of prompts associated with the + /// answer. + public ContextDTO(bool? isContextOnly = default(bool?), IList prompts = default(IList)) + { + IsContextOnly = isContextOnly; + Prompts = prompts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets to mark if a prompt is relevant only with a previous + /// question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search result + /// + [JsonProperty(PropertyName = "isContextOnly")] + public bool? IsContextOnly { get; set; } + + /// + /// Gets or sets list of prompts associated with the answer. + /// + [JsonProperty(PropertyName = "prompts")] + public IList Prompts { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Prompts != null) + { + if (Prompts.Count > 20) + { + throw new ValidationException(ValidationRules.MaxItems, "Prompts", 20); + } + foreach (var element in Prompts) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs new file mode 100644 index 000000000000..6aabb7498a94 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Post body schema for CreateKb operation. + /// + public partial class CreateKbDTO + { + /// + /// Initializes a new instance of the CreateKbDTO class. + /// + public CreateKbDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreateKbDTO class. + /// + /// Friendly name for the knowledgebase. + /// List of Q-A (QnADTO) to be added to the + /// knowledgebase. Q-A Ids are assigned by the service and should be + /// omitted. + /// List of URLs to be used for extracting + /// Q-A. + /// List of files from which to Extract + /// Q-A. + /// Enable hierarchical + /// extraction of Q-A from files and urls. Value to be considered False + /// if this field is not present. + /// Text string to be used + /// as the answer in any Q-A which has no extracted answer from the + /// document but has a hierarchy. Required when + /// EnableHierarchicalExtraction field is set to True. + /// Language of the knowledgebase. Please find + /// the list of supported languages <a + /// href="https://aka.ms/qnamaker-languages#languages-supported" + /// target="_blank">here</a>. + public CreateKbDTO(string name, IList qnaList = default(IList), IList urls = default(IList), IList files = default(IList), bool? enableHierarchicalExtraction = default(bool?), string defaultAnswerUsedForExtraction = default(string), string language = default(string)) + { + Name = name; + QnaList = qnaList; + Urls = urls; + Files = files; + EnableHierarchicalExtraction = enableHierarchicalExtraction; + DefaultAnswerUsedForExtraction = defaultAnswerUsedForExtraction; + Language = language; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets friendly name for the knowledgebase. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets list of Q-A (QnADTO) to be added to the knowledgebase. + /// Q-A Ids are assigned by the service and should be omitted. + /// + [JsonProperty(PropertyName = "qnaList")] + public IList QnaList { get; set; } + + /// + /// Gets or sets list of URLs to be used for extracting Q-A. + /// + [JsonProperty(PropertyName = "urls")] + public IList Urls { get; set; } + + /// + /// Gets or sets list of files from which to Extract Q-A. + /// + [JsonProperty(PropertyName = "files")] + public IList Files { get; set; } + + /// + /// Gets or sets enable hierarchical extraction of Q-A from files and + /// urls. Value to be considered False if this field is not present. + /// + [JsonProperty(PropertyName = "enableHierarchicalExtraction")] + public bool? EnableHierarchicalExtraction { get; set; } + + /// + /// Gets or sets text string to be used as the answer in any Q-A which + /// has no extracted answer from the document but has a hierarchy. + /// Required when EnableHierarchicalExtraction field is set to True. + /// + [JsonProperty(PropertyName = "defaultAnswerUsedForExtraction")] + public string DefaultAnswerUsedForExtraction { get; set; } + + /// + /// Gets or sets language of the knowledgebase. Please find the list of + /// supported languages &lt;a + /// href="https://aka.ms/qnamaker-languages#languages-supported" + /// target="_blank"&gt;here&lt;/a&gt;. + /// + [JsonProperty(PropertyName = "language")] + public string Language { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Name != null) + { + if (Name.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 100); + } + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + } + if (QnaList != null) + { + foreach (var element in QnaList) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Files != null) + { + foreach (var element1 in Files) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (DefaultAnswerUsedForExtraction != null) + { + if (DefaultAnswerUsedForExtraction.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DefaultAnswerUsedForExtraction", 300); + } + if (DefaultAnswerUsedForExtraction.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DefaultAnswerUsedForExtraction", 1); + } + } + if (Language != null) + { + if (Language.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "Language", 100); + } + if (Language.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Language", 1); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs new file mode 100644 index 000000000000..9dcda9a75796 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Input to create KB. + /// + public partial class CreateKbInputDTO + { + /// + /// Initializes a new instance of the CreateKbInputDTO class. + /// + public CreateKbInputDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreateKbInputDTO class. + /// + /// List of QNA to be added to the index. Ids are + /// generated by the service and should be omitted. + /// List of URLs to be added to + /// knowledgebase. + /// List of files to be added to + /// knowledgebase. + public CreateKbInputDTO(IList qnaList = default(IList), IList urls = default(IList), IList files = default(IList)) + { + QnaList = qnaList; + Urls = urls; + Files = files; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of QNA to be added to the index. Ids are + /// generated by the service and should be omitted. + /// + [JsonProperty(PropertyName = "qnaList")] + public IList QnaList { get; set; } + + /// + /// Gets or sets list of URLs to be added to knowledgebase. + /// + [JsonProperty(PropertyName = "urls")] + public IList Urls { get; set; } + + /// + /// Gets or sets list of files to be added to knowledgebase. + /// + [JsonProperty(PropertyName = "files")] + public IList Files { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs new file mode 100644 index 000000000000..09b3a9d6e060 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// PATCH body schema of Delete Operation in UpdateKb + /// + public partial class DeleteKbContentsDTO + { + /// + /// Initializes a new instance of the DeleteKbContentsDTO class. + /// + public DeleteKbContentsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeleteKbContentsDTO class. + /// + /// List of Qna Ids to be deleted + /// List of sources to be deleted from + /// knowledgebase. + public DeleteKbContentsDTO(IList ids = default(IList), IList sources = default(IList)) + { + Ids = ids; + Sources = sources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Qna Ids to be deleted + /// + [JsonProperty(PropertyName = "ids")] + public IList Ids { get; set; } + + /// + /// Gets or sets list of sources to be deleted from knowledgebase. + /// + [JsonProperty(PropertyName = "sources")] + public IList Sources { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs new file mode 100644 index 000000000000..d03a645a2404 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schema for EndpointKeys generate/refresh operations. + /// + public partial class EndpointKeysDTO + { + /// + /// Initializes a new instance of the EndpointKeysDTO class. + /// + public EndpointKeysDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointKeysDTO class. + /// + /// Primary Access Key. + /// Secondary Access Key. + /// Current version of runtime. + /// Latest version of runtime. + /// Language setting of runtime. + public EndpointKeysDTO(string primaryEndpointKey = default(string), string secondaryEndpointKey = default(string), string installedVersion = default(string), string lastStableVersion = default(string), string language = default(string)) + { + PrimaryEndpointKey = primaryEndpointKey; + SecondaryEndpointKey = secondaryEndpointKey; + InstalledVersion = installedVersion; + LastStableVersion = lastStableVersion; + Language = language; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets primary Access Key. + /// + [JsonProperty(PropertyName = "primaryEndpointKey")] + public string PrimaryEndpointKey { get; set; } + + /// + /// Gets or sets secondary Access Key. + /// + [JsonProperty(PropertyName = "secondaryEndpointKey")] + public string SecondaryEndpointKey { get; set; } + + /// + /// Gets or sets current version of runtime. + /// + [JsonProperty(PropertyName = "installedVersion")] + public string InstalledVersion { get; set; } + + /// + /// Gets or sets latest version of runtime. + /// + [JsonProperty(PropertyName = "lastStableVersion")] + public string LastStableVersion { get; set; } + + /// + /// Gets or sets language setting of runtime. + /// + [JsonProperty(PropertyName = "language")] + public string Language { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs new file mode 100644 index 000000000000..175a800e9f36 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Endpoint settings. + /// + public partial class EndpointSettingsDTO + { + /// + /// Initializes a new instance of the EndpointSettingsDTO class. + /// + public EndpointSettingsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointSettingsDTO class. + /// + /// Active Learning settings of the + /// endpoint. + public EndpointSettingsDTO(EndpointSettingsDTOActiveLearning activeLearning = default(EndpointSettingsDTOActiveLearning)) + { + ActiveLearning = activeLearning; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets active Learning settings of the endpoint. + /// + [JsonProperty(PropertyName = "activeLearning")] + public EndpointSettingsDTOActiveLearning ActiveLearning { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs new file mode 100644 index 000000000000..d610bed74d58 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Linq; + + /// + /// Active Learning settings of the endpoint. + /// + public partial class EndpointSettingsDTOActiveLearning : ActiveLearningSettingsDTO + { + /// + /// Initializes a new instance of the EndpointSettingsDTOActiveLearning + /// class. + /// + public EndpointSettingsDTOActiveLearning() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointSettingsDTOActiveLearning + /// class. + /// + /// True/False string providing Active + /// Learning + public EndpointSettingsDTOActiveLearning(string enable = default(string)) + : base(enable) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs new file mode 100644 index 000000000000..6784c64296a6 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + + /// + /// Defines values for EnvironmentType. + /// + public static class EnvironmentType + { + public const string Prod = "Prod"; + public const string Test = "Test"; + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..5781e9bc62d1 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs @@ -0,0 +1,125 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error object. As per Microsoft One API guidelines - + /// https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// One of a server-defined set of error codes. + /// Possible values include: 'BadArgument', 'Forbidden', 'NotFound', + /// 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', + /// 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', + /// 'OperationNotFound', 'ServiceError', 'ValidationFailure', + /// 'ExtractionFailure' + /// 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. + public Error(string code, string message = default(string), string target = default(string), IList details = default(IList), InnerErrorModel innerError = default(InnerErrorModel)) + { + Code = code; + Message = message; + Target = target; + Details = details; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets one of a server-defined set of error codes. Possible + /// values include: 'BadArgument', 'Forbidden', 'NotFound', + /// 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', + /// 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', + /// 'OperationNotFound', 'ServiceError', 'ValidationFailure', + /// 'ExtractionFailure' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets a human-readable representation of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the target of the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets an array of details about specific errors that led to + /// this reported error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Gets or sets an object containing more specific information than + /// the current object about the error. + /// + [JsonProperty(PropertyName = "innerError")] + public InnerErrorModel InnerError { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + if (Details != null) + { + foreach (var element in Details) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs new file mode 100644 index 000000000000..53f28c4bc988 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs @@ -0,0 +1,34 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + + /// + /// Defines values for ErrorCodeType. + /// + public static class ErrorCodeType + { + public const string BadArgument = "BadArgument"; + public const string Forbidden = "Forbidden"; + public const string NotFound = "NotFound"; + public const string KbNotFound = "KbNotFound"; + public const string Unauthorized = "Unauthorized"; + public const string Unspecified = "Unspecified"; + public const string EndpointKeysError = "EndpointKeysError"; + public const string QuotaExceeded = "QuotaExceeded"; + public const string QnaRuntimeError = "QnaRuntimeError"; + public const string SKULimitExceeded = "SKULimitExceeded"; + public const string OperationNotFound = "OperationNotFound"; + public const string ServiceError = "ServiceError"; + public const string ValidationFailure = "ValidationFailure"; + public const string ExtractionFailure = "ExtractionFailure"; + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..41750bb6316b --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response. As per Microsoft One API guidelines - + /// https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorResponseError error = default(ErrorResponseError)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorResponseError Error { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs new file mode 100644 index 000000000000..2e741a71a2b4 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error object. + /// + public partial class ErrorResponseError : Error + { + /// + /// Initializes a new instance of the ErrorResponseError class. + /// + public ErrorResponseError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponseError class. + /// + /// One of a server-defined set of error codes. + /// Possible values include: 'BadArgument', 'Forbidden', 'NotFound', + /// 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', + /// 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', + /// 'OperationNotFound', 'ServiceError', 'ValidationFailure', + /// 'ExtractionFailure' + /// 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. + public ErrorResponseError(string code, string message = default(string), string target = default(string), IList details = default(IList), InnerErrorModel innerError = default(InnerErrorModel)) + : base(code, message, target, details, innerError) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..db90a2de852a --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs new file mode 100644 index 000000000000..e77c6c00c327 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Active learning feedback record. + /// + public partial class FeedbackRecordDTO + { + /// + /// Initializes a new instance of the FeedbackRecordDTO class. + /// + public FeedbackRecordDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeedbackRecordDTO class. + /// + /// Unique identifier for the user. + /// The suggested question being provided as + /// feedback. + /// The qnaId for which the suggested question is + /// provided as feedback. + public FeedbackRecordDTO(string userId = default(string), string userQuestion = default(string), int? qnaId = default(int?)) + { + UserId = userId; + UserQuestion = userQuestion; + QnaId = qnaId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique identifier for the user. + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; set; } + + /// + /// Gets or sets the suggested question being provided as feedback. + /// + [JsonProperty(PropertyName = "userQuestion")] + public string UserQuestion { get; set; } + + /// + /// Gets or sets the qnaId for which the suggested question is provided + /// as feedback. + /// + [JsonProperty(PropertyName = "qnaId")] + public int? QnaId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UserQuestion != null) + { + if (UserQuestion.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "UserQuestion", 1000); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs new file mode 100644 index 000000000000..be2da0f206a8 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Active learning feedback records. + /// + public partial class FeedbackRecordsDTO + { + /// + /// Initializes a new instance of the FeedbackRecordsDTO class. + /// + public FeedbackRecordsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeedbackRecordsDTO class. + /// + /// List of feedback records. + public FeedbackRecordsDTO(IList feedbackRecords = default(IList)) + { + FeedbackRecords = feedbackRecords; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of feedback records. + /// + [JsonProperty(PropertyName = "feedbackRecords")] + public IList FeedbackRecords { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs new file mode 100644 index 000000000000..3316c9986c48 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// DTO to hold details of uploaded files. + /// + public partial class FileDTO + { + /// + /// Initializes a new instance of the FileDTO class. + /// + public FileDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileDTO class. + /// + /// File name. Supported file types are ".tsv", + /// ".pdf", ".txt", ".docx", ".xlsx". + /// Public URI of the file. + public FileDTO(string fileName, string fileUri) + { + FileName = fileName; + FileUri = fileUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets file name. Supported file types are ".tsv", ".pdf", + /// ".txt", ".docx", ".xlsx". + /// + [JsonProperty(PropertyName = "fileName")] + public string FileName { get; set; } + + /// + /// Gets or sets public URI of the file. + /// + [JsonProperty(PropertyName = "fileUri")] + public string FileUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FileName"); + } + if (FileUri == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FileUri"); + } + if (FileName != null) + { + if (FileName.Length > 200) + { + throw new ValidationException(ValidationRules.MaxLength, "FileName", 200); + } + if (FileName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "FileName", 1); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs new file mode 100644 index 000000000000..a977824b6024 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An object containing more specific information about the error. As per + /// Microsoft One API guidelines - + /// https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + /// + public partial class InnerErrorModel + { + /// + /// Initializes a new instance of the InnerErrorModel class. + /// + public InnerErrorModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InnerErrorModel class. + /// + /// A more specific error code than was provided by + /// the containing error. + /// An object containing more specific + /// information than the current object about the error. + public InnerErrorModel(string code = default(string), InnerErrorModel innerError = default(InnerErrorModel)) + { + Code = code; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a more specific error code than was provided by the + /// containing error. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets an object containing more specific information than + /// the current object about the error. + /// + [JsonProperty(PropertyName = "innerError")] + public InnerErrorModel InnerError { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs new file mode 100644 index 000000000000..a1564b9ba84d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Response schema for CreateKb operation. + /// + public partial class KnowledgebaseDTO + { + /// + /// Initializes a new instance of the KnowledgebaseDTO class. + /// + public KnowledgebaseDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KnowledgebaseDTO class. + /// + /// Unique id that identifies a knowledgebase. + /// URL host name at which the knowledgebase is + /// hosted. + /// Time stamp at which the + /// knowledgebase was last accessed (UTC). + /// Time stamp at which the + /// knowledgebase was last modified (UTC). + /// Time stamp at which the + /// knowledgebase was last published (UTC). + /// Friendly name of the knowledgebase. + /// User who created / owns the + /// knowledgebase. + /// URL sources from which Q-A were extracted and + /// added to the knowledgebase. + /// Custom sources from which Q-A were extracted + /// or explicitly added to the knowledgebase. + public KnowledgebaseDTO(string id = default(string), string hostName = default(string), string lastAccessedTimestamp = default(string), string lastChangedTimestamp = default(string), string lastPublishedTimestamp = default(string), string name = default(string), string userId = default(string), IList urls = default(IList), IList sources = default(IList)) + { + Id = id; + HostName = hostName; + LastAccessedTimestamp = lastAccessedTimestamp; + LastChangedTimestamp = lastChangedTimestamp; + LastPublishedTimestamp = lastPublishedTimestamp; + Name = name; + UserId = userId; + Urls = urls; + Sources = sources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique id that identifies a knowledgebase. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets URL host name at which the knowledgebase is hosted. + /// + [JsonProperty(PropertyName = "hostName")] + public string HostName { get; set; } + + /// + /// Gets or sets time stamp at which the knowledgebase was last + /// accessed (UTC). + /// + [JsonProperty(PropertyName = "lastAccessedTimestamp")] + public string LastAccessedTimestamp { get; set; } + + /// + /// Gets or sets time stamp at which the knowledgebase was last + /// modified (UTC). + /// + [JsonProperty(PropertyName = "lastChangedTimestamp")] + public string LastChangedTimestamp { get; set; } + + /// + /// Gets or sets time stamp at which the knowledgebase was last + /// published (UTC). + /// + [JsonProperty(PropertyName = "lastPublishedTimestamp")] + public string LastPublishedTimestamp { get; set; } + + /// + /// Gets or sets friendly name of the knowledgebase. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets user who created / owns the knowledgebase. + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; set; } + + /// + /// Gets or sets URL sources from which Q-A were extracted and added to + /// the knowledgebase. + /// + [JsonProperty(PropertyName = "urls")] + public IList Urls { get; set; } + + /// + /// Gets or sets custom sources from which Q-A were extracted or + /// explicitly added to the knowledgebase. + /// + [JsonProperty(PropertyName = "sources")] + public IList Sources { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs new file mode 100644 index 000000000000..6077134654cb --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class KnowledgebaseUpdateHeaders + { + /// + /// Initializes a new instance of the KnowledgebaseUpdateHeaders class. + /// + public KnowledgebaseUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KnowledgebaseUpdateHeaders class. + /// + /// Relative URI to the target location of the + /// asynchronous operation. Client should poll this resource to get + /// status of the operation. + public KnowledgebaseUpdateHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets relative URI to the target location of the + /// asynchronous operation. Client should poll this resource to get + /// status of the operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs new file mode 100644 index 000000000000..322df42770b7 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Collection of knowledgebases owned by a user. + /// + public partial class KnowledgebasesDTO + { + /// + /// Initializes a new instance of the KnowledgebasesDTO class. + /// + public KnowledgebasesDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KnowledgebasesDTO class. + /// + /// Collection of knowledgebase + /// records. + public KnowledgebasesDTO(IList knowledgebases = default(IList)) + { + Knowledgebases = knowledgebases; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets collection of knowledgebase records. + /// + [JsonProperty(PropertyName = "knowledgebases")] + public IList Knowledgebases { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs new file mode 100644 index 000000000000..56af6aa6f305 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Name - value pair of metadata. + /// + public partial class MetadataDTO + { + /// + /// Initializes a new instance of the MetadataDTO class. + /// + public MetadataDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataDTO class. + /// + /// Metadata name. + /// Metadata value. + public MetadataDTO(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets metadata name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets metadata value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + if (Name != null) + { + if (Name.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 100); + } + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + } + if (Value != null) + { + if (Value.Length > 500) + { + throw new ValidationException(ValidationRules.MaxLength, "Value", 500); + } + if (Value.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Value", 1); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..ec410e6e0ef0 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Record to track long running operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation state. Possible values + /// include: 'Failed', 'NotStarted', 'Running', 'Succeeded' + /// Timestamp when the operation was + /// created. + /// Timestamp when the current state + /// was entered. + /// Relative URI to the target resource + /// location for completed resources. + /// User Id + /// Operation Id. + /// Error details in case of + /// failures. + public Operation(string operationState = default(string), string createdTimestamp = default(string), string lastActionTimestamp = default(string), string resourceLocation = default(string), string userId = default(string), string operationId = default(string), ErrorResponse errorResponse = default(ErrorResponse)) + { + OperationState = operationState; + CreatedTimestamp = createdTimestamp; + LastActionTimestamp = lastActionTimestamp; + ResourceLocation = resourceLocation; + UserId = userId; + OperationId = operationId; + ErrorResponse = errorResponse; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation state. Possible values include: 'Failed', + /// 'NotStarted', 'Running', 'Succeeded' + /// + [JsonProperty(PropertyName = "operationState")] + public string OperationState { get; set; } + + /// + /// Gets or sets timestamp when the operation was created. + /// + [JsonProperty(PropertyName = "createdTimestamp")] + public string CreatedTimestamp { get; set; } + + /// + /// Gets or sets timestamp when the current state was entered. + /// + [JsonProperty(PropertyName = "lastActionTimestamp")] + public string LastActionTimestamp { get; set; } + + /// + /// Gets or sets relative URI to the target resource location for + /// completed resources. + /// + [JsonProperty(PropertyName = "resourceLocation")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets user Id + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; set; } + + /// + /// Gets or sets operation Id. + /// + [JsonProperty(PropertyName = "operationId")] + public string OperationId { get; set; } + + /// + /// Gets or sets error details in case of failures. + /// + [JsonProperty(PropertyName = "errorResponse")] + public ErrorResponse ErrorResponse { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs new file mode 100644 index 000000000000..edcfd982c949 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + + /// + /// Defines values for OperationStateType. + /// + public static class OperationStateType + { + public const string Failed = "Failed"; + public const string NotStarted = "NotStarted"; + public const string Running = "Running"; + public const string Succeeded = "Succeeded"; + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs new file mode 100644 index 000000000000..f668f06e0998 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetDetails operation. + /// + public partial class OperationsGetDetailsHeaders + { + /// + /// Initializes a new instance of the OperationsGetDetailsHeaders + /// class. + /// + public OperationsGetDetailsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsGetDetailsHeaders + /// class. + /// + /// Indicates how long the client should wait + /// before sending a follow up request. The header will be present only + /// if the operation is running or has not started yet. + public OperationsGetDetailsHeaders(int? retryAfter = default(int?)) + { + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates how long the client should wait before + /// sending a follow up request. The header will be present only if the + /// operation is running or has not started yet. + /// + [JsonProperty(PropertyName = "RetryAfter")] + public int? RetryAfter { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs new file mode 100644 index 000000000000..1fcc695d9cff --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Prompt for an answer. + /// + public partial class PromptDTO + { + /// + /// Initializes a new instance of the PromptDTO class. + /// + public PromptDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PromptDTO class. + /// + /// Index of the prompt - used in ordering + /// of the prompts + /// Qna id corresponding to the prompt - if QnaId + /// is present, QnADTO object is ignored. + /// QnADTO - Either QnaId or QnADTO needs to be + /// present in a PromptDTO object + /// Text displayed to represent a follow up + /// question prompt + public PromptDTO(int? displayOrder = default(int?), int? qnaId = default(int?), PromptDTOQna qna = default(PromptDTOQna), string displayText = default(string)) + { + DisplayOrder = displayOrder; + QnaId = qnaId; + Qna = qna; + DisplayText = displayText; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets index of the prompt - used in ordering of the prompts + /// + [JsonProperty(PropertyName = "displayOrder")] + public int? DisplayOrder { get; set; } + + /// + /// Gets or sets qna id corresponding to the prompt - if QnaId is + /// present, QnADTO object is ignored. + /// + [JsonProperty(PropertyName = "qnaId")] + public int? QnaId { get; set; } + + /// + /// Gets or sets qnADTO - Either QnaId or QnADTO needs to be present in + /// a PromptDTO object + /// + [JsonProperty(PropertyName = "qna")] + public PromptDTOQna Qna { get; set; } + + /// + /// Gets or sets text displayed to represent a follow up question + /// prompt + /// + [JsonProperty(PropertyName = "displayText")] + public string DisplayText { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Qna != null) + { + Qna.Validate(); + } + if (DisplayText != null) + { + if (DisplayText.Length > 200) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayText", 200); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs new file mode 100644 index 000000000000..a95fae8e1140 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO + /// object + /// + public partial class PromptDTOQna : QnADTO + { + /// + /// Initializes a new instance of the PromptDTOQna class. + /// + public PromptDTOQna() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PromptDTOQna class. + /// + /// Answer text + /// List of questions associated with the + /// answer. + /// Unique id for the Q-A. + /// Source from which Q-A was indexed. eg. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + /// List of metadata associated with the + /// answer. + /// Context of a QnA + public PromptDTOQna(string answer, IList questions, int? id = default(int?), string source = default(string), IList metadata = default(IList), QnADTOContext context = default(QnADTOContext)) + : base(answer, questions, id, source, metadata, context) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs new file mode 100644 index 000000000000..2c5f563a333d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Q-A object. + /// + public partial class QnADTO + { + /// + /// Initializes a new instance of the QnADTO class. + /// + public QnADTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QnADTO class. + /// + /// Answer text + /// List of questions associated with the + /// answer. + /// Unique id for the Q-A. + /// Source from which Q-A was indexed. eg. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + /// List of metadata associated with the + /// answer. + /// Context of a QnA + public QnADTO(string answer, IList questions, int? id = default(int?), string source = default(string), IList metadata = default(IList), QnADTOContext context = default(QnADTOContext)) + { + Id = id; + Answer = answer; + Source = source; + Questions = questions; + Metadata = metadata; + Context = context; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique id for the Q-A. + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// Gets or sets answer text + /// + [JsonProperty(PropertyName = "answer")] + public string Answer { get; set; } + + /// + /// Gets or sets source from which Q-A was indexed. eg. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + /// + [JsonProperty(PropertyName = "source")] + public string Source { get; set; } + + /// + /// Gets or sets list of questions associated with the answer. + /// + [JsonProperty(PropertyName = "questions")] + public IList Questions { get; set; } + + /// + /// Gets or sets list of metadata associated with the answer. + /// + [JsonProperty(PropertyName = "metadata")] + public IList Metadata { get; set; } + + /// + /// Gets or sets context of a QnA + /// + [JsonProperty(PropertyName = "context")] + public QnADTOContext Context { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Answer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Answer"); + } + if (Questions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Questions"); + } + if (Answer != null) + { + if (Answer.Length > 25000) + { + throw new ValidationException(ValidationRules.MaxLength, "Answer", 25000); + } + if (Answer.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Answer", 1); + } + } + if (Source != null) + { + if (Source.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Source", 300); + } + } + if (Metadata != null) + { + foreach (var element in Metadata) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Context != null) + { + Context.Validate(); + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs new file mode 100644 index 000000000000..c663a9710a42 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Context of a QnA + /// + public partial class QnADTOContext : ContextDTO + { + /// + /// Initializes a new instance of the QnADTOContext class. + /// + public QnADTOContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QnADTOContext class. + /// + /// To mark if a prompt is relevant only + /// with a previous question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search + /// result + /// List of prompts associated with the + /// answer. + public QnADTOContext(bool? isContextOnly = default(bool?), IList prompts = default(IList)) + : base(isContextOnly, prompts) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs new file mode 100644 index 000000000000..dddb8cffe800 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of QnADTO + /// + public partial class QnADocumentsDTO + { + /// + /// Initializes a new instance of the QnADocumentsDTO class. + /// + public QnADocumentsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QnADocumentsDTO class. + /// + /// List of answers. + public QnADocumentsDTO(IList qnaDocuments = default(IList)) + { + QnaDocuments = qnaDocuments; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of answers. + /// + [JsonProperty(PropertyName = "qnaDocuments")] + public IList QnaDocuments { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs new file mode 100644 index 000000000000..2e2a56dd6b02 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Search Result. + /// + public partial class QnASearchResult + { + /// + /// Initializes a new instance of the QnASearchResult class. + /// + public QnASearchResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QnASearchResult class. + /// + /// List of questions. + /// Answer. + /// Search result score. + /// Id of the QnA result. + /// Source of QnA result. + /// List of metadata. + /// Context object of the QnA + public QnASearchResult(IList questions = default(IList), string answer = default(string), double? score = default(double?), int? id = default(int?), string source = default(string), IList metadata = default(IList), QnASearchResultContext context = default(QnASearchResultContext)) + { + Questions = questions; + Answer = answer; + Score = score; + Id = id; + Source = source; + Metadata = metadata; + Context = context; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of questions. + /// + [JsonProperty(PropertyName = "questions")] + public IList Questions { get; set; } + + /// + /// Gets or sets answer. + /// + [JsonProperty(PropertyName = "answer")] + public string Answer { get; set; } + + /// + /// Gets or sets search result score. + /// + [JsonProperty(PropertyName = "score")] + public double? Score { get; set; } + + /// + /// Gets or sets id of the QnA result. + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// Gets or sets source of QnA result. + /// + [JsonProperty(PropertyName = "source")] + public string Source { get; set; } + + /// + /// Gets or sets list of metadata. + /// + [JsonProperty(PropertyName = "metadata")] + public IList Metadata { get; set; } + + /// + /// Gets or sets context object of the QnA + /// + [JsonProperty(PropertyName = "context")] + public QnASearchResultContext Context { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs new file mode 100644 index 000000000000..f7a01ea1217b --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Context object of the QnA + /// + public partial class QnASearchResultContext : ContextDTO + { + /// + /// Initializes a new instance of the QnASearchResultContext class. + /// + public QnASearchResultContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QnASearchResultContext class. + /// + /// To mark if a prompt is relevant only + /// with a previous question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search + /// result + /// List of prompts associated with the + /// answer. + public QnASearchResultContext(bool? isContextOnly = default(bool?), IList prompts = default(IList)) + : base(isContextOnly, prompts) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs new file mode 100644 index 000000000000..88b445aa841c --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents List of Question Answers. + /// + public partial class QnASearchResultList + { + /// + /// Initializes a new instance of the QnASearchResultList class. + /// + public QnASearchResultList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QnASearchResultList class. + /// + /// Represents Search Result list. + public QnASearchResultList(IList answers = default(IList)) + { + Answers = answers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets represents Search Result list. + /// + [JsonProperty(PropertyName = "answers")] + public IList Answers { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs new file mode 100644 index 000000000000..fa9d3cc462e2 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Context object with previous QnA's information. + /// + public partial class QueryContextDTO + { + /// + /// Initializes a new instance of the QueryContextDTO class. + /// + public QueryContextDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryContextDTO class. + /// + /// Previous QnA Id - qnaId of the top + /// result. + /// Previous user query. + public QueryContextDTO(string previousQnaId = default(string), string previousUserQuery = default(string)) + { + PreviousQnaId = previousQnaId; + PreviousUserQuery = previousUserQuery; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets previous QnA Id - qnaId of the top result. + /// + [JsonProperty(PropertyName = "previousQnaId")] + public string PreviousQnaId { get; set; } + + /// + /// Gets or sets previous user query. + /// + [JsonProperty(PropertyName = "previousUserQuery")] + public string PreviousUserQuery { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs new file mode 100644 index 000000000000..a4573673cf63 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// POST body schema to query the knowledgebase. + /// + public partial class QueryDTO + { + /// + /// Initializes a new instance of the QueryDTO class. + /// + public QueryDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryDTO class. + /// + /// Exact qnaId to fetch from the knowledgebase, + /// this field takes priority over question. + /// User question to query against the knowledge + /// base. + /// Max number of answers to be returned for the + /// question. + /// Unique identifier for the user. Optional + /// parameter for telemetry. For more information, refer <a + /// href="http://aka.ms/qnamaker-analytics#user-traffic" + /// target="blank">Analytics and Telemetry</a>. + /// Query against the test index. + /// Threshold for answers returned based + /// on score. + /// Context object with previous QnA's + /// information. + /// Optional field. Set to 'QuestionOnly' for + /// using a question only Ranker. + /// Find only answers that contain these + /// metadata. + /// Optional field. + /// Set to OR for using OR as Operation for Strict Filters. Possible + /// values include: 'AND', 'OR' + public QueryDTO(string qnaId = default(string), string question = default(string), int? top = default(int?), string userId = default(string), bool? isTest = default(bool?), double? scoreThreshold = default(double?), QueryDTOContext context = default(QueryDTOContext), string rankerType = default(string), IList strictFilters = default(IList), string strictFiltersCompoundOperationType = default(string)) + { + QnaId = qnaId; + Question = question; + Top = top; + UserId = userId; + IsTest = isTest; + ScoreThreshold = scoreThreshold; + Context = context; + RankerType = rankerType; + StrictFilters = strictFilters; + StrictFiltersCompoundOperationType = strictFiltersCompoundOperationType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets exact qnaId to fetch from the knowledgebase, this + /// field takes priority over question. + /// + [JsonProperty(PropertyName = "qnaId")] + public string QnaId { get; set; } + + /// + /// Gets or sets user question to query against the knowledge base. + /// + [JsonProperty(PropertyName = "question")] + public string Question { get; set; } + + /// + /// Gets or sets max number of answers to be returned for the question. + /// + [JsonProperty(PropertyName = "top")] + public int? Top { get; set; } + + /// + /// Gets or sets unique identifier for the user. Optional parameter for + /// telemetry. For more information, refer &lt;a + /// href="http://aka.ms/qnamaker-analytics#user-traffic" + /// target="blank"&gt;Analytics and Telemetry&lt;/a&gt;. + /// + [JsonProperty(PropertyName = "userId")] + public string UserId { get; set; } + + /// + /// Gets or sets query against the test index. + /// + [JsonProperty(PropertyName = "isTest")] + public bool? IsTest { get; set; } + + /// + /// Gets or sets threshold for answers returned based on score. + /// + [JsonProperty(PropertyName = "scoreThreshold")] + public double? ScoreThreshold { get; set; } + + /// + /// Gets or sets context object with previous QnA's information. + /// + [JsonProperty(PropertyName = "context")] + public QueryDTOContext Context { get; set; } + + /// + /// Gets or sets optional field. Set to 'QuestionOnly' for using a + /// question only Ranker. + /// + [JsonProperty(PropertyName = "rankerType")] + public string RankerType { get; set; } + + /// + /// Gets or sets find only answers that contain these metadata. + /// + [JsonProperty(PropertyName = "strictFilters")] + public IList StrictFilters { get; set; } + + /// + /// Gets or sets optional field. Set to OR for using OR as Operation + /// for Strict Filters. Possible values include: 'AND', 'OR' + /// + [JsonProperty(PropertyName = "strictFiltersCompoundOperationType")] + public string StrictFiltersCompoundOperationType { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs new file mode 100644 index 000000000000..7dc405c44daf --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Linq; + + /// + /// Context object with previous QnA's information. + /// + public partial class QueryDTOContext : QueryContextDTO + { + /// + /// Initializes a new instance of the QueryDTOContext class. + /// + public QueryDTOContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryDTOContext class. + /// + /// Previous QnA Id - qnaId of the top + /// result. + /// Previous user query. + public QueryDTOContext(string previousQnaId = default(string), string previousUserQuery = default(string)) + : base(previousQnaId, previousUserQuery) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs new file mode 100644 index 000000000000..5962ddb41cc1 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Post body schema for Replace KB operation. + /// + public partial class ReplaceKbDTO + { + /// + /// Initializes a new instance of the ReplaceKbDTO class. + /// + public ReplaceKbDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplaceKbDTO class. + /// + /// List of Q-A (QnADTO) to be added to the + /// knowledgebase. Q-A Ids are assigned by the service and should be + /// omitted. + public ReplaceKbDTO(IList qnAList) + { + QnAList = qnAList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Q-A (QnADTO) to be added to the knowledgebase. + /// Q-A Ids are assigned by the service and should be omitted. + /// + [JsonProperty(PropertyName = "qnAList")] + public IList QnAList { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (QnAList == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "QnAList"); + } + if (QnAList != null) + { + foreach (var element in QnAList) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs new file mode 100644 index 000000000000..97c8b0e308bd --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + + /// + /// Defines values for StrictFiltersCompoundOperationType. + /// + public static class StrictFiltersCompoundOperationType + { + public const string AND = "AND"; + public const string OR = "OR"; + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs new file mode 100644 index 000000000000..3e5fb14bbb47 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Update Body schema to represent context to be updated + /// + public partial class UpdateContextDTO + { + /// + /// Initializes a new instance of the UpdateContextDTO class. + /// + public UpdateContextDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateContextDTO class. + /// + /// List of prompts associated with qna + /// to be deleted + /// List of prompts to be added to the + /// qna. + /// To mark if a prompt is relevant only + /// with a previous question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search + /// result + public UpdateContextDTO(IList promptsToDelete = default(IList), IList promptsToAdd = default(IList), bool? isContextOnly = default(bool?)) + { + PromptsToDelete = promptsToDelete; + PromptsToAdd = promptsToAdd; + IsContextOnly = isContextOnly; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of prompts associated with qna to be deleted + /// + [JsonProperty(PropertyName = "promptsToDelete")] + public IList PromptsToDelete { get; set; } + + /// + /// Gets or sets list of prompts to be added to the qna. + /// + [JsonProperty(PropertyName = "promptsToAdd")] + public IList PromptsToAdd { get; set; } + + /// + /// Gets or sets to mark if a prompt is relevant only with a previous + /// question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search result + /// + [JsonProperty(PropertyName = "isContextOnly")] + public bool? IsContextOnly { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs new file mode 100644 index 000000000000..36c4fc7ba295 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// PATCH body schema for Update operation in Update Kb + /// + public partial class UpdateKbContentsDTO + { + /// + /// Initializes a new instance of the UpdateKbContentsDTO class. + /// + public UpdateKbContentsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateKbContentsDTO class. + /// + /// Friendly name for the knowledgebase. + /// List of Q-A (UpdateQnaDTO) to be added to the + /// knowledgebase. + /// List of existing URLs to be refreshed. The + /// content will be extracted again and re-indexed. + public UpdateKbContentsDTO(string name = default(string), IList qnaList = default(IList), IList urls = default(IList)) + { + Name = name; + QnaList = qnaList; + Urls = urls; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets friendly name for the knowledgebase. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets list of Q-A (UpdateQnaDTO) to be added to the + /// knowledgebase. + /// + [JsonProperty(PropertyName = "qnaList")] + public IList QnaList { get; set; } + + /// + /// Gets or sets list of existing URLs to be refreshed. The content + /// will be extracted again and re-indexed. + /// + [JsonProperty(PropertyName = "urls")] + public IList Urls { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs new file mode 100644 index 000000000000..ddd2a0f9be18 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains list of QnAs to be updated + /// + public partial class UpdateKbOperationDTO + { + /// + /// Initializes a new instance of the UpdateKbOperationDTO class. + /// + public UpdateKbOperationDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateKbOperationDTO class. + /// + /// An instance of CreateKbInputDTO for add + /// operation + /// An instance of DeleteKbContentsDTO for delete + /// Operation + /// An instance of UpdateKbContentsDTO for Update + /// Operation + /// Enable hierarchical + /// extraction of Q-A from files and urls. The value set during KB + /// creation will be used if this field is not present. + /// Text string to be used + /// as the answer in any Q-A which has no extracted answer from the + /// document but has a hierarchy. Required when + /// EnableHierarchicalExtraction field is set to True. + public UpdateKbOperationDTO(UpdateKbOperationDTOAdd add = default(UpdateKbOperationDTOAdd), UpdateKbOperationDTODelete delete = default(UpdateKbOperationDTODelete), UpdateKbOperationDTOUpdate update = default(UpdateKbOperationDTOUpdate), bool? enableHierarchicalExtraction = default(bool?), string defaultAnswerUsedForExtraction = default(string)) + { + Add = add; + Delete = delete; + Update = update; + EnableHierarchicalExtraction = enableHierarchicalExtraction; + DefaultAnswerUsedForExtraction = defaultAnswerUsedForExtraction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an instance of CreateKbInputDTO for add operation + /// + [JsonProperty(PropertyName = "add")] + public UpdateKbOperationDTOAdd Add { get; set; } + + /// + /// Gets or sets an instance of DeleteKbContentsDTO for delete + /// Operation + /// + [JsonProperty(PropertyName = "delete")] + public UpdateKbOperationDTODelete Delete { get; set; } + + /// + /// Gets or sets an instance of UpdateKbContentsDTO for Update + /// Operation + /// + [JsonProperty(PropertyName = "update")] + public UpdateKbOperationDTOUpdate Update { get; set; } + + /// + /// Gets or sets enable hierarchical extraction of Q-A from files and + /// urls. The value set during KB creation will be used if this field + /// is not present. + /// + [JsonProperty(PropertyName = "enableHierarchicalExtraction")] + public bool? EnableHierarchicalExtraction { get; set; } + + /// + /// Gets or sets text string to be used as the answer in any Q-A which + /// has no extracted answer from the document but has a hierarchy. + /// Required when EnableHierarchicalExtraction field is set to True. + /// + [JsonProperty(PropertyName = "defaultAnswerUsedForExtraction")] + public string DefaultAnswerUsedForExtraction { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DefaultAnswerUsedForExtraction != null) + { + if (DefaultAnswerUsedForExtraction.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DefaultAnswerUsedForExtraction", 300); + } + if (DefaultAnswerUsedForExtraction.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DefaultAnswerUsedForExtraction", 1); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs new file mode 100644 index 000000000000..1c89e695d155 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An instance of CreateKbInputDTO for add operation + /// + public partial class UpdateKbOperationDTOAdd : CreateKbInputDTO + { + /// + /// Initializes a new instance of the UpdateKbOperationDTOAdd class. + /// + public UpdateKbOperationDTOAdd() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateKbOperationDTOAdd class. + /// + /// List of QNA to be added to the index. Ids are + /// generated by the service and should be omitted. + /// List of URLs to be added to + /// knowledgebase. + /// List of files to be added to + /// knowledgebase. + public UpdateKbOperationDTOAdd(IList qnaList = default(IList), IList urls = default(IList), IList files = default(IList)) + : base(qnaList, urls, files) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs new file mode 100644 index 000000000000..8dfd2b27b14f --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An instance of DeleteKbContentsDTO for delete Operation + /// + public partial class UpdateKbOperationDTODelete : DeleteKbContentsDTO + { + /// + /// Initializes a new instance of the UpdateKbOperationDTODelete class. + /// + public UpdateKbOperationDTODelete() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateKbOperationDTODelete class. + /// + /// List of Qna Ids to be deleted + /// List of sources to be deleted from + /// knowledgebase. + public UpdateKbOperationDTODelete(IList ids = default(IList), IList sources = default(IList)) + : base(ids, sources) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs new file mode 100644 index 000000000000..946b91319be1 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An instance of UpdateKbContentsDTO for Update Operation + /// + public partial class UpdateKbOperationDTOUpdate : UpdateKbContentsDTO + { + /// + /// Initializes a new instance of the UpdateKbOperationDTOUpdate class. + /// + public UpdateKbOperationDTOUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateKbOperationDTOUpdate class. + /// + /// Friendly name for the knowledgebase. + /// List of Q-A (UpdateQnaDTO) to be added to the + /// knowledgebase. + /// List of existing URLs to be refreshed. The + /// content will be extracted again and re-indexed. + public UpdateKbOperationDTOUpdate(string name = default(string), IList qnaList = default(IList), IList urls = default(IList)) + : base(name, qnaList, urls) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs new file mode 100644 index 000000000000..e6fc685aa529 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// PATCH Body schema to represent list of Metadata to be updated + /// + public partial class UpdateMetadataDTO + { + /// + /// Initializes a new instance of the UpdateMetadataDTO class. + /// + public UpdateMetadataDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateMetadataDTO class. + /// + /// List of Metadata associated with answer to be + /// deleted + /// List of metadata associated with answer to be + /// added + public UpdateMetadataDTO(IList delete = default(IList), IList add = default(IList)) + { + Delete = delete; + Add = add; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Metadata associated with answer to be deleted + /// + [JsonProperty(PropertyName = "delete")] + public IList Delete { get; set; } + + /// + /// Gets or sets list of metadata associated with answer to be added + /// + [JsonProperty(PropertyName = "add")] + public IList Add { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs new file mode 100644 index 000000000000..256e9c66a16a --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs @@ -0,0 +1,125 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// PATCH Body schema for Update Qna List + /// + public partial class UpdateQnaDTO + { + /// + /// Initializes a new instance of the UpdateQnaDTO class. + /// + public UpdateQnaDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateQnaDTO class. + /// + /// Unique id for the Q-A + /// Answer text + /// Source from which Q-A was indexed. eg. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + /// List of questions associated with the + /// answer. + /// List of metadata associated with the answer + /// to be updated + /// Context associated with Qna to be + /// updated. + public UpdateQnaDTO(int? id = default(int?), string answer = default(string), string source = default(string), UpdateQnaDTOQuestions questions = default(UpdateQnaDTOQuestions), UpdateQnaDTOMetadata metadata = default(UpdateQnaDTOMetadata), UpdateQnaDTOContext context = default(UpdateQnaDTOContext)) + { + Id = id; + Answer = answer; + Source = source; + Questions = questions; + Metadata = metadata; + Context = context; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique id for the Q-A + /// + [JsonProperty(PropertyName = "id")] + public int? Id { get; set; } + + /// + /// Gets or sets answer text + /// + [JsonProperty(PropertyName = "answer")] + public string Answer { get; set; } + + /// + /// Gets or sets source from which Q-A was indexed. eg. + /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + /// + [JsonProperty(PropertyName = "source")] + public string Source { get; set; } + + /// + /// Gets or sets list of questions associated with the answer. + /// + [JsonProperty(PropertyName = "questions")] + public UpdateQnaDTOQuestions Questions { get; set; } + + /// + /// Gets or sets list of metadata associated with the answer to be + /// updated + /// + [JsonProperty(PropertyName = "metadata")] + public UpdateQnaDTOMetadata Metadata { get; set; } + + /// + /// Gets or sets context associated with Qna to be updated. + /// + [JsonProperty(PropertyName = "context")] + public UpdateQnaDTOContext Context { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id != null) + { + if (Id > 2147483647) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Id", 2147483647); + } + if (Id < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Id", 0); + } + } + if (Source != null) + { + if (Source.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Source", 300); + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs new file mode 100644 index 000000000000..534802453788 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Context associated with Qna to be updated. + /// + public partial class UpdateQnaDTOContext : UpdateContextDTO + { + /// + /// Initializes a new instance of the UpdateQnaDTOContext class. + /// + public UpdateQnaDTOContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateQnaDTOContext class. + /// + /// List of prompts associated with qna + /// to be deleted + /// List of prompts to be added to the + /// qna. + /// To mark if a prompt is relevant only + /// with a previous question or not. + /// true - Do not include this QnA as search result for queries without + /// context + /// false - ignores context and includes this QnA in search + /// result + public UpdateQnaDTOContext(IList promptsToDelete = default(IList), IList promptsToAdd = default(IList), bool? isContextOnly = default(bool?)) + : base(promptsToDelete, promptsToAdd, isContextOnly) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs new file mode 100644 index 000000000000..3a5f6edaf25f --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of metadata associated with the answer to be updated + /// + public partial class UpdateQnaDTOMetadata : UpdateMetadataDTO + { + /// + /// Initializes a new instance of the UpdateQnaDTOMetadata class. + /// + public UpdateQnaDTOMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateQnaDTOMetadata class. + /// + /// List of Metadata associated with answer to be + /// deleted + /// List of metadata associated with answer to be + /// added + public UpdateQnaDTOMetadata(IList delete = default(IList), IList add = default(IList)) + : base(delete, add) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs new file mode 100644 index 000000000000..84bac8e43f47 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of questions associated with the answer. + /// + public partial class UpdateQnaDTOQuestions : UpdateQuestionsDTO + { + /// + /// Initializes a new instance of the UpdateQnaDTOQuestions class. + /// + public UpdateQnaDTOQuestions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateQnaDTOQuestions class. + /// + /// List of questions to be added + /// List of questions to be deleted. + public UpdateQnaDTOQuestions(IList add = default(IList), IList delete = default(IList)) + : base(add, delete) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs new file mode 100644 index 000000000000..145d39c3717a --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// PATCH Body schema for Update Kb which contains list of questions to be + /// added and deleted + /// + public partial class UpdateQuestionsDTO + { + /// + /// Initializes a new instance of the UpdateQuestionsDTO class. + /// + public UpdateQuestionsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateQuestionsDTO class. + /// + /// List of questions to be added + /// List of questions to be deleted. + public UpdateQuestionsDTO(IList add = default(IList), IList delete = default(IList)) + { + Add = add; + Delete = delete; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of questions to be added + /// + [JsonProperty(PropertyName = "add")] + public IList Add { get; set; } + + /// + /// Gets or sets list of questions to be deleted. + /// + [JsonProperty(PropertyName = "delete")] + public IList Delete { get; set; } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs new file mode 100644 index 000000000000..615fc32dce93 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Collection of word alterations. + /// + public partial class WordAlterationsDTO + { + /// + /// Initializes a new instance of the WordAlterationsDTO class. + /// + public WordAlterationsDTO() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WordAlterationsDTO class. + /// + /// Collection of word + /// alterations. + public WordAlterationsDTO(IList wordAlterations) + { + WordAlterations = wordAlterations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets collection of word alterations. + /// + [JsonProperty(PropertyName = "wordAlterations")] + public IList WordAlterations { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WordAlterations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WordAlterations"); + } + if (WordAlterations != null) + { + foreach (var element in WordAlterations) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs new file mode 100644 index 000000000000..bdf95f9ac983 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Operations(QnAMakerClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the QnAMakerClient + /// + public QnAMakerClient Client { get; private set; } + + /// + /// Gets details of a specific long running operation. + /// + /// + /// Operation id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDetailsWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.Endpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDetails", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "operations/{operationId}"; + _url = _url.Replace("{Endpoint}", Client.Endpoint); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..6b29a5a63c44 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Gets details of a specific long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Operation id. + /// + /// + /// The cancellation token. + /// + public static async Task GetDetailsAsync(this IOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDetailsWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs new file mode 100644 index 000000000000..accd08c0f5ca --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs @@ -0,0 +1,239 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + /// + /// An API for QnAMaker Service + /// + public partial class QnAMakerClient : ServiceClient, IQnAMakerClient + { + /// + /// The base URI of the service. + /// + internal string BaseUri {get; set;} + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Supported Cognitive Services endpoints (protocol and hostname, for example: + /// https://westus.api.cognitive.microsoft.com). + /// + public string Endpoint { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the IEndpointSettings. + /// + public virtual IEndpointSettings EndpointSettings { get; private set; } + + /// + /// Gets the IEndpointKeys. + /// + public virtual IEndpointKeys EndpointKeys { get; private set; } + + /// + /// Gets the IAlterations. + /// + public virtual IAlterations Alterations { get; private set; } + + /// + /// Gets the IKnowledgebase. + /// + public virtual IKnowledgebase Knowledgebase { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the QnAMakerClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling QnAMakerClient.Dispose(). False: will not dispose provided httpClient + protected QnAMakerClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the QnAMakerClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected QnAMakerClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the QnAMakerClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected QnAMakerClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the QnAMakerClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public QnAMakerClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the QnAMakerClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling QnAMakerClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public QnAMakerClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the QnAMakerClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public QnAMakerClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + EndpointSettings = new EndpointSettings(this); + EndpointKeys = new EndpointKeys(this); + Alterations = new Alterations(this); + Knowledgebase = new Knowledgebase(this); + Operations = new Operations(this); + BaseUri = "{Endpoint}/qnamaker/v4.0"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs new file mode 100644 index 000000000000..44965c01fc5f --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs @@ -0,0 +1,215 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Net; + using System.Net.Http; + + /// + /// An API for QnAMaker runtime + /// + public partial class QnAMakerRuntimeClient : ServiceClient, IQnAMakerRuntimeClient + { + /// + /// The base URI of the service. + /// + internal string BaseUri {get; set;} + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// QnA Maker App Service endpoint (for example: + /// https://{qnaservice-hostname}.azurewebsites.net). + /// + public string RuntimeEndpoint { get; set; } + + /// + /// Subscription credentials which uniquely identify client subscription. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// Gets the IRuntime. + /// + public virtual IRuntime Runtime { get; private set; } + + /// + /// Initializes a new instance of the QnAMakerRuntimeClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling QnAMakerRuntimeClient.Dispose(). False: will not dispose provided httpClient + protected QnAMakerRuntimeClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the QnAMakerRuntimeClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected QnAMakerRuntimeClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the QnAMakerRuntimeClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected QnAMakerRuntimeClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the QnAMakerRuntimeClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public QnAMakerRuntimeClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the QnAMakerRuntimeClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling QnAMakerRuntimeClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public QnAMakerRuntimeClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the QnAMakerRuntimeClient class. + /// + /// + /// Required. Subscription credentials which uniquely identify client subscription. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public QnAMakerRuntimeClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Runtime = new Runtime(this); + BaseUri = "{RuntimeEndpoint}/qnamaker"; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs new file mode 100644 index 000000000000..3d9d1956dcfa --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs @@ -0,0 +1,367 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Runtime operations. + /// + public partial class Runtime : IServiceOperations, IRuntime + { + /// + /// Initializes a new instance of the Runtime class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public Runtime(QnAMakerRuntimeClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the QnAMakerRuntimeClient + /// + public QnAMakerRuntimeClient Client { get; private set; } + + /// + /// GenerateAnswer call to query the knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GenerateAnswerWithHttpMessagesAsync(string kbId, QueryDTO generateAnswerPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.RuntimeEndpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.RuntimeEndpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + if (generateAnswerPayload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "generateAnswerPayload"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("generateAnswerPayload", generateAnswerPayload); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateAnswer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}/generateAnswer"; + _url = _url.Replace("{RuntimeEndpoint}", Client.RuntimeEndpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(generateAnswerPayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateAnswerPayload, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Train call to add suggestions to the knowledgebase. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task TrainWithHttpMessagesAsync(string kbId, FeedbackRecordsDTO trainPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.RuntimeEndpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.RuntimeEndpoint"); + } + if (kbId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); + } + if (trainPayload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "trainPayload"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("kbId", kbId); + tracingParameters.Add("trainPayload", trainPayload); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Train", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri; + var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}/train"; + _url = _url.Replace("{RuntimeEndpoint}", Client.RuntimeEndpoint); + _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(trainPayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(trainPayload, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs new file mode 100644 index 000000000000..df68ae55bf38 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Runtime. + /// + public static partial class RuntimeExtensions + { + /// + /// GenerateAnswer call to query the knowledgebase. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateAnswerAsync(this IRuntime operations, string kbId, QueryDTO generateAnswerPayload, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateAnswerWithHttpMessagesAsync(kbId, generateAnswerPayload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Train call to add suggestions to the knowledgebase. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Knowledgebase id. + /// + /// + /// Post body of the request. + /// + /// + /// The cancellation token. + /// + public static async Task TrainAsync(this IRuntime operations, string kbId, FeedbackRecordsDTO trainPayload, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.TrainWithHttpMessagesAsync(kbId, trainPayload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.md index 23b55def218b..54433715a852 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.md @@ -5,6 +5,8 @@ Configuration for generating QnAMaker SDK. The current release is `release_4_0`. +A preview release `release_5_0_preview.1` is also available. + ``` yaml @@ -26,6 +28,19 @@ tag: runtime_release_4_0 add-credentials: true openapi-type: data-plane ``` + +### Release 5.0-preview.1 +These settings apply only when `--tag=release_5_0_preview.1` is specified on the command line. + +``` yaml $(tag) == 'release_4_0' +input-file: preview/v5.0-preview.1/QnAMaker.json +``` + +``` yaml +tag: runtime_release_5_0_preview.1 +add-credentials: true +openapi-type: data-plane +``` # Runtime Releases ### Runtime Release 4.0 @@ -40,6 +55,19 @@ batch: - tag: release_4_0 - tag: runtime_release_4_0 ``` +### Runtime Release 5.0-preview.1 +These settings apply only when `--tag=runtime_release_5_0_preview.1` is specified on the command line. + +``` yaml $(tag) == 'runtime_release_5_0-preview.1' +input-file: preview/v5.0-preview.1/QnAMakerRuntime.json +``` + +``` yaml +batch: + - tag: release_5_0_preview.1 + - tag: runtime_release_5_0_preview.1 +``` + ## Swagger to SDK From 15b42b8b5b14522cd7cb503546fba088d61b2c3c Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 00:51:40 +0530 Subject: [PATCH 03/24] undo pushed mistaken files pushed --- .../src/Generated/Alterations.cs | 339 ----- .../src/Generated/AlterationsExtensions.cs | 57 - .../src/Generated/EndpointKeys.cs | 351 ----- .../src/Generated/EndpointKeysExtensions.cs | 60 - .../src/Generated/EndpointSettings.cs | 335 ----- .../Generated/EndpointSettingsExtensions.cs | 57 - .../src/Generated/IAlterations.cs | 64 - .../src/Generated/IEndpointKeys.cs | 67 - .../src/Generated/IEndpointSettings.cs | 64 - .../src/Generated/IKnowledgebase.cs | 202 --- .../src/Generated/IOperations.cs | 48 - .../src/Generated/IQnAMakerClient.cs | 75 - .../src/Generated/IQnAMakerRuntimeClient.cs | 55 - .../src/Generated/IRuntime.cs | 73 - .../src/Generated/Knowledgebase.cs | 1270 ----------------- .../src/Generated/KnowledgebaseExtensions.cs | 181 --- .../Models/ActiveLearningSettingsDTO.cs | 52 - .../src/Generated/Models/AlterationsDTO.cs | 68 - .../src/Generated/Models/ContextDTO.cs | 95 -- .../src/Generated/Models/CreateKbDTO.cs | 187 --- .../src/Generated/Models/CreateKbInputDTO.cs | 73 - .../Generated/Models/DeleteKbContentsDTO.cs | 62 - .../src/Generated/Models/EndpointKeysDTO.cs | 83 -- .../Generated/Models/EndpointSettingsDTO.cs | 52 - .../EndpointSettingsDTOActiveLearning.cs | 47 - .../src/Generated/Models/EnvironmentType.cs | 22 - .../src/Generated/Models/Error.cs | 125 -- .../src/Generated/Models/ErrorCodeType.cs | 34 - .../src/Generated/Models/ErrorResponse.cs | 52 - .../Generated/Models/ErrorResponseError.cs | 68 - .../Models/ErrorResponseException.cs | 62 - .../src/Generated/Models/FeedbackRecordDTO.cs | 87 -- .../Generated/Models/FeedbackRecordsDTO.cs | 53 - .../src/Generated/Models/FileDTO.cs | 90 -- .../src/Generated/Models/InnerErrorModel.cs | 65 - .../src/Generated/Models/KnowledgebaseDTO.cs | 129 -- .../Models/KnowledgebaseUpdateHeaders.cs | 55 - .../src/Generated/Models/KnowledgebasesDTO.cs | 54 - .../src/Generated/Models/MetadataDTO.cs | 99 -- .../src/Generated/Models/Operation.cs | 106 -- .../Generated/Models/OperationStateType.cs | 24 - .../Models/OperationsGetDetailsHeaders.cs | 57 - .../src/Generated/Models/PromptDTO.cs | 103 -- .../src/Generated/Models/PromptDTOQna.cs | 65 - .../src/Generated/Models/QnADTO.cs | 147 -- .../src/Generated/Models/QnADTOContext.cs | 63 - .../src/Generated/Models/QnADocumentsDTO.cs | 53 - .../src/Generated/Models/QnASearchResult.cs | 101 -- .../Models/QnASearchResultContext.cs | 63 - .../Generated/Models/QnASearchResultList.cs | 53 - .../src/Generated/Models/QueryContextDTO.cs | 60 - .../src/Generated/Models/QueryDTO.cs | 143 -- .../src/Generated/Models/QueryDTOContext.cs | 46 - .../src/Generated/Models/ReplaceKbDTO.cs | 80 -- .../StrictFiltersCompoundOperationType.cs | 22 - .../src/Generated/Models/UpdateContextDTO.cs | 80 -- .../Generated/Models/UpdateKbContentsDTO.cs | 73 - .../Generated/Models/UpdateKbOperationDTO.cs | 118 -- .../Models/UpdateKbOperationDTOAdd.cs | 51 - .../Models/UpdateKbOperationDTODelete.cs | 48 - .../Models/UpdateKbOperationDTOUpdate.cs | 50 - .../src/Generated/Models/UpdateMetadataDTO.cs | 63 - .../src/Generated/Models/UpdateQnaDTO.cs | 125 -- .../Generated/Models/UpdateQnaDTOContext.cs | 55 - .../Generated/Models/UpdateQnaDTOMetadata.cs | 49 - .../Generated/Models/UpdateQnaDTOQuestions.cs | 47 - .../Generated/Models/UpdateQuestionsDTO.cs | 62 - .../Generated/Models/WordAlterationsDTO.cs | 78 - .../src/Generated/Operations.cs | 220 --- .../src/Generated/OperationsExtensions.cs | 43 - .../src/Generated/QnAMakerClient.cs | 239 ---- .../src/Generated/QnAMakerRuntimeClient.cs | 215 --- .../src/Generated/Runtime.cs | 367 ----- .../src/Generated/RuntimeExtensions.cs | 66 - 74 files changed, 8247 deletions(-) delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs deleted file mode 100644 index ddb65cca37af..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Alterations.cs +++ /dev/null @@ -1,339 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Alterations operations. - /// - public partial class Alterations : IServiceOperations, IAlterations - { - /// - /// Initializes a new instance of the Alterations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Alterations(QnAMakerClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QnAMakerClient - /// - public QnAMakerClient Client { get; private set; } - - /// - /// Download alterations from runtime. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "alterations"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Replace alterations data. - /// - /// - /// New alterations data. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task ReplaceWithHttpMessagesAsync(WordAlterationsDTO wordAlterations, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (wordAlterations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "wordAlterations"); - } - if (wordAlterations != null) - { - wordAlterations.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("wordAlterations", wordAlterations); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Replace", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "alterations"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(wordAlterations != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(wordAlterations, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs deleted file mode 100644 index f1fc89cb4045..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/AlterationsExtensions.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Alterations. - /// - public static partial class AlterationsExtensions - { - /// - /// Download alterations from runtime. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAlterations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Replace alterations data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// New alterations data. - /// - /// - /// The cancellation token. - /// - public static async Task ReplaceAsync(this IAlterations operations, WordAlterationsDTO wordAlterations, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ReplaceWithHttpMessagesAsync(wordAlterations, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs deleted file mode 100644 index af6ccaa0d9b7..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeys.cs +++ /dev/null @@ -1,351 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// EndpointKeys operations. - /// - public partial class EndpointKeys : IServiceOperations, IEndpointKeys - { - /// - /// Initializes a new instance of the EndpointKeys class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public EndpointKeys(QnAMakerClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QnAMakerClient - /// - public QnAMakerClient Client { get; private set; } - - /// - /// Gets endpoint keys for an endpoint - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetKeysWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetKeys", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointkeys"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Re-generates an endpoint key. - /// - /// - /// Type of Key - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> RefreshKeysWithHttpMessagesAsync(string keyType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (keyType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "keyType"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("keyType", keyType); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RefreshKeys", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointkeys/{keyType}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{keyType}", System.Uri.EscapeDataString(keyType)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs deleted file mode 100644 index 3fb365dae349..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointKeysExtensions.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for EndpointKeys. - /// - public static partial class EndpointKeysExtensions - { - /// - /// Gets endpoint keys for an endpoint - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetKeysAsync(this IEndpointKeys operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetKeysWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Re-generates an endpoint key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Type of Key - /// - /// - /// The cancellation token. - /// - public static async Task RefreshKeysAsync(this IEndpointKeys operations, string keyType, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.RefreshKeysWithHttpMessagesAsync(keyType, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs deleted file mode 100644 index 42098991d6b3..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettings.cs +++ /dev/null @@ -1,335 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// EndpointSettings operations. - /// - public partial class EndpointSettings : IServiceOperations, IEndpointSettings - { - /// - /// Initializes a new instance of the EndpointSettings class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public EndpointSettings(QnAMakerClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QnAMakerClient - /// - public QnAMakerClient Client { get; private set; } - - /// - /// Gets endpoint settings for an endpoint. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetSettingsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetSettings", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointSettings"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates endpoint settings for an endpoint. - /// - /// - /// Post body of the request. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task UpdateSettingsWithHttpMessagesAsync(EndpointSettingsDTO endpointSettingsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (endpointSettingsPayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "endpointSettingsPayload"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("endpointSettingsPayload", endpointSettingsPayload); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateSettings", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "endpointSettings"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(endpointSettingsPayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(endpointSettingsPayload, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs deleted file mode 100644 index 07b8a7a6d430..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/EndpointSettingsExtensions.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for EndpointSettings. - /// - public static partial class EndpointSettingsExtensions - { - /// - /// Gets endpoint settings for an endpoint. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetSettingsAsync(this IEndpointSettings operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetSettingsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates endpoint settings for an endpoint. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Post body of the request. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateSettingsAsync(this IEndpointSettings operations, EndpointSettingsDTO endpointSettingsPayload, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateSettingsWithHttpMessagesAsync(endpointSettingsPayload, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs deleted file mode 100644 index 6ffc7bf297d9..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IAlterations.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Alterations operations. - /// - public partial interface IAlterations - { - /// - /// Download alterations from runtime. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Replace alterations data. - /// - /// - /// New alterations data. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task ReplaceWithHttpMessagesAsync(WordAlterationsDTO wordAlterations, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs deleted file mode 100644 index 513695533962..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointKeys.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// EndpointKeys operations. - /// - public partial interface IEndpointKeys - { - /// - /// Gets endpoint keys for an endpoint - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetKeysWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Re-generates an endpoint key. - /// - /// - /// Type of Key - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> RefreshKeysWithHttpMessagesAsync(string keyType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs deleted file mode 100644 index 86fc48a9037e..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IEndpointSettings.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// EndpointSettings operations. - /// - public partial interface IEndpointSettings - { - /// - /// Gets endpoint settings for an endpoint. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetSettingsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates endpoint settings for an endpoint. - /// - /// - /// Post body of the request. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task UpdateSettingsWithHttpMessagesAsync(EndpointSettingsDTO endpointSettingsPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs deleted file mode 100644 index 982fe8f5ba5e..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IKnowledgebase.cs +++ /dev/null @@ -1,202 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Knowledgebase operations. - /// - public partial interface IKnowledgebase - { - /// - /// Gets all knowledgebases for a user. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets details of a specific knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetDetailsWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the knowledgebase and all its data. - /// - /// - /// Knowledgebase id. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Publishes all changes in test index of a knowledgebase to its prod - /// index. - /// - /// - /// Knowledgebase id. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task PublishWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Replace knowledgebase contents. - /// - /// - /// Knowledgebase id. - /// - /// - /// An instance of ReplaceKbDTO which contains list of qnas to be - /// uploaded - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task ReplaceWithHttpMessagesAsync(string kbId, ReplaceKbDTO replaceKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Asynchronous operation to modify a knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string kbId, UpdateKbOperationDTO updateKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Asynchronous operation to create a new knowledgebase. - /// - /// - /// Post body of the request. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateWithHttpMessagesAsync(CreateKbDTO createKbPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Download the knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Specifies whether environment is Test or Prod. Possible values - /// include: 'Prod', 'Test' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> DownloadWithHttpMessagesAsync(string kbId, string environment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs deleted file mode 100644 index 2a75e8668cf0..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IOperations.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Operations operations. - /// - public partial interface IOperations - { - /// - /// Gets details of a specific long running operation. - /// - /// - /// Operation id. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetDetailsWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs deleted file mode 100644 index 8133122a671a..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerClient.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - - /// - /// An API for QnAMaker Service - /// - public partial interface IQnAMakerClient : System.IDisposable - { - /// - /// The base URI of the service. - /// - - /// - /// Gets or sets json serialization settings. - /// - JsonSerializerSettings SerializationSettings { get; } - - /// - /// Gets or sets json deserialization settings. - /// - JsonSerializerSettings DeserializationSettings { get; } - - /// - /// Supported Cognitive Services endpoints (protocol and hostname, for - /// example: https://westus.api.cognitive.microsoft.com). - /// - string Endpoint { get; set; } - - /// - /// Subscription credentials which uniquely identify client - /// subscription. - /// - ServiceClientCredentials Credentials { get; } - - - /// - /// Gets the IEndpointSettings. - /// - IEndpointSettings EndpointSettings { get; } - - /// - /// Gets the IEndpointKeys. - /// - IEndpointKeys EndpointKeys { get; } - - /// - /// Gets the IAlterations. - /// - IAlterations Alterations { get; } - - /// - /// Gets the IKnowledgebase. - /// - IKnowledgebase Knowledgebase { get; } - - /// - /// Gets the IOperations. - /// - IOperations Operations { get; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs deleted file mode 100644 index d406f3f737a8..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IQnAMakerRuntimeClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - - /// - /// An API for QnAMaker runtime - /// - public partial interface IQnAMakerRuntimeClient : System.IDisposable - { - /// - /// The base URI of the service. - /// - - /// - /// Gets or sets json serialization settings. - /// - JsonSerializerSettings SerializationSettings { get; } - - /// - /// Gets or sets json deserialization settings. - /// - JsonSerializerSettings DeserializationSettings { get; } - - /// - /// QnA Maker App Service endpoint (for example: - /// https://{qnaservice-hostname}.azurewebsites.net). - /// - string RuntimeEndpoint { get; set; } - - /// - /// Subscription credentials which uniquely identify client - /// subscription. - /// - ServiceClientCredentials Credentials { get; } - - - /// - /// Gets the IRuntime. - /// - IRuntime Runtime { get; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs deleted file mode 100644 index fdf4d89ff567..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/IRuntime.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Runtime operations. - /// - public partial interface IRuntime - { - /// - /// GenerateAnswer call to query the knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GenerateAnswerWithHttpMessagesAsync(string kbId, QueryDTO generateAnswerPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Train call to add suggestions to the knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task TrainWithHttpMessagesAsync(string kbId, FeedbackRecordsDTO trainPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs deleted file mode 100644 index 8d07f34a1f9d..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Knowledgebase.cs +++ /dev/null @@ -1,1270 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Knowledgebase operations. - /// - public partial class Knowledgebase : IServiceOperations, IKnowledgebase - { - /// - /// Initializes a new instance of the Knowledgebase class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Knowledgebase(QnAMakerClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QnAMakerClient - /// - public QnAMakerClient Client { get; private set; } - - /// - /// Gets all knowledgebases for a user. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets details of a specific knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDetailsWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDetails", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes the knowledgebase and all its data. - /// - /// - /// Knowledgebase id. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Publishes all changes in test index of a knowledgebase to its prod index. - /// - /// - /// Knowledgebase id. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task PublishWithHttpMessagesAsync(string kbId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Publish", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Replace knowledgebase contents. - /// - /// - /// Knowledgebase id. - /// - /// - /// An instance of ReplaceKbDTO which contains list of qnas to be uploaded - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task ReplaceWithHttpMessagesAsync(string kbId, ReplaceKbDTO replaceKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - if (replaceKb == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "replaceKb"); - } - if (replaceKb != null) - { - replaceKb.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("replaceKb", replaceKb); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Replace", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(replaceKb != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(replaceKb, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Asynchronous operation to modify a knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> UpdateWithHttpMessagesAsync(string kbId, UpdateKbOperationDTO updateKb, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - if (updateKb == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateKb"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("updateKb", updateKb); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(updateKb != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateKb, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 202) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 202) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Asynchronous operation to create a new knowledgebase. - /// - /// - /// Post body of the request. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateWithHttpMessagesAsync(CreateKbDTO createKbPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (createKbPayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "createKbPayload"); - } - if (createKbPayload != null) - { - createKbPayload.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("createKbPayload", createKbPayload); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/create"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(createKbPayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createKbPayload, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 202) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 202) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Download the knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Specifies whether environment is Test or Prod. Possible values include: - /// 'Prod', 'Test' - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> DownloadWithHttpMessagesAsync(string kbId, string environment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - if (environment == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "environment"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("environment", environment); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Download", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}/{environment}/qna"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - _url = _url.Replace("{environment}", System.Uri.EscapeDataString(environment)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs deleted file mode 100644 index bfd8fa62c72a..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/KnowledgebaseExtensions.cs +++ /dev/null @@ -1,181 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Knowledgebase. - /// - public static partial class KnowledgebaseExtensions - { - /// - /// Gets all knowledgebases for a user. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ListAllAsync(this IKnowledgebase operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets details of a specific knowledgebase. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// The cancellation token. - /// - public static async Task GetDetailsAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDetailsWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the knowledgebase and all its data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Publishes all changes in test index of a knowledgebase to its prod index. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// The cancellation token. - /// - public static async Task PublishAsync(this IKnowledgebase operations, string kbId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PublishWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Replace knowledgebase contents. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// An instance of ReplaceKbDTO which contains list of qnas to be uploaded - /// - /// - /// The cancellation token. - /// - public static async Task ReplaceAsync(this IKnowledgebase operations, string kbId, ReplaceKbDTO replaceKb, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ReplaceWithHttpMessagesAsync(kbId, replaceKb, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Asynchronous operation to modify a knowledgebase. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IKnowledgebase operations, string kbId, UpdateKbOperationDTO updateKb, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(kbId, updateKb, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Asynchronous operation to create a new knowledgebase. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Post body of the request. - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IKnowledgebase operations, CreateKbDTO createKbPayload, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(createKbPayload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Download the knowledgebase. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// Specifies whether environment is Test or Prod. Possible values include: - /// 'Prod', 'Test' - /// - /// - /// The cancellation token. - /// - public static async Task DownloadAsync(this IKnowledgebase operations, string kbId, string environment, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DownloadWithHttpMessagesAsync(kbId, environment, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs deleted file mode 100644 index 0fb5bd71670d..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ActiveLearningSettingsDTO.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Active Learning settings of the endpoint. - /// - public partial class ActiveLearningSettingsDTO - { - /// - /// Initializes a new instance of the ActiveLearningSettingsDTO class. - /// - public ActiveLearningSettingsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ActiveLearningSettingsDTO class. - /// - /// True/False string providing Active - /// Learning - public ActiveLearningSettingsDTO(string enable = default(string)) - { - Enable = enable; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets true/False string providing Active Learning - /// - [JsonProperty(PropertyName = "enable")] - public string Enable { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs deleted file mode 100644 index b931630ed733..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/AlterationsDTO.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Collection of words that are synonyms. - /// - public partial class AlterationsDTO - { - /// - /// Initializes a new instance of the AlterationsDTO class. - /// - public AlterationsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlterationsDTO class. - /// - /// Words that are synonymous with each - /// other. - public AlterationsDTO(IList alterations) - { - Alterations = alterations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets words that are synonymous with each other. - /// - [JsonProperty(PropertyName = "alterations")] - public IList Alterations { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Alterations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Alterations"); - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs deleted file mode 100644 index 9a2b93b636cc..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ContextDTO.cs +++ /dev/null @@ -1,95 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Context associated with Qna. - /// - public partial class ContextDTO - { - /// - /// Initializes a new instance of the ContextDTO class. - /// - public ContextDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ContextDTO class. - /// - /// To mark if a prompt is relevant only - /// with a previous question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search - /// result - /// List of prompts associated with the - /// answer. - public ContextDTO(bool? isContextOnly = default(bool?), IList prompts = default(IList)) - { - IsContextOnly = isContextOnly; - Prompts = prompts; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets to mark if a prompt is relevant only with a previous - /// question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search result - /// - [JsonProperty(PropertyName = "isContextOnly")] - public bool? IsContextOnly { get; set; } - - /// - /// Gets or sets list of prompts associated with the answer. - /// - [JsonProperty(PropertyName = "prompts")] - public IList Prompts { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Prompts != null) - { - if (Prompts.Count > 20) - { - throw new ValidationException(ValidationRules.MaxItems, "Prompts", 20); - } - foreach (var element in Prompts) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs deleted file mode 100644 index 6aabb7498a94..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbDTO.cs +++ /dev/null @@ -1,187 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Post body schema for CreateKb operation. - /// - public partial class CreateKbDTO - { - /// - /// Initializes a new instance of the CreateKbDTO class. - /// - public CreateKbDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CreateKbDTO class. - /// - /// Friendly name for the knowledgebase. - /// List of Q-A (QnADTO) to be added to the - /// knowledgebase. Q-A Ids are assigned by the service and should be - /// omitted. - /// List of URLs to be used for extracting - /// Q-A. - /// List of files from which to Extract - /// Q-A. - /// Enable hierarchical - /// extraction of Q-A from files and urls. Value to be considered False - /// if this field is not present. - /// Text string to be used - /// as the answer in any Q-A which has no extracted answer from the - /// document but has a hierarchy. Required when - /// EnableHierarchicalExtraction field is set to True. - /// Language of the knowledgebase. Please find - /// the list of supported languages <a - /// href="https://aka.ms/qnamaker-languages#languages-supported" - /// target="_blank">here</a>. - public CreateKbDTO(string name, IList qnaList = default(IList), IList urls = default(IList), IList files = default(IList), bool? enableHierarchicalExtraction = default(bool?), string defaultAnswerUsedForExtraction = default(string), string language = default(string)) - { - Name = name; - QnaList = qnaList; - Urls = urls; - Files = files; - EnableHierarchicalExtraction = enableHierarchicalExtraction; - DefaultAnswerUsedForExtraction = defaultAnswerUsedForExtraction; - Language = language; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets friendly name for the knowledgebase. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets list of Q-A (QnADTO) to be added to the knowledgebase. - /// Q-A Ids are assigned by the service and should be omitted. - /// - [JsonProperty(PropertyName = "qnaList")] - public IList QnaList { get; set; } - - /// - /// Gets or sets list of URLs to be used for extracting Q-A. - /// - [JsonProperty(PropertyName = "urls")] - public IList Urls { get; set; } - - /// - /// Gets or sets list of files from which to Extract Q-A. - /// - [JsonProperty(PropertyName = "files")] - public IList Files { get; set; } - - /// - /// Gets or sets enable hierarchical extraction of Q-A from files and - /// urls. Value to be considered False if this field is not present. - /// - [JsonProperty(PropertyName = "enableHierarchicalExtraction")] - public bool? EnableHierarchicalExtraction { get; set; } - - /// - /// Gets or sets text string to be used as the answer in any Q-A which - /// has no extracted answer from the document but has a hierarchy. - /// Required when EnableHierarchicalExtraction field is set to True. - /// - [JsonProperty(PropertyName = "defaultAnswerUsedForExtraction")] - public string DefaultAnswerUsedForExtraction { get; set; } - - /// - /// Gets or sets language of the knowledgebase. Please find the list of - /// supported languages &lt;a - /// href="https://aka.ms/qnamaker-languages#languages-supported" - /// target="_blank"&gt;here&lt;/a&gt;. - /// - [JsonProperty(PropertyName = "language")] - public string Language { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Name != null) - { - if (Name.Length > 100) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 100); - } - if (Name.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 1); - } - } - if (QnaList != null) - { - foreach (var element in QnaList) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Files != null) - { - foreach (var element1 in Files) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (DefaultAnswerUsedForExtraction != null) - { - if (DefaultAnswerUsedForExtraction.Length > 300) - { - throw new ValidationException(ValidationRules.MaxLength, "DefaultAnswerUsedForExtraction", 300); - } - if (DefaultAnswerUsedForExtraction.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "DefaultAnswerUsedForExtraction", 1); - } - } - if (Language != null) - { - if (Language.Length > 100) - { - throw new ValidationException(ValidationRules.MaxLength, "Language", 100); - } - if (Language.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Language", 1); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs deleted file mode 100644 index 9dcda9a75796..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/CreateKbInputDTO.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Input to create KB. - /// - public partial class CreateKbInputDTO - { - /// - /// Initializes a new instance of the CreateKbInputDTO class. - /// - public CreateKbInputDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CreateKbInputDTO class. - /// - /// List of QNA to be added to the index. Ids are - /// generated by the service and should be omitted. - /// List of URLs to be added to - /// knowledgebase. - /// List of files to be added to - /// knowledgebase. - public CreateKbInputDTO(IList qnaList = default(IList), IList urls = default(IList), IList files = default(IList)) - { - QnaList = qnaList; - Urls = urls; - Files = files; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of QNA to be added to the index. Ids are - /// generated by the service and should be omitted. - /// - [JsonProperty(PropertyName = "qnaList")] - public IList QnaList { get; set; } - - /// - /// Gets or sets list of URLs to be added to knowledgebase. - /// - [JsonProperty(PropertyName = "urls")] - public IList Urls { get; set; } - - /// - /// Gets or sets list of files to be added to knowledgebase. - /// - [JsonProperty(PropertyName = "files")] - public IList Files { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs deleted file mode 100644 index 09b3a9d6e060..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/DeleteKbContentsDTO.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// PATCH body schema of Delete Operation in UpdateKb - /// - public partial class DeleteKbContentsDTO - { - /// - /// Initializes a new instance of the DeleteKbContentsDTO class. - /// - public DeleteKbContentsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DeleteKbContentsDTO class. - /// - /// List of Qna Ids to be deleted - /// List of sources to be deleted from - /// knowledgebase. - public DeleteKbContentsDTO(IList ids = default(IList), IList sources = default(IList)) - { - Ids = ids; - Sources = sources; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of Qna Ids to be deleted - /// - [JsonProperty(PropertyName = "ids")] - public IList Ids { get; set; } - - /// - /// Gets or sets list of sources to be deleted from knowledgebase. - /// - [JsonProperty(PropertyName = "sources")] - public IList Sources { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs deleted file mode 100644 index d03a645a2404..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointKeysDTO.cs +++ /dev/null @@ -1,83 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Schema for EndpointKeys generate/refresh operations. - /// - public partial class EndpointKeysDTO - { - /// - /// Initializes a new instance of the EndpointKeysDTO class. - /// - public EndpointKeysDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EndpointKeysDTO class. - /// - /// Primary Access Key. - /// Secondary Access Key. - /// Current version of runtime. - /// Latest version of runtime. - /// Language setting of runtime. - public EndpointKeysDTO(string primaryEndpointKey = default(string), string secondaryEndpointKey = default(string), string installedVersion = default(string), string lastStableVersion = default(string), string language = default(string)) - { - PrimaryEndpointKey = primaryEndpointKey; - SecondaryEndpointKey = secondaryEndpointKey; - InstalledVersion = installedVersion; - LastStableVersion = lastStableVersion; - Language = language; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets primary Access Key. - /// - [JsonProperty(PropertyName = "primaryEndpointKey")] - public string PrimaryEndpointKey { get; set; } - - /// - /// Gets or sets secondary Access Key. - /// - [JsonProperty(PropertyName = "secondaryEndpointKey")] - public string SecondaryEndpointKey { get; set; } - - /// - /// Gets or sets current version of runtime. - /// - [JsonProperty(PropertyName = "installedVersion")] - public string InstalledVersion { get; set; } - - /// - /// Gets or sets latest version of runtime. - /// - [JsonProperty(PropertyName = "lastStableVersion")] - public string LastStableVersion { get; set; } - - /// - /// Gets or sets language setting of runtime. - /// - [JsonProperty(PropertyName = "language")] - public string Language { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs deleted file mode 100644 index 175a800e9f36..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTO.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Endpoint settings. - /// - public partial class EndpointSettingsDTO - { - /// - /// Initializes a new instance of the EndpointSettingsDTO class. - /// - public EndpointSettingsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EndpointSettingsDTO class. - /// - /// Active Learning settings of the - /// endpoint. - public EndpointSettingsDTO(EndpointSettingsDTOActiveLearning activeLearning = default(EndpointSettingsDTOActiveLearning)) - { - ActiveLearning = activeLearning; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets active Learning settings of the endpoint. - /// - [JsonProperty(PropertyName = "activeLearning")] - public EndpointSettingsDTOActiveLearning ActiveLearning { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs deleted file mode 100644 index d610bed74d58..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Linq; - - /// - /// Active Learning settings of the endpoint. - /// - public partial class EndpointSettingsDTOActiveLearning : ActiveLearningSettingsDTO - { - /// - /// Initializes a new instance of the EndpointSettingsDTOActiveLearning - /// class. - /// - public EndpointSettingsDTOActiveLearning() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EndpointSettingsDTOActiveLearning - /// class. - /// - /// True/False string providing Active - /// Learning - public EndpointSettingsDTOActiveLearning(string enable = default(string)) - : base(enable) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs deleted file mode 100644 index 6784c64296a6..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/EnvironmentType.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - - /// - /// Defines values for EnvironmentType. - /// - public static class EnvironmentType - { - public const string Prod = "Prod"; - public const string Test = "Test"; - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs deleted file mode 100644 index 5781e9bc62d1..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Error.cs +++ /dev/null @@ -1,125 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The error object. As per Microsoft One API guidelines - - /// https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - /// - public partial class Error - { - /// - /// Initializes a new instance of the Error class. - /// - public Error() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Error class. - /// - /// One of a server-defined set of error codes. - /// Possible values include: 'BadArgument', 'Forbidden', 'NotFound', - /// 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', - /// 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', - /// 'OperationNotFound', 'ServiceError', 'ValidationFailure', - /// 'ExtractionFailure' - /// 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. - public Error(string code, string message = default(string), string target = default(string), IList details = default(IList), InnerErrorModel innerError = default(InnerErrorModel)) - { - Code = code; - Message = message; - Target = target; - Details = details; - InnerError = innerError; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets one of a server-defined set of error codes. Possible - /// values include: 'BadArgument', 'Forbidden', 'NotFound', - /// 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', - /// 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', - /// 'OperationNotFound', 'ServiceError', 'ValidationFailure', - /// 'ExtractionFailure' - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a human-readable representation of the error. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the target of the error. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - /// - /// Gets or sets an array of details about specific errors that led to - /// this reported error. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - /// - /// Gets or sets an object containing more specific information than - /// the current object about the error. - /// - [JsonProperty(PropertyName = "innerError")] - public InnerErrorModel InnerError { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - if (Details != null) - { - foreach (var element in Details) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs deleted file mode 100644 index 53f28c4bc988..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorCodeType.cs +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - - /// - /// Defines values for ErrorCodeType. - /// - public static class ErrorCodeType - { - public const string BadArgument = "BadArgument"; - public const string Forbidden = "Forbidden"; - public const string NotFound = "NotFound"; - public const string KbNotFound = "KbNotFound"; - public const string Unauthorized = "Unauthorized"; - public const string Unspecified = "Unspecified"; - public const string EndpointKeysError = "EndpointKeysError"; - public const string QuotaExceeded = "QuotaExceeded"; - public const string QnaRuntimeError = "QnaRuntimeError"; - public const string SKULimitExceeded = "SKULimitExceeded"; - public const string OperationNotFound = "OperationNotFound"; - public const string ServiceError = "ServiceError"; - public const string ValidationFailure = "ValidationFailure"; - public const string ExtractionFailure = "ExtractionFailure"; - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs deleted file mode 100644 index 41750bb6316b..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponse.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Error response. As per Microsoft One API guidelines - - /// https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - /// - public partial class ErrorResponse - { - /// - /// Initializes a new instance of the ErrorResponse class. - /// - public ErrorResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorResponse class. - /// - /// The error object. - public ErrorResponse(ErrorResponseError error = default(ErrorResponseError)) - { - Error = error; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the error object. - /// - [JsonProperty(PropertyName = "error")] - public ErrorResponseError Error { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs deleted file mode 100644 index 2e741a71a2b4..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseError.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The error object. - /// - public partial class ErrorResponseError : Error - { - /// - /// Initializes a new instance of the ErrorResponseError class. - /// - public ErrorResponseError() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorResponseError class. - /// - /// One of a server-defined set of error codes. - /// Possible values include: 'BadArgument', 'Forbidden', 'NotFound', - /// 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', - /// 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', - /// 'OperationNotFound', 'ServiceError', 'ValidationFailure', - /// 'ExtractionFailure' - /// 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. - public ErrorResponseError(string code, string message = default(string), string target = default(string), IList details = default(IList), InnerErrorModel innerError = default(InnerErrorModel)) - : base(code, message, target, details, innerError) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs deleted file mode 100644 index db90a2de852a..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ErrorResponseException.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - - /// - /// Exception thrown for an invalid response with ErrorResponse - /// information. - /// - public partial class ErrorResponseException : RestException - { - /// - /// Gets information about the associated HTTP request. - /// - public HttpRequestMessageWrapper Request { get; set; } - - /// - /// Gets information about the associated HTTP response. - /// - public HttpResponseMessageWrapper Response { get; set; } - - /// - /// Gets or sets the body object. - /// - public ErrorResponse Body { get; set; } - - /// - /// Initializes a new instance of the ErrorResponseException class. - /// - public ErrorResponseException() - { - } - - /// - /// Initializes a new instance of the ErrorResponseException class. - /// - /// The exception message. - public ErrorResponseException(string message) - : this(message, null) - { - } - - /// - /// Initializes a new instance of the ErrorResponseException class. - /// - /// The exception message. - /// Inner exception. - public ErrorResponseException(string message, System.Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs deleted file mode 100644 index e77c6c00c327..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordDTO.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Active learning feedback record. - /// - public partial class FeedbackRecordDTO - { - /// - /// Initializes a new instance of the FeedbackRecordDTO class. - /// - public FeedbackRecordDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FeedbackRecordDTO class. - /// - /// Unique identifier for the user. - /// The suggested question being provided as - /// feedback. - /// The qnaId for which the suggested question is - /// provided as feedback. - public FeedbackRecordDTO(string userId = default(string), string userQuestion = default(string), int? qnaId = default(int?)) - { - UserId = userId; - UserQuestion = userQuestion; - QnaId = qnaId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unique identifier for the user. - /// - [JsonProperty(PropertyName = "userId")] - public string UserId { get; set; } - - /// - /// Gets or sets the suggested question being provided as feedback. - /// - [JsonProperty(PropertyName = "userQuestion")] - public string UserQuestion { get; set; } - - /// - /// Gets or sets the qnaId for which the suggested question is provided - /// as feedback. - /// - [JsonProperty(PropertyName = "qnaId")] - public int? QnaId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (UserQuestion != null) - { - if (UserQuestion.Length > 1000) - { - throw new ValidationException(ValidationRules.MaxLength, "UserQuestion", 1000); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs deleted file mode 100644 index be2da0f206a8..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FeedbackRecordsDTO.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Active learning feedback records. - /// - public partial class FeedbackRecordsDTO - { - /// - /// Initializes a new instance of the FeedbackRecordsDTO class. - /// - public FeedbackRecordsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FeedbackRecordsDTO class. - /// - /// List of feedback records. - public FeedbackRecordsDTO(IList feedbackRecords = default(IList)) - { - FeedbackRecords = feedbackRecords; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of feedback records. - /// - [JsonProperty(PropertyName = "feedbackRecords")] - public IList FeedbackRecords { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs deleted file mode 100644 index 3316c9986c48..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/FileDTO.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// DTO to hold details of uploaded files. - /// - public partial class FileDTO - { - /// - /// Initializes a new instance of the FileDTO class. - /// - public FileDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FileDTO class. - /// - /// File name. Supported file types are ".tsv", - /// ".pdf", ".txt", ".docx", ".xlsx". - /// Public URI of the file. - public FileDTO(string fileName, string fileUri) - { - FileName = fileName; - FileUri = fileUri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets file name. Supported file types are ".tsv", ".pdf", - /// ".txt", ".docx", ".xlsx". - /// - [JsonProperty(PropertyName = "fileName")] - public string FileName { get; set; } - - /// - /// Gets or sets public URI of the file. - /// - [JsonProperty(PropertyName = "fileUri")] - public string FileUri { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FileName"); - } - if (FileUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FileUri"); - } - if (FileName != null) - { - if (FileName.Length > 200) - { - throw new ValidationException(ValidationRules.MaxLength, "FileName", 200); - } - if (FileName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "FileName", 1); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs deleted file mode 100644 index a977824b6024..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/InnerErrorModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An object containing more specific information about the error. As per - /// Microsoft One API guidelines - - /// https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - /// - public partial class InnerErrorModel - { - /// - /// Initializes a new instance of the InnerErrorModel class. - /// - public InnerErrorModel() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the InnerErrorModel class. - /// - /// A more specific error code than was provided by - /// the containing error. - /// An object containing more specific - /// information than the current object about the error. - public InnerErrorModel(string code = default(string), InnerErrorModel innerError = default(InnerErrorModel)) - { - Code = code; - InnerError = innerError; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a more specific error code than was provided by the - /// containing error. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets an object containing more specific information than - /// the current object about the error. - /// - [JsonProperty(PropertyName = "innerError")] - public InnerErrorModel InnerError { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs deleted file mode 100644 index a1564b9ba84d..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseDTO.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Response schema for CreateKb operation. - /// - public partial class KnowledgebaseDTO - { - /// - /// Initializes a new instance of the KnowledgebaseDTO class. - /// - public KnowledgebaseDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the KnowledgebaseDTO class. - /// - /// Unique id that identifies a knowledgebase. - /// URL host name at which the knowledgebase is - /// hosted. - /// Time stamp at which the - /// knowledgebase was last accessed (UTC). - /// Time stamp at which the - /// knowledgebase was last modified (UTC). - /// Time stamp at which the - /// knowledgebase was last published (UTC). - /// Friendly name of the knowledgebase. - /// User who created / owns the - /// knowledgebase. - /// URL sources from which Q-A were extracted and - /// added to the knowledgebase. - /// Custom sources from which Q-A were extracted - /// or explicitly added to the knowledgebase. - public KnowledgebaseDTO(string id = default(string), string hostName = default(string), string lastAccessedTimestamp = default(string), string lastChangedTimestamp = default(string), string lastPublishedTimestamp = default(string), string name = default(string), string userId = default(string), IList urls = default(IList), IList sources = default(IList)) - { - Id = id; - HostName = hostName; - LastAccessedTimestamp = lastAccessedTimestamp; - LastChangedTimestamp = lastChangedTimestamp; - LastPublishedTimestamp = lastPublishedTimestamp; - Name = name; - UserId = userId; - Urls = urls; - Sources = sources; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unique id that identifies a knowledgebase. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets URL host name at which the knowledgebase is hosted. - /// - [JsonProperty(PropertyName = "hostName")] - public string HostName { get; set; } - - /// - /// Gets or sets time stamp at which the knowledgebase was last - /// accessed (UTC). - /// - [JsonProperty(PropertyName = "lastAccessedTimestamp")] - public string LastAccessedTimestamp { get; set; } - - /// - /// Gets or sets time stamp at which the knowledgebase was last - /// modified (UTC). - /// - [JsonProperty(PropertyName = "lastChangedTimestamp")] - public string LastChangedTimestamp { get; set; } - - /// - /// Gets or sets time stamp at which the knowledgebase was last - /// published (UTC). - /// - [JsonProperty(PropertyName = "lastPublishedTimestamp")] - public string LastPublishedTimestamp { get; set; } - - /// - /// Gets or sets friendly name of the knowledgebase. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets user who created / owns the knowledgebase. - /// - [JsonProperty(PropertyName = "userId")] - public string UserId { get; set; } - - /// - /// Gets or sets URL sources from which Q-A were extracted and added to - /// the knowledgebase. - /// - [JsonProperty(PropertyName = "urls")] - public IList Urls { get; set; } - - /// - /// Gets or sets custom sources from which Q-A were extracted or - /// explicitly added to the knowledgebase. - /// - [JsonProperty(PropertyName = "sources")] - public IList Sources { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs deleted file mode 100644 index 6077134654cb..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebaseUpdateHeaders.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for Update operation. - /// - public partial class KnowledgebaseUpdateHeaders - { - /// - /// Initializes a new instance of the KnowledgebaseUpdateHeaders class. - /// - public KnowledgebaseUpdateHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the KnowledgebaseUpdateHeaders class. - /// - /// Relative URI to the target location of the - /// asynchronous operation. Client should poll this resource to get - /// status of the operation. - public KnowledgebaseUpdateHeaders(string location = default(string)) - { - Location = location; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets relative URI to the target location of the - /// asynchronous operation. Client should poll this resource to get - /// status of the operation. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs deleted file mode 100644 index 322df42770b7..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/KnowledgebasesDTO.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Collection of knowledgebases owned by a user. - /// - public partial class KnowledgebasesDTO - { - /// - /// Initializes a new instance of the KnowledgebasesDTO class. - /// - public KnowledgebasesDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the KnowledgebasesDTO class. - /// - /// Collection of knowledgebase - /// records. - public KnowledgebasesDTO(IList knowledgebases = default(IList)) - { - Knowledgebases = knowledgebases; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets collection of knowledgebase records. - /// - [JsonProperty(PropertyName = "knowledgebases")] - public IList Knowledgebases { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs deleted file mode 100644 index 56af6aa6f305..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/MetadataDTO.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Name - value pair of metadata. - /// - public partial class MetadataDTO - { - /// - /// Initializes a new instance of the MetadataDTO class. - /// - public MetadataDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetadataDTO class. - /// - /// Metadata name. - /// Metadata value. - public MetadataDTO(string name, string value) - { - Name = name; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets metadata name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets metadata value. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (Name != null) - { - if (Name.Length > 100) - { - throw new ValidationException(ValidationRules.MaxLength, "Name", 100); - } - if (Name.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Name", 1); - } - } - if (Value != null) - { - if (Value.Length > 500) - { - throw new ValidationException(ValidationRules.MaxLength, "Value", 500); - } - if (Value.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Value", 1); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs deleted file mode 100644 index ec410e6e0ef0..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/Operation.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Record to track long running operation. - /// - public partial class Operation - { - /// - /// Initializes a new instance of the Operation class. - /// - public Operation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Operation class. - /// - /// Operation state. Possible values - /// include: 'Failed', 'NotStarted', 'Running', 'Succeeded' - /// Timestamp when the operation was - /// created. - /// Timestamp when the current state - /// was entered. - /// Relative URI to the target resource - /// location for completed resources. - /// User Id - /// Operation Id. - /// Error details in case of - /// failures. - public Operation(string operationState = default(string), string createdTimestamp = default(string), string lastActionTimestamp = default(string), string resourceLocation = default(string), string userId = default(string), string operationId = default(string), ErrorResponse errorResponse = default(ErrorResponse)) - { - OperationState = operationState; - CreatedTimestamp = createdTimestamp; - LastActionTimestamp = lastActionTimestamp; - ResourceLocation = resourceLocation; - UserId = userId; - OperationId = operationId; - ErrorResponse = errorResponse; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets operation state. Possible values include: 'Failed', - /// 'NotStarted', 'Running', 'Succeeded' - /// - [JsonProperty(PropertyName = "operationState")] - public string OperationState { get; set; } - - /// - /// Gets or sets timestamp when the operation was created. - /// - [JsonProperty(PropertyName = "createdTimestamp")] - public string CreatedTimestamp { get; set; } - - /// - /// Gets or sets timestamp when the current state was entered. - /// - [JsonProperty(PropertyName = "lastActionTimestamp")] - public string LastActionTimestamp { get; set; } - - /// - /// Gets or sets relative URI to the target resource location for - /// completed resources. - /// - [JsonProperty(PropertyName = "resourceLocation")] - public string ResourceLocation { get; set; } - - /// - /// Gets or sets user Id - /// - [JsonProperty(PropertyName = "userId")] - public string UserId { get; set; } - - /// - /// Gets or sets operation Id. - /// - [JsonProperty(PropertyName = "operationId")] - public string OperationId { get; set; } - - /// - /// Gets or sets error details in case of failures. - /// - [JsonProperty(PropertyName = "errorResponse")] - public ErrorResponse ErrorResponse { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs deleted file mode 100644 index edcfd982c949..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationStateType.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - - /// - /// Defines values for OperationStateType. - /// - public static class OperationStateType - { - public const string Failed = "Failed"; - public const string NotStarted = "NotStarted"; - public const string Running = "Running"; - public const string Succeeded = "Succeeded"; - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs deleted file mode 100644 index f668f06e0998..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/OperationsGetDetailsHeaders.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for GetDetails operation. - /// - public partial class OperationsGetDetailsHeaders - { - /// - /// Initializes a new instance of the OperationsGetDetailsHeaders - /// class. - /// - public OperationsGetDetailsHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationsGetDetailsHeaders - /// class. - /// - /// Indicates how long the client should wait - /// before sending a follow up request. The header will be present only - /// if the operation is running or has not started yet. - public OperationsGetDetailsHeaders(int? retryAfter = default(int?)) - { - RetryAfter = retryAfter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets indicates how long the client should wait before - /// sending a follow up request. The header will be present only if the - /// operation is running or has not started yet. - /// - [JsonProperty(PropertyName = "RetryAfter")] - public int? RetryAfter { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs deleted file mode 100644 index 1fcc695d9cff..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTO.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Prompt for an answer. - /// - public partial class PromptDTO - { - /// - /// Initializes a new instance of the PromptDTO class. - /// - public PromptDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PromptDTO class. - /// - /// Index of the prompt - used in ordering - /// of the prompts - /// Qna id corresponding to the prompt - if QnaId - /// is present, QnADTO object is ignored. - /// QnADTO - Either QnaId or QnADTO needs to be - /// present in a PromptDTO object - /// Text displayed to represent a follow up - /// question prompt - public PromptDTO(int? displayOrder = default(int?), int? qnaId = default(int?), PromptDTOQna qna = default(PromptDTOQna), string displayText = default(string)) - { - DisplayOrder = displayOrder; - QnaId = qnaId; - Qna = qna; - DisplayText = displayText; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets index of the prompt - used in ordering of the prompts - /// - [JsonProperty(PropertyName = "displayOrder")] - public int? DisplayOrder { get; set; } - - /// - /// Gets or sets qna id corresponding to the prompt - if QnaId is - /// present, QnADTO object is ignored. - /// - [JsonProperty(PropertyName = "qnaId")] - public int? QnaId { get; set; } - - /// - /// Gets or sets qnADTO - Either QnaId or QnADTO needs to be present in - /// a PromptDTO object - /// - [JsonProperty(PropertyName = "qna")] - public PromptDTOQna Qna { get; set; } - - /// - /// Gets or sets text displayed to represent a follow up question - /// prompt - /// - [JsonProperty(PropertyName = "displayText")] - public string DisplayText { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Qna != null) - { - Qna.Validate(); - } - if (DisplayText != null) - { - if (DisplayText.Length > 200) - { - throw new ValidationException(ValidationRules.MaxLength, "DisplayText", 200); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs deleted file mode 100644 index a95fae8e1140..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/PromptDTOQna.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO - /// object - /// - public partial class PromptDTOQna : QnADTO - { - /// - /// Initializes a new instance of the PromptDTOQna class. - /// - public PromptDTOQna() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PromptDTOQna class. - /// - /// Answer text - /// List of questions associated with the - /// answer. - /// Unique id for the Q-A. - /// Source from which Q-A was indexed. eg. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - /// List of metadata associated with the - /// answer. - /// Context of a QnA - public PromptDTOQna(string answer, IList questions, int? id = default(int?), string source = default(string), IList metadata = default(IList), QnADTOContext context = default(QnADTOContext)) - : base(answer, questions, id, source, metadata, context) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs deleted file mode 100644 index 2c5f563a333d..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTO.cs +++ /dev/null @@ -1,147 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Q-A object. - /// - public partial class QnADTO - { - /// - /// Initializes a new instance of the QnADTO class. - /// - public QnADTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QnADTO class. - /// - /// Answer text - /// List of questions associated with the - /// answer. - /// Unique id for the Q-A. - /// Source from which Q-A was indexed. eg. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - /// List of metadata associated with the - /// answer. - /// Context of a QnA - public QnADTO(string answer, IList questions, int? id = default(int?), string source = default(string), IList metadata = default(IList), QnADTOContext context = default(QnADTOContext)) - { - Id = id; - Answer = answer; - Source = source; - Questions = questions; - Metadata = metadata; - Context = context; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unique id for the Q-A. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// Gets or sets answer text - /// - [JsonProperty(PropertyName = "answer")] - public string Answer { get; set; } - - /// - /// Gets or sets source from which Q-A was indexed. eg. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - /// - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - - /// - /// Gets or sets list of questions associated with the answer. - /// - [JsonProperty(PropertyName = "questions")] - public IList Questions { get; set; } - - /// - /// Gets or sets list of metadata associated with the answer. - /// - [JsonProperty(PropertyName = "metadata")] - public IList Metadata { get; set; } - - /// - /// Gets or sets context of a QnA - /// - [JsonProperty(PropertyName = "context")] - public QnADTOContext Context { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Answer == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Answer"); - } - if (Questions == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Questions"); - } - if (Answer != null) - { - if (Answer.Length > 25000) - { - throw new ValidationException(ValidationRules.MaxLength, "Answer", 25000); - } - if (Answer.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Answer", 1); - } - } - if (Source != null) - { - if (Source.Length > 300) - { - throw new ValidationException(ValidationRules.MaxLength, "Source", 300); - } - } - if (Metadata != null) - { - foreach (var element in Metadata) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Context != null) - { - Context.Validate(); - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs deleted file mode 100644 index c663a9710a42..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADTOContext.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Context of a QnA - /// - public partial class QnADTOContext : ContextDTO - { - /// - /// Initializes a new instance of the QnADTOContext class. - /// - public QnADTOContext() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QnADTOContext class. - /// - /// To mark if a prompt is relevant only - /// with a previous question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search - /// result - /// List of prompts associated with the - /// answer. - public QnADTOContext(bool? isContextOnly = default(bool?), IList prompts = default(IList)) - : base(isContextOnly, prompts) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs deleted file mode 100644 index dddb8cffe800..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnADocumentsDTO.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// List of QnADTO - /// - public partial class QnADocumentsDTO - { - /// - /// Initializes a new instance of the QnADocumentsDTO class. - /// - public QnADocumentsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QnADocumentsDTO class. - /// - /// List of answers. - public QnADocumentsDTO(IList qnaDocuments = default(IList)) - { - QnaDocuments = qnaDocuments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of answers. - /// - [JsonProperty(PropertyName = "qnaDocuments")] - public IList QnaDocuments { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs deleted file mode 100644 index 2e2a56dd6b02..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResult.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents Search Result. - /// - public partial class QnASearchResult - { - /// - /// Initializes a new instance of the QnASearchResult class. - /// - public QnASearchResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QnASearchResult class. - /// - /// List of questions. - /// Answer. - /// Search result score. - /// Id of the QnA result. - /// Source of QnA result. - /// List of metadata. - /// Context object of the QnA - public QnASearchResult(IList questions = default(IList), string answer = default(string), double? score = default(double?), int? id = default(int?), string source = default(string), IList metadata = default(IList), QnASearchResultContext context = default(QnASearchResultContext)) - { - Questions = questions; - Answer = answer; - Score = score; - Id = id; - Source = source; - Metadata = metadata; - Context = context; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of questions. - /// - [JsonProperty(PropertyName = "questions")] - public IList Questions { get; set; } - - /// - /// Gets or sets answer. - /// - [JsonProperty(PropertyName = "answer")] - public string Answer { get; set; } - - /// - /// Gets or sets search result score. - /// - [JsonProperty(PropertyName = "score")] - public double? Score { get; set; } - - /// - /// Gets or sets id of the QnA result. - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// Gets or sets source of QnA result. - /// - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - - /// - /// Gets or sets list of metadata. - /// - [JsonProperty(PropertyName = "metadata")] - public IList Metadata { get; set; } - - /// - /// Gets or sets context object of the QnA - /// - [JsonProperty(PropertyName = "context")] - public QnASearchResultContext Context { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs deleted file mode 100644 index f7a01ea1217b..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultContext.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Context object of the QnA - /// - public partial class QnASearchResultContext : ContextDTO - { - /// - /// Initializes a new instance of the QnASearchResultContext class. - /// - public QnASearchResultContext() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QnASearchResultContext class. - /// - /// To mark if a prompt is relevant only - /// with a previous question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search - /// result - /// List of prompts associated with the - /// answer. - public QnASearchResultContext(bool? isContextOnly = default(bool?), IList prompts = default(IList)) - : base(isContextOnly, prompts) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs deleted file mode 100644 index 88b445aa841c..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QnASearchResultList.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents List of Question Answers. - /// - public partial class QnASearchResultList - { - /// - /// Initializes a new instance of the QnASearchResultList class. - /// - public QnASearchResultList() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QnASearchResultList class. - /// - /// Represents Search Result list. - public QnASearchResultList(IList answers = default(IList)) - { - Answers = answers; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets represents Search Result list. - /// - [JsonProperty(PropertyName = "answers")] - public IList Answers { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs deleted file mode 100644 index fa9d3cc462e2..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryContextDTO.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Context object with previous QnA's information. - /// - public partial class QueryContextDTO - { - /// - /// Initializes a new instance of the QueryContextDTO class. - /// - public QueryContextDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueryContextDTO class. - /// - /// Previous QnA Id - qnaId of the top - /// result. - /// Previous user query. - public QueryContextDTO(string previousQnaId = default(string), string previousUserQuery = default(string)) - { - PreviousQnaId = previousQnaId; - PreviousUserQuery = previousUserQuery; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets previous QnA Id - qnaId of the top result. - /// - [JsonProperty(PropertyName = "previousQnaId")] - public string PreviousQnaId { get; set; } - - /// - /// Gets or sets previous user query. - /// - [JsonProperty(PropertyName = "previousUserQuery")] - public string PreviousUserQuery { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs deleted file mode 100644 index a4573673cf63..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTO.cs +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// POST body schema to query the knowledgebase. - /// - public partial class QueryDTO - { - /// - /// Initializes a new instance of the QueryDTO class. - /// - public QueryDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueryDTO class. - /// - /// Exact qnaId to fetch from the knowledgebase, - /// this field takes priority over question. - /// User question to query against the knowledge - /// base. - /// Max number of answers to be returned for the - /// question. - /// Unique identifier for the user. Optional - /// parameter for telemetry. For more information, refer <a - /// href="http://aka.ms/qnamaker-analytics#user-traffic" - /// target="blank">Analytics and Telemetry</a>. - /// Query against the test index. - /// Threshold for answers returned based - /// on score. - /// Context object with previous QnA's - /// information. - /// Optional field. Set to 'QuestionOnly' for - /// using a question only Ranker. - /// Find only answers that contain these - /// metadata. - /// Optional field. - /// Set to OR for using OR as Operation for Strict Filters. Possible - /// values include: 'AND', 'OR' - public QueryDTO(string qnaId = default(string), string question = default(string), int? top = default(int?), string userId = default(string), bool? isTest = default(bool?), double? scoreThreshold = default(double?), QueryDTOContext context = default(QueryDTOContext), string rankerType = default(string), IList strictFilters = default(IList), string strictFiltersCompoundOperationType = default(string)) - { - QnaId = qnaId; - Question = question; - Top = top; - UserId = userId; - IsTest = isTest; - ScoreThreshold = scoreThreshold; - Context = context; - RankerType = rankerType; - StrictFilters = strictFilters; - StrictFiltersCompoundOperationType = strictFiltersCompoundOperationType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets exact qnaId to fetch from the knowledgebase, this - /// field takes priority over question. - /// - [JsonProperty(PropertyName = "qnaId")] - public string QnaId { get; set; } - - /// - /// Gets or sets user question to query against the knowledge base. - /// - [JsonProperty(PropertyName = "question")] - public string Question { get; set; } - - /// - /// Gets or sets max number of answers to be returned for the question. - /// - [JsonProperty(PropertyName = "top")] - public int? Top { get; set; } - - /// - /// Gets or sets unique identifier for the user. Optional parameter for - /// telemetry. For more information, refer &lt;a - /// href="http://aka.ms/qnamaker-analytics#user-traffic" - /// target="blank"&gt;Analytics and Telemetry&lt;/a&gt;. - /// - [JsonProperty(PropertyName = "userId")] - public string UserId { get; set; } - - /// - /// Gets or sets query against the test index. - /// - [JsonProperty(PropertyName = "isTest")] - public bool? IsTest { get; set; } - - /// - /// Gets or sets threshold for answers returned based on score. - /// - [JsonProperty(PropertyName = "scoreThreshold")] - public double? ScoreThreshold { get; set; } - - /// - /// Gets or sets context object with previous QnA's information. - /// - [JsonProperty(PropertyName = "context")] - public QueryDTOContext Context { get; set; } - - /// - /// Gets or sets optional field. Set to 'QuestionOnly' for using a - /// question only Ranker. - /// - [JsonProperty(PropertyName = "rankerType")] - public string RankerType { get; set; } - - /// - /// Gets or sets find only answers that contain these metadata. - /// - [JsonProperty(PropertyName = "strictFilters")] - public IList StrictFilters { get; set; } - - /// - /// Gets or sets optional field. Set to OR for using OR as Operation - /// for Strict Filters. Possible values include: 'AND', 'OR' - /// - [JsonProperty(PropertyName = "strictFiltersCompoundOperationType")] - public string StrictFiltersCompoundOperationType { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs deleted file mode 100644 index 7dc405c44daf..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/QueryDTOContext.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Linq; - - /// - /// Context object with previous QnA's information. - /// - public partial class QueryDTOContext : QueryContextDTO - { - /// - /// Initializes a new instance of the QueryDTOContext class. - /// - public QueryDTOContext() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueryDTOContext class. - /// - /// Previous QnA Id - qnaId of the top - /// result. - /// Previous user query. - public QueryDTOContext(string previousQnaId = default(string), string previousUserQuery = default(string)) - : base(previousQnaId, previousUserQuery) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs deleted file mode 100644 index 5962ddb41cc1..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/ReplaceKbDTO.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Post body schema for Replace KB operation. - /// - public partial class ReplaceKbDTO - { - /// - /// Initializes a new instance of the ReplaceKbDTO class. - /// - public ReplaceKbDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ReplaceKbDTO class. - /// - /// List of Q-A (QnADTO) to be added to the - /// knowledgebase. Q-A Ids are assigned by the service and should be - /// omitted. - public ReplaceKbDTO(IList qnAList) - { - QnAList = qnAList; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of Q-A (QnADTO) to be added to the knowledgebase. - /// Q-A Ids are assigned by the service and should be omitted. - /// - [JsonProperty(PropertyName = "qnAList")] - public IList QnAList { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (QnAList == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "QnAList"); - } - if (QnAList != null) - { - foreach (var element in QnAList) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs deleted file mode 100644 index 97c8b0e308bd..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/StrictFiltersCompoundOperationType.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - - /// - /// Defines values for StrictFiltersCompoundOperationType. - /// - public static class StrictFiltersCompoundOperationType - { - public const string AND = "AND"; - public const string OR = "OR"; - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs deleted file mode 100644 index 3e5fb14bbb47..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateContextDTO.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Update Body schema to represent context to be updated - /// - public partial class UpdateContextDTO - { - /// - /// Initializes a new instance of the UpdateContextDTO class. - /// - public UpdateContextDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateContextDTO class. - /// - /// List of prompts associated with qna - /// to be deleted - /// List of prompts to be added to the - /// qna. - /// To mark if a prompt is relevant only - /// with a previous question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search - /// result - public UpdateContextDTO(IList promptsToDelete = default(IList), IList promptsToAdd = default(IList), bool? isContextOnly = default(bool?)) - { - PromptsToDelete = promptsToDelete; - PromptsToAdd = promptsToAdd; - IsContextOnly = isContextOnly; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of prompts associated with qna to be deleted - /// - [JsonProperty(PropertyName = "promptsToDelete")] - public IList PromptsToDelete { get; set; } - - /// - /// Gets or sets list of prompts to be added to the qna. - /// - [JsonProperty(PropertyName = "promptsToAdd")] - public IList PromptsToAdd { get; set; } - - /// - /// Gets or sets to mark if a prompt is relevant only with a previous - /// question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search result - /// - [JsonProperty(PropertyName = "isContextOnly")] - public bool? IsContextOnly { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs deleted file mode 100644 index 36c4fc7ba295..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbContentsDTO.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// PATCH body schema for Update operation in Update Kb - /// - public partial class UpdateKbContentsDTO - { - /// - /// Initializes a new instance of the UpdateKbContentsDTO class. - /// - public UpdateKbContentsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateKbContentsDTO class. - /// - /// Friendly name for the knowledgebase. - /// List of Q-A (UpdateQnaDTO) to be added to the - /// knowledgebase. - /// List of existing URLs to be refreshed. The - /// content will be extracted again and re-indexed. - public UpdateKbContentsDTO(string name = default(string), IList qnaList = default(IList), IList urls = default(IList)) - { - Name = name; - QnaList = qnaList; - Urls = urls; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets friendly name for the knowledgebase. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets list of Q-A (UpdateQnaDTO) to be added to the - /// knowledgebase. - /// - [JsonProperty(PropertyName = "qnaList")] - public IList QnaList { get; set; } - - /// - /// Gets or sets list of existing URLs to be refreshed. The content - /// will be extracted again and re-indexed. - /// - [JsonProperty(PropertyName = "urls")] - public IList Urls { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs deleted file mode 100644 index ddd2a0f9be18..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTO.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Contains list of QnAs to be updated - /// - public partial class UpdateKbOperationDTO - { - /// - /// Initializes a new instance of the UpdateKbOperationDTO class. - /// - public UpdateKbOperationDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateKbOperationDTO class. - /// - /// An instance of CreateKbInputDTO for add - /// operation - /// An instance of DeleteKbContentsDTO for delete - /// Operation - /// An instance of UpdateKbContentsDTO for Update - /// Operation - /// Enable hierarchical - /// extraction of Q-A from files and urls. The value set during KB - /// creation will be used if this field is not present. - /// Text string to be used - /// as the answer in any Q-A which has no extracted answer from the - /// document but has a hierarchy. Required when - /// EnableHierarchicalExtraction field is set to True. - public UpdateKbOperationDTO(UpdateKbOperationDTOAdd add = default(UpdateKbOperationDTOAdd), UpdateKbOperationDTODelete delete = default(UpdateKbOperationDTODelete), UpdateKbOperationDTOUpdate update = default(UpdateKbOperationDTOUpdate), bool? enableHierarchicalExtraction = default(bool?), string defaultAnswerUsedForExtraction = default(string)) - { - Add = add; - Delete = delete; - Update = update; - EnableHierarchicalExtraction = enableHierarchicalExtraction; - DefaultAnswerUsedForExtraction = defaultAnswerUsedForExtraction; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets an instance of CreateKbInputDTO for add operation - /// - [JsonProperty(PropertyName = "add")] - public UpdateKbOperationDTOAdd Add { get; set; } - - /// - /// Gets or sets an instance of DeleteKbContentsDTO for delete - /// Operation - /// - [JsonProperty(PropertyName = "delete")] - public UpdateKbOperationDTODelete Delete { get; set; } - - /// - /// Gets or sets an instance of UpdateKbContentsDTO for Update - /// Operation - /// - [JsonProperty(PropertyName = "update")] - public UpdateKbOperationDTOUpdate Update { get; set; } - - /// - /// Gets or sets enable hierarchical extraction of Q-A from files and - /// urls. The value set during KB creation will be used if this field - /// is not present. - /// - [JsonProperty(PropertyName = "enableHierarchicalExtraction")] - public bool? EnableHierarchicalExtraction { get; set; } - - /// - /// Gets or sets text string to be used as the answer in any Q-A which - /// has no extracted answer from the document but has a hierarchy. - /// Required when EnableHierarchicalExtraction field is set to True. - /// - [JsonProperty(PropertyName = "defaultAnswerUsedForExtraction")] - public string DefaultAnswerUsedForExtraction { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DefaultAnswerUsedForExtraction != null) - { - if (DefaultAnswerUsedForExtraction.Length > 300) - { - throw new ValidationException(ValidationRules.MaxLength, "DefaultAnswerUsedForExtraction", 300); - } - if (DefaultAnswerUsedForExtraction.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "DefaultAnswerUsedForExtraction", 1); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs deleted file mode 100644 index 1c89e695d155..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOAdd.cs +++ /dev/null @@ -1,51 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An instance of CreateKbInputDTO for add operation - /// - public partial class UpdateKbOperationDTOAdd : CreateKbInputDTO - { - /// - /// Initializes a new instance of the UpdateKbOperationDTOAdd class. - /// - public UpdateKbOperationDTOAdd() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateKbOperationDTOAdd class. - /// - /// List of QNA to be added to the index. Ids are - /// generated by the service and should be omitted. - /// List of URLs to be added to - /// knowledgebase. - /// List of files to be added to - /// knowledgebase. - public UpdateKbOperationDTOAdd(IList qnaList = default(IList), IList urls = default(IList), IList files = default(IList)) - : base(qnaList, urls, files) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs deleted file mode 100644 index 8dfd2b27b14f..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTODelete.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An instance of DeleteKbContentsDTO for delete Operation - /// - public partial class UpdateKbOperationDTODelete : DeleteKbContentsDTO - { - /// - /// Initializes a new instance of the UpdateKbOperationDTODelete class. - /// - public UpdateKbOperationDTODelete() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateKbOperationDTODelete class. - /// - /// List of Qna Ids to be deleted - /// List of sources to be deleted from - /// knowledgebase. - public UpdateKbOperationDTODelete(IList ids = default(IList), IList sources = default(IList)) - : base(ids, sources) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs deleted file mode 100644 index 946b91319be1..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateKbOperationDTOUpdate.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An instance of UpdateKbContentsDTO for Update Operation - /// - public partial class UpdateKbOperationDTOUpdate : UpdateKbContentsDTO - { - /// - /// Initializes a new instance of the UpdateKbOperationDTOUpdate class. - /// - public UpdateKbOperationDTOUpdate() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateKbOperationDTOUpdate class. - /// - /// Friendly name for the knowledgebase. - /// List of Q-A (UpdateQnaDTO) to be added to the - /// knowledgebase. - /// List of existing URLs to be refreshed. The - /// content will be extracted again and re-indexed. - public UpdateKbOperationDTOUpdate(string name = default(string), IList qnaList = default(IList), IList urls = default(IList)) - : base(name, qnaList, urls) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs deleted file mode 100644 index e6fc685aa529..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateMetadataDTO.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// PATCH Body schema to represent list of Metadata to be updated - /// - public partial class UpdateMetadataDTO - { - /// - /// Initializes a new instance of the UpdateMetadataDTO class. - /// - public UpdateMetadataDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateMetadataDTO class. - /// - /// List of Metadata associated with answer to be - /// deleted - /// List of metadata associated with answer to be - /// added - public UpdateMetadataDTO(IList delete = default(IList), IList add = default(IList)) - { - Delete = delete; - Add = add; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of Metadata associated with answer to be deleted - /// - [JsonProperty(PropertyName = "delete")] - public IList Delete { get; set; } - - /// - /// Gets or sets list of metadata associated with answer to be added - /// - [JsonProperty(PropertyName = "add")] - public IList Add { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs deleted file mode 100644 index 256e9c66a16a..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTO.cs +++ /dev/null @@ -1,125 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// PATCH Body schema for Update Qna List - /// - public partial class UpdateQnaDTO - { - /// - /// Initializes a new instance of the UpdateQnaDTO class. - /// - public UpdateQnaDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateQnaDTO class. - /// - /// Unique id for the Q-A - /// Answer text - /// Source from which Q-A was indexed. eg. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - /// List of questions associated with the - /// answer. - /// List of metadata associated with the answer - /// to be updated - /// Context associated with Qna to be - /// updated. - public UpdateQnaDTO(int? id = default(int?), string answer = default(string), string source = default(string), UpdateQnaDTOQuestions questions = default(UpdateQnaDTOQuestions), UpdateQnaDTOMetadata metadata = default(UpdateQnaDTOMetadata), UpdateQnaDTOContext context = default(UpdateQnaDTOContext)) - { - Id = id; - Answer = answer; - Source = source; - Questions = questions; - Metadata = metadata; - Context = context; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unique id for the Q-A - /// - [JsonProperty(PropertyName = "id")] - public int? Id { get; set; } - - /// - /// Gets or sets answer text - /// - [JsonProperty(PropertyName = "answer")] - public string Answer { get; set; } - - /// - /// Gets or sets source from which Q-A was indexed. eg. - /// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - /// - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - - /// - /// Gets or sets list of questions associated with the answer. - /// - [JsonProperty(PropertyName = "questions")] - public UpdateQnaDTOQuestions Questions { get; set; } - - /// - /// Gets or sets list of metadata associated with the answer to be - /// updated - /// - [JsonProperty(PropertyName = "metadata")] - public UpdateQnaDTOMetadata Metadata { get; set; } - - /// - /// Gets or sets context associated with Qna to be updated. - /// - [JsonProperty(PropertyName = "context")] - public UpdateQnaDTOContext Context { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id != null) - { - if (Id > 2147483647) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Id", 2147483647); - } - if (Id < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Id", 0); - } - } - if (Source != null) - { - if (Source.Length > 300) - { - throw new ValidationException(ValidationRules.MaxLength, "Source", 300); - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs deleted file mode 100644 index 534802453788..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOContext.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Context associated with Qna to be updated. - /// - public partial class UpdateQnaDTOContext : UpdateContextDTO - { - /// - /// Initializes a new instance of the UpdateQnaDTOContext class. - /// - public UpdateQnaDTOContext() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateQnaDTOContext class. - /// - /// List of prompts associated with qna - /// to be deleted - /// List of prompts to be added to the - /// qna. - /// To mark if a prompt is relevant only - /// with a previous question or not. - /// true - Do not include this QnA as search result for queries without - /// context - /// false - ignores context and includes this QnA in search - /// result - public UpdateQnaDTOContext(IList promptsToDelete = default(IList), IList promptsToAdd = default(IList), bool? isContextOnly = default(bool?)) - : base(promptsToDelete, promptsToAdd, isContextOnly) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs deleted file mode 100644 index 3a5f6edaf25f..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOMetadata.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// List of metadata associated with the answer to be updated - /// - public partial class UpdateQnaDTOMetadata : UpdateMetadataDTO - { - /// - /// Initializes a new instance of the UpdateQnaDTOMetadata class. - /// - public UpdateQnaDTOMetadata() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateQnaDTOMetadata class. - /// - /// List of Metadata associated with answer to be - /// deleted - /// List of metadata associated with answer to be - /// added - public UpdateQnaDTOMetadata(IList delete = default(IList), IList add = default(IList)) - : base(delete, add) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs deleted file mode 100644 index 84bac8e43f47..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQnaDTOQuestions.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// List of questions associated with the answer. - /// - public partial class UpdateQnaDTOQuestions : UpdateQuestionsDTO - { - /// - /// Initializes a new instance of the UpdateQnaDTOQuestions class. - /// - public UpdateQnaDTOQuestions() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateQnaDTOQuestions class. - /// - /// List of questions to be added - /// List of questions to be deleted. - public UpdateQnaDTOQuestions(IList add = default(IList), IList delete = default(IList)) - : base(add, delete) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs deleted file mode 100644 index 145d39c3717a..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/UpdateQuestionsDTO.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// PATCH Body schema for Update Kb which contains list of questions to be - /// added and deleted - /// - public partial class UpdateQuestionsDTO - { - /// - /// Initializes a new instance of the UpdateQuestionsDTO class. - /// - public UpdateQuestionsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateQuestionsDTO class. - /// - /// List of questions to be added - /// List of questions to be deleted. - public UpdateQuestionsDTO(IList add = default(IList), IList delete = default(IList)) - { - Add = add; - Delete = delete; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of questions to be added - /// - [JsonProperty(PropertyName = "add")] - public IList Add { get; set; } - - /// - /// Gets or sets list of questions to be deleted. - /// - [JsonProperty(PropertyName = "delete")] - public IList Delete { get; set; } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs deleted file mode 100644 index 615fc32dce93..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Models/WordAlterationsDTO.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Collection of word alterations. - /// - public partial class WordAlterationsDTO - { - /// - /// Initializes a new instance of the WordAlterationsDTO class. - /// - public WordAlterationsDTO() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WordAlterationsDTO class. - /// - /// Collection of word - /// alterations. - public WordAlterationsDTO(IList wordAlterations) - { - WordAlterations = wordAlterations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets collection of word alterations. - /// - [JsonProperty(PropertyName = "wordAlterations")] - public IList WordAlterations { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (WordAlterations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WordAlterations"); - } - if (WordAlterations != null) - { - foreach (var element in WordAlterations) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs deleted file mode 100644 index bdf95f9ac983..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Operations.cs +++ /dev/null @@ -1,220 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Operations operations. - /// - public partial class Operations : IServiceOperations, IOperations - { - /// - /// Initializes a new instance of the Operations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Operations(QnAMakerClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QnAMakerClient - /// - public QnAMakerClient Client { get; private set; } - - /// - /// Gets details of a specific long running operation. - /// - /// - /// Operation id. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDetailsWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.Endpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.Endpoint"); - } - if (operationId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("operationId", operationId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDetails", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "operations/{operationId}"; - _url = _url.Replace("{Endpoint}", Client.Endpoint); - _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs deleted file mode 100644 index 6b29a5a63c44..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/OperationsExtensions.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Operations. - /// - public static partial class OperationsExtensions - { - /// - /// Gets details of a specific long running operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Operation id. - /// - /// - /// The cancellation token. - /// - public static async Task GetDetailsAsync(this IOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDetailsWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs deleted file mode 100644 index accd08c0f5ca..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerClient.cs +++ /dev/null @@ -1,239 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - - /// - /// An API for QnAMaker Service - /// - public partial class QnAMakerClient : ServiceClient, IQnAMakerClient - { - /// - /// The base URI of the service. - /// - internal string BaseUri {get; set;} - - /// - /// Gets or sets json serialization settings. - /// - public JsonSerializerSettings SerializationSettings { get; private set; } - - /// - /// Gets or sets json deserialization settings. - /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - - /// - /// Supported Cognitive Services endpoints (protocol and hostname, for example: - /// https://westus.api.cognitive.microsoft.com). - /// - public string Endpoint { get; set; } - - /// - /// Subscription credentials which uniquely identify client subscription. - /// - public ServiceClientCredentials Credentials { get; private set; } - - /// - /// Gets the IEndpointSettings. - /// - public virtual IEndpointSettings EndpointSettings { get; private set; } - - /// - /// Gets the IEndpointKeys. - /// - public virtual IEndpointKeys EndpointKeys { get; private set; } - - /// - /// Gets the IAlterations. - /// - public virtual IAlterations Alterations { get; private set; } - - /// - /// Gets the IKnowledgebase. - /// - public virtual IKnowledgebase Knowledgebase { get; private set; } - - /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } - - /// - /// Initializes a new instance of the QnAMakerClient class. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling QnAMakerClient.Dispose(). False: will not dispose provided httpClient - protected QnAMakerClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QnAMakerClient class. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected QnAMakerClient(params DelegatingHandler[] handlers) : base(handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QnAMakerClient class. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected QnAMakerClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QnAMakerClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QnAMakerClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QnAMakerClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling QnAMakerClient.Dispose(). False: will not dispose provided httpClient - /// - /// Thrown when a required parameter is null - /// - public QnAMakerClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QnAMakerClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QnAMakerClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// An optional partial-method to perform custom initialization. - /// - partial void CustomInitialize(); - /// - /// Initializes client properties. - /// - private void Initialize() - { - EndpointSettings = new EndpointSettings(this); - EndpointKeys = new EndpointKeys(this); - Alterations = new Alterations(this); - Knowledgebase = new Knowledgebase(this); - Operations = new Operations(this); - BaseUri = "{Endpoint}/qnamaker/v4.0"; - SerializationSettings = new JsonSerializerSettings - { - Formatting = Newtonsoft.Json.Formatting.Indented, - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - DeserializationSettings = new JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - CustomInitialize(); - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs deleted file mode 100644 index 44965c01fc5f..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/QnAMakerRuntimeClient.cs +++ /dev/null @@ -1,215 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Net; - using System.Net.Http; - - /// - /// An API for QnAMaker runtime - /// - public partial class QnAMakerRuntimeClient : ServiceClient, IQnAMakerRuntimeClient - { - /// - /// The base URI of the service. - /// - internal string BaseUri {get; set;} - - /// - /// Gets or sets json serialization settings. - /// - public JsonSerializerSettings SerializationSettings { get; private set; } - - /// - /// Gets or sets json deserialization settings. - /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - - /// - /// QnA Maker App Service endpoint (for example: - /// https://{qnaservice-hostname}.azurewebsites.net). - /// - public string RuntimeEndpoint { get; set; } - - /// - /// Subscription credentials which uniquely identify client subscription. - /// - public ServiceClientCredentials Credentials { get; private set; } - - /// - /// Gets the IRuntime. - /// - public virtual IRuntime Runtime { get; private set; } - - /// - /// Initializes a new instance of the QnAMakerRuntimeClient class. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling QnAMakerRuntimeClient.Dispose(). False: will not dispose provided httpClient - protected QnAMakerRuntimeClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QnAMakerRuntimeClient class. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected QnAMakerRuntimeClient(params DelegatingHandler[] handlers) : base(handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QnAMakerRuntimeClient class. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - protected QnAMakerRuntimeClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) - { - Initialize(); - } - - /// - /// Initializes a new instance of the QnAMakerRuntimeClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QnAMakerRuntimeClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QnAMakerRuntimeClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// HttpClient to be used - /// - /// - /// True: will dispose the provided httpClient on calling QnAMakerRuntimeClient.Dispose(). False: will not dispose provided httpClient - /// - /// Thrown when a required parameter is null - /// - public QnAMakerRuntimeClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// Initializes a new instance of the QnAMakerRuntimeClient class. - /// - /// - /// Required. Subscription credentials which uniquely identify client subscription. - /// - /// - /// Optional. The http client handler used to handle http transport. - /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// - /// - /// Thrown when a required parameter is null - /// - public QnAMakerRuntimeClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) - { - if (credentials == null) - { - throw new System.ArgumentNullException("credentials"); - } - Credentials = credentials; - if (Credentials != null) - { - Credentials.InitializeServiceClient(this); - } - } - - /// - /// An optional partial-method to perform custom initialization. - /// - partial void CustomInitialize(); - /// - /// Initializes client properties. - /// - private void Initialize() - { - Runtime = new Runtime(this); - BaseUri = "{RuntimeEndpoint}/qnamaker"; - SerializationSettings = new JsonSerializerSettings - { - Formatting = Newtonsoft.Json.Formatting.Indented, - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - DeserializationSettings = new JsonSerializerSettings - { - DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, - DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, - NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, - ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List - { - new Iso8601TimeSpanConverter() - } - }; - CustomInitialize(); - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs deleted file mode 100644 index 3d9d1956dcfa..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/Runtime.cs +++ /dev/null @@ -1,367 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Runtime operations. - /// - public partial class Runtime : IServiceOperations, IRuntime - { - /// - /// Initializes a new instance of the Runtime class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Runtime(QnAMakerRuntimeClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the QnAMakerRuntimeClient - /// - public QnAMakerRuntimeClient Client { get; private set; } - - /// - /// GenerateAnswer call to query the knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GenerateAnswerWithHttpMessagesAsync(string kbId, QueryDTO generateAnswerPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.RuntimeEndpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.RuntimeEndpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - if (generateAnswerPayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "generateAnswerPayload"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("generateAnswerPayload", generateAnswerPayload); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GenerateAnswer", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}/generateAnswer"; - _url = _url.Replace("{RuntimeEndpoint}", Client.RuntimeEndpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(generateAnswerPayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(generateAnswerPayload, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Train call to add suggestions to the knowledgebase. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task TrainWithHttpMessagesAsync(string kbId, FeedbackRecordsDTO trainPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.RuntimeEndpoint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.RuntimeEndpoint"); - } - if (kbId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "kbId"); - } - if (trainPayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "trainPayload"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("kbId", kbId); - tracingParameters.Add("trainPayload", trainPayload); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Train", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri; - var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "knowledgebases/{kbId}/train"; - _url = _url.Replace("{RuntimeEndpoint}", Client.RuntimeEndpoint); - _url = _url.Replace("{kbId}", System.Uri.EscapeDataString(kbId)); - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(trainPayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(trainPayload, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs b/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs deleted file mode 100644 index df68ae55bf38..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated/RuntimeExtensions.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Runtime. - /// - public static partial class RuntimeExtensions - { - /// - /// GenerateAnswer call to query the knowledgebase. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// The cancellation token. - /// - public static async Task GenerateAnswerAsync(this IRuntime operations, string kbId, QueryDTO generateAnswerPayload, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GenerateAnswerWithHttpMessagesAsync(kbId, generateAnswerPayload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Train call to add suggestions to the knowledgebase. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Knowledgebase id. - /// - /// - /// Post body of the request. - /// - /// - /// The cancellation token. - /// - public static async Task TrainAsync(this IRuntime operations, string kbId, FeedbackRecordsDTO trainPayload, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.TrainWithHttpMessagesAsync(kbId, trainPayload, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} From 8e62e3708df979db39cc1857137268b352656a16 Mon Sep 17 00:00:00 2001 From: sahithikkss <53164851+sahithikkss@users.noreply.github.com> Date: Thu, 8 Oct 2020 01:09:09 +0530 Subject: [PATCH 04/24] Update SuccessfulGetAlts.json add parameter kbId --- .../preview/v5.0-preview.1/examples/SuccessfulGetAlts.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json index 465b1152950e..6b7ec3d304b0 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json @@ -2,7 +2,8 @@ "parameters": { "Endpoint": "{Endpoint}", "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "{API key}" + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx" }, "responses": { "200": { From 488ad71b32fc0fd71cd1af68ab80e9a833c5c3dd Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 01:18:00 +0530 Subject: [PATCH 05/24] AlterationsKbId for GetAlterations --- .../QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 10170f88e5d3..321990bd4180 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -175,15 +175,10 @@ "summary": "Download alterations from runtime or use kbId parameter (for QnAMakerV2 resource only) to download alterations for a specific knowledgebase.", "operationId": "Alterations_Get", "parameters": [ - { - "schema": { + { "$ref": "#/parameters/AlterationsKbId" - }, - "required": false, - "in": "path", - "name": "kbId" - } - ], + } + ], "consumes": [ "application/json" ], From b524906e852b23e6db953cbf1035d2d0890dba29 Mon Sep 17 00:00:00 2001 From: sahithikkss <53164851+sahithikkss@users.noreply.github.com> Date: Thu, 8 Oct 2020 01:30:22 +0530 Subject: [PATCH 06/24] Update SuccessfulSetAlts.json with kbid "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx" --- .../preview/v5.0-preview.1/examples/SuccessfulSetAlts.json | 1 + 1 file changed, 1 insertion(+) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json index ba8facefde92..f357854fb823 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json @@ -3,6 +3,7 @@ "Endpoint": "{Endpoint}", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx" "wordAlterations": { "wordAlterations": [ { From 8f1cb781edd92e6ec40b481697eeb490aa727618 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 01:35:27 +0530 Subject: [PATCH 07/24] missing comma --- .../preview/v5.0-preview.1/examples/SuccessfulSetAlts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json index f357854fb823..c4d8302b7629 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json @@ -3,7 +3,7 @@ "Endpoint": "{Endpoint}", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "{API key}", - "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx" + "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx", "wordAlterations": { "wordAlterations": [ { From 5d1932ea55e0bd134e2170cbc74ba7cfdbdbe865 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 07:01:10 +0530 Subject: [PATCH 08/24] examples for v2 genAns, train --- .../examples/SuccessfulGenAnsV2.json | 45 +++++++++++++++++++ .../examples/SuccessfulTrainV2.json | 20 +++++++++ 2 files changed, 65 insertions(+) create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainV2.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json new file mode 100644 index 000000000000..591cfb5e5bf7 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Primary/Secondary EndpointKey}", + "Content-Type": "application/json", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "generateAnswerPayload": { + "question": "qna maker and luis", + "top": 6, + "isTest": true, + "scoreThreshold": 20, + "strictFilters": [ + { + "name": "category", + "value": "api" + } + ], + "userId": "sd53lsY=" + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "answers": [ + { + "score": 28.54820341616869, + "id": 20, + "answer": "There is no direct integration of LUIS with QnA Maker. But, in your bot code, you can use LUIS and QnA Maker together.", + "source": "Custom Editorial", + "questions": [ + "How can I integrate LUIS with QnA Maker?" + ], + "metadata": [ + { + "name": "category", + "value": "api" + } + ] + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainV2.json new file mode 100644 index 000000000000..4dabb5d81c35 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainV2.json @@ -0,0 +1,20 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Primary/Secondary Endpoint Key}", + "Content-Type": "application/json", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "trainPayload": { + "feedbackRecords": [ + { + "userId": "sd53lsY=", + "userQuestion": "qna maker with luis", + "qnaId": 4 + } + ] + } + }, + "responses": { + "204": {} + } +} From 19730b3f73e6cd65a8920d4499f85d0fc55211a8 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 07:08:32 +0530 Subject: [PATCH 09/24] removed required attribute for AlterationKbId --- .../data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 1 - 1 file changed, 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 321990bd4180..b3a012fcdc73 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -1748,7 +1748,6 @@ "type": "string", "name": "kbId", "in": "path", - "required": false, "x-nullable": false, "description": "Knowledgebase id. This parameter is required for alterations operations on QnAMakerV2 resources.", "x-ms-parameter-location": "method" From 343cd2994a9b4c50c8982eee2b7f29fcb6c3e43d Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 17:04:27 +0530 Subject: [PATCH 10/24] 4.0 to 5.0-private.1 --- .../preview/v5.0-preview.1/QnAMaker.json | 106 +++++++++++++++--- .../examples/SuccessfulGenAnsV2.json | 15 ++- .../examples/SuccessfulGetAltsV2.json | 35 ++++++ .../examples/SuccessfulSetAltsV2.json | 33 ++++++ .../data-plane/QnAMaker/readme.go.md | 22 ++++ .../data-plane/QnAMaker/readme.md | 28 +++-- .../data-plane/QnAMaker/readme.python.md | 11 ++ .../data-plane/QnAMaker/readme.ruby.md | 14 ++- .../QnAMaker/stable/v4.0/QnAMaker.json | 2 +- .../examples/SuccessfulSetAltsV2.json | 33 ++++++ 10 files changed, 265 insertions(+), 34 deletions(-) create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsV2.json create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json create mode 100644 specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index b3a012fcdc73..9d5c3cac4612 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -167,12 +167,81 @@ } } }, + "/alterations": { + "get": { + "tags": [ + "Alterations" + ], + "summary": "Download alterations from runtime", + "operationId": "Alterations_Get", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Alterations data.", + "schema": { + "$ref": "#/definitions/WordAlterationsDTO" + }, + "x-nullable": true + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulGetAlts.json" + } + } + }, + "put": { + "tags": [ + "Alterations" + ], + "summary": "Replace alterations data.", + "operationId": "Alterations_Replace", + "parameters": [ + { + "$ref": "#/parameters/WordAlterations" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "responses": { + "204": { + "description": "HTTP 204 No Content." + }, + "default": { + "description": "Error response.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Successful query": { + "$ref": "./examples/SuccessfulSetAlts.json" + } + } + } + }, "/alterations/{kbId}": { "get": { "tags": [ "Alterations" ], - "summary": "Download alterations from runtime or use kbId parameter (for QnAMakerV2 resource only) to download alterations for a specific knowledgebase.", + "summary": "Download alterations per Knowledgebase (QnAMaker Managed).", "operationId": "Alterations_Get", "parameters": [ { @@ -202,7 +271,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulGetAlts.json" + "$ref": "./examples/SuccessfulGetAltsV2.json" } } }, @@ -210,7 +279,7 @@ "tags": [ "Alterations" ], - "summary": "Replace alterations data or use kbId parameter to replace alterations of a specific knowledgebase.", + "summary": "Replace alterations data per resource or per Knowledgebase (QnAMaker Managed).", "operationId": "Alterations_Replace", "parameters": [ { @@ -239,7 +308,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulSetAlts.json" + "$ref": "./examples/SuccessfulSetAltsV2.json" } } } @@ -606,7 +675,7 @@ "tags": [ "Knowledgebases" ], - "summary": "GenerateAnswer call to query the knowledgebase created on QnAMaker V2 - Private Preview Azure Cognitive Service resource.", + "summary": "GenerateAnswer call to query knowledgebase (QnA Maker Managed).", "operationId": "Runtime_GenerateAnswer", "parameters": [ { @@ -638,7 +707,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulGenAns.json" + "$ref": "./examples/SuccessfulGenAnsV2.json" } } } @@ -648,7 +717,7 @@ "tags": [ "Knowledgebases" ], - "summary": "Train call to add suggestions to the knowledgebase created on QnAMaker V2 - Private Preview Azure Cognitive Service resource.", + "summary": "Train call to add suggestions to knowledgebase (QnAMaker Managed).", "operationId": "Runtime_Train", "parameters": [ { @@ -677,7 +746,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulTrain.json" + "$ref": "./examples/SuccessfulTrainV2.json" } } } @@ -1470,7 +1539,7 @@ }, "scoreThreshold": { "type": "number", - "description": "Threshold for answers returned based on score." + "description": "Minimum threshold score for answers." }, "context": { "description": "Context object with previous QnA's information.", @@ -1486,14 +1555,14 @@ }, "strictFilters": { "type": "array", - "description": "Find only answers that contain these metadata.", + "description": "Find QnAs that are associated with the given list of metadata.", "items": { "$ref": "#/definitions/MetadataDTO" } }, "strictFiltersCompoundOperationType": { "type": "string", - "description": "Optional field. Set to for using OR as Operation for Strict Filters.", + "description": "Optional field. Set to 'OR' for using OR operation for strict filters.", "x-ms-enum": { "name": "StrictFiltersCompoundOperationType", "modelAsString": true @@ -1504,7 +1573,7 @@ ] }, "answerSpanRequest": { - "description": "To enable/configure answer span prediction.", + "description": "To configure Answer span prediction feature.", "allOf": [ { "$ref": "#/definitions/AnswerSpanRequestDTO" @@ -1636,21 +1705,21 @@ }, "AnswerSpanRequestDTO": { "type": "object", - "description": "To use Answer Span prediction feature.", + "description": "To configure Answer span prediction feature.", "additionalProperties": false, "properties": { "enable": { "type": "boolean", - "description": "To enable Answer Span prediction feature." + "description": "Enable or Disable Answer Span prediction." }, "scoreThreshold": { "type": "number", "format": "double", - "description": "Threshold for answer returned based on score." + "description": "Minimum threshold score required to include an answer span." }, "topAnswersWithSpan": { "type": "integer", - "description": "Number of top answers where span needs to be predicted.", + "description": "Number of Top answers to be considered for span prediction.", "format": "int32", "maximum": 10, "minimum": 1 @@ -1748,8 +1817,9 @@ "type": "string", "name": "kbId", "in": "path", + "required": true, "x-nullable": false, - "description": "Knowledgebase id. This parameter is required for alterations operations on QnAMakerV2 resources.", + "description": "Knowledgebase ID required for alterations operations on QnAMaker Managed.", "x-ms-parameter-location": "method" }, "OperationId": { @@ -1805,7 +1875,7 @@ }, "Endpoint": { "name": "Endpoint", - "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://.api.cognitive.microsoft.com).", + "description": "Supported Cognitive Services endpoint (e.g., https://< qnamaker-resource-name> .api.cognitiveservices.azure.com).", "x-ms-parameter-location": "client", "required": true, "type": "string", diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json index 591cfb5e5bf7..f3b66f76d644 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json @@ -5,7 +5,7 @@ "Content-Type": "application/json", "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", "generateAnswerPayload": { - "question": "qna maker and luis", + "question": "can I integrate qna maker and luis?", "top": 6, "isTest": true, "scoreThreshold": 20, @@ -15,6 +15,11 @@ "value": "api" } ], + "answerSpanRequest": { + "enable": true, + "scoreThreshold": 60, + "topAnswersWithSpan": 1 + }, "userId": "sd53lsY=" } }, @@ -36,7 +41,13 @@ "name": "category", "value": "api" } - ] + ], + "answerSpan": { + "text": "There is no direct integration of LUIS with QnA Maker.", + "score": 0.12583243371129152, + "startIndex": 0, + "endIndex": 53 + } } ] } diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsV2.json new file mode 100644 index 000000000000..dcd63a18be30 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsV2.json @@ -0,0 +1,35 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "wordAlterations": [ + { + "alterations": [ + "qnamaker", + "qna maker" + ] + }, + { + "alterations": [ + "botframework", + "bot framework" + ] + }, + { + "alterations": [ + "webchat", + "web chat" + ] + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json new file mode 100644 index 000000000000..6dc5ca492391 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json @@ -0,0 +1,33 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + "wordAlterations": { + "wordAlterations": [ + { + "alterations": [ + "qnamaker", + "qna maker" + ] + }, + { + "alterations": [ + "botframework", + "bot framework" + ] + }, + { + "alterations": [ + "webchat", + "web chat" + ] + } + ] + } + }, + "responses": { + "204": {} + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md index 214d27ace71d..7d45e65122f4 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md @@ -26,6 +26,17 @@ namespace: qnamaker output-folder: $(go-sdk-folder)/services/cognitiveservices/v4.0/$(namespace) ``` +### Tag: release_5_0-preview.1 and go + +These settings apply only when `--tag=release_5_0-preview.1 --go` is specified on the command line. +Please also specify `--go-sdk-folder=`. + +``` yaml $(tag) == 'release_5_0-preview.1' && $(go) +namespace: qnamaker +output-folder: $(go-sdk-folder)/services/cognitiveservices/v5.0-preview.1/$(namespace) +``` + + ### Tag: runtime_release_4_0 and go These settings apply only when `--tag=runtime_release_4_0 --go` is specified on the command line. @@ -35,3 +46,14 @@ Please also specify `--go-sdk-folder=`. + +``` yaml $(tag) == 'runtime_release_5_0_preview.1' && $(go) +namespace: qnamakerruntime +output-folder: $(go-sdk-folder)/services/cognitiveservices/v5.0-preview.1/$(namespace) +``` \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.md index 54433715a852..d8a2f1fc0ab8 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.md @@ -29,18 +29,25 @@ add-credentials: true openapi-type: data-plane ``` +``` yaml +tag: release_5_0_preview.1 +add-credentials: true +openapi-type: data-plane +``` +# Releases + ### Release 5.0-preview.1 These settings apply only when `--tag=release_5_0_preview.1` is specified on the command line. -``` yaml $(tag) == 'release_4_0' +``` yaml $(tag) == 'release_5_0_preview.1' input-file: preview/v5.0-preview.1/QnAMaker.json ``` ``` yaml -tag: runtime_release_5_0_preview.1 -add-credentials: true -openapi-type: data-plane +batch: + - tag: release_5_0_preview.1 ``` + # Runtime Releases ### Runtime Release 4.0 @@ -50,25 +57,22 @@ These settings apply only when `--tag=runtime_release_4_0` is specified on the c input-file: stable/v4.0/QnAMakerRuntime.json ``` -``` yaml -batch: - - tag: release_4_0 - - tag: runtime_release_4_0 -``` + ### Runtime Release 5.0-preview.1 -These settings apply only when `--tag=runtime_release_5_0_preview.1` is specified on the command line. +These settings apply only when `--tag=runtime_release_5_0-preview.1` is specified on the command line. -``` yaml $(tag) == 'runtime_release_5_0-preview.1' +``` yaml $(tag) == 'runtime_release_5_0_preview.1' input-file: preview/v5.0-preview.1/QnAMakerRuntime.json ``` ``` yaml batch: + - tag: release_4_0 + - tag: runtime_release_4_0 - tag: release_5_0_preview.1 - tag: runtime_release_5_0_preview.1 ``` - ## Swagger to SDK This section describes what SDK should be generated by the automatic system. diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md index 28c107b25da3..50a68cdba0ca 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md @@ -16,7 +16,18 @@ clear-output-folder: true namespace: azure.cognitiveservices.knowledge.qnamaker.authoring output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring ``` + +``` yaml $(tag) == 'release_5_0_preview.1' +namespace: azure.cognitiveservices.knowledge.qnamaker.authoring +output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/preview/v5.0-preview.1 +``` + ``` yaml $(tag) == 'runtime_release_4_0' namespace: azure.cognitiveservices.knowledge.qnamaker.runtime output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime ``` + +``` yaml $(tag) == 'runtime_release_5_0-preview.1' +namespace: azure.cognitiveservices.knowledge.qnamaker.runtime +output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/preview/v5.0-preview.1 +``` \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md index 9466e290b772..15444b105a53 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md @@ -4,7 +4,7 @@ These settings apply only when `--ruby` is specified on the command line. ``` yaml package-name: azure_cognitiveservices_qnamaker -package-version: "0.16.0" +package-version: "1.0.0" azure-arm: true ``` @@ -13,6 +13,7 @@ azure-arm: true ``` yaml $(ruby) && $(multiapi) batch: - tag: release_4_0 + - tag: release_5_0_preview.1 ``` ### Tag: release_4_0 and ruby @@ -23,4 +24,15 @@ Please also specify `--ruby-sdks-folder=`. + +``` yaml $(tag) == 'release_5_0_preview.1' && $(ruby) +namespace: "Azure::CognitiveServices::Qnamaker::V5_0_preview_1" +output-folder: $(ruby-sdks-folder)/data/azure_cognitiveservices_qnamaker/lib/preview/v5.0-preview.1 ``` \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/QnAMaker/stable/v4.0/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/stable/v4.0/QnAMaker.json index 2afdea67435e..d4144409a4c4 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/stable/v4.0/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/stable/v4.0/QnAMaker.json @@ -1446,7 +1446,7 @@ }, "Endpoint": { "name": "Endpoint", - "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).", + "description": "Supported Cognitive Services endpoint (e.g., https://< qnamaker-resource-name> .api.cognitiveservices.azure.com).", "x-ms-parameter-location": "client", "required": true, "type": "string", diff --git a/specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json b/specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json new file mode 100644 index 000000000000..6dc5ca492391 --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json @@ -0,0 +1,33 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "{API key}", + "kbId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + "wordAlterations": { + "wordAlterations": [ + { + "alterations": [ + "qnamaker", + "qna maker" + ] + }, + { + "alterations": [ + "botframework", + "bot framework" + ] + }, + { + "alterations": [ + "webchat", + "web chat" + ] + } + ] + } + }, + "responses": { + "204": {} + } +} From 00ed02a11d962046b5d5118be3a2241833ad2ef0 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 17:55:32 +0530 Subject: [PATCH 11/24] 4.0 to 5.0-private.1 source, changedSince, and better answer span example --- .../preview/v5.0-preview.1/QnAMaker.json | 28 +++++++-- .../examples/SuccessfulDownloadKb.json | 12 ++-- .../examples/SuccessfulGenAnsManaged.json | 59 +++++++++++++++++++ .../examples/SuccessfulGenAnsV2.json | 56 ------------------ ...sV2.json => SuccessfulGetAltsManaged.json} | 0 .../examples/SuccessfulSetAlts.json | 2 +- ...sV2.json => SuccessfulSetAltsManaged.json} | 0 ...ainV2.json => SuccessfulTrainManaged.json} | 0 .../examples/SuccessfulSetAltsV2.json | 33 ----------- 9 files changed, 92 insertions(+), 98 deletions(-) create mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json rename specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/{SuccessfulGetAltsV2.json => SuccessfulGetAltsManaged.json} (100%) rename specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/{SuccessfulSetAltsV2.json => SuccessfulSetAltsManaged.json} (100%) rename specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/{SuccessfulTrainV2.json => SuccessfulTrainManaged.json} (100%) delete mode 100644 specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 9d5c3cac4612..5f28f77d6b37 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -271,7 +271,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulGetAltsV2.json" + "$ref": "./examples/SuccessfulGetAltsManaged.json" } } }, @@ -308,7 +308,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulSetAltsV2.json" + "$ref": "./examples/SuccessfulSetAltsManaged.json" } } } @@ -640,6 +640,20 @@ }, { "$ref": "#/parameters/Environment" + }, + { + "name": "source", + "in": "query", + "description": "The source property filter to apply.", + "required": false, + "type": "string" + }, + { + "name": "changedSince", + "in": "query", + "description": "The last changed status property filter to apply.", + "required": false, + "type": "string" } ], "consumes": [ @@ -707,7 +721,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulGenAnsV2.json" + "$ref": "./examples/SuccessfulGenAnsManaged.json" } } } @@ -746,7 +760,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulTrainV2.json" + "$ref": "./examples/SuccessfulTrainManaged.json" } } } @@ -1149,7 +1163,13 @@ "$ref": "#/definitions/ContextDTO" } ] + }, + "changedTimeStamp": { + "type": "string", + "description": "Timestamp when the operation was created.", + "maxLength": 300 } + } }, "ContextDTO": { diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json index 0413615b20ca..b458e1e6fb3d 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json @@ -22,7 +22,8 @@ "context": { "isContextOnly": false, "prompts": [] - } + }, + "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" }, { "id": 2, @@ -46,7 +47,8 @@ "displayText": "Update KB" } ] - } + }, + "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" }, { "id": 3, @@ -70,7 +72,8 @@ "displayText": "Refresh Endpoint Keys" } ] - } + }, + "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" }, { "id": 4, @@ -83,7 +86,8 @@ "context": { "isContextOnly": false, "prompts": [] - } + }, + "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" } ] } diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json new file mode 100644 index 000000000000..f0c755fc2e9d --- /dev/null +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json @@ -0,0 +1,59 @@ +{ + "parameters": { + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Primary/Secondary EndpointKey}", + "Content-Type": "application/json", + "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", + "generateAnswerPayload": { + "question": "How much time it takes to complete quickstart guide?", + "top": 6, + "isTest": true, + "context": { + "previousQnAId": 9, + "previousUserQuery": "Where are QnA Maker quickstarts?" + }, + "scoreThreshold": 20, + "strictFilters": [ + { + "name": "category", + "value": "api" + } + ], + "answerSpanRequest": { + "enable": true, + "scoreThreshold": 80, + "topAnswersWithSpan": 1 + }, + "userId": "sd53lsY=" + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "answers": [ + { + "questions": [ + "Complete a quickstart" + ], + "answer": "We offer quickstarts in most popular programming languages, each designed to teach you basic design patterns, and have you running code in less than 10 minutes. See the following list for the quickstart for each feature.\n\n* [Get started with the LUIS client library](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/quickstart-sdk)\n\n* [Get started with the LUIS portal](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/create-publish-knowledge-base)\n\n* [Get started with the LUIS REST APis](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/quickstart-rest-curl)", + "score": 46.11, + "id": 9, + "source": "Editorial", + "metadata": [], + "context": { + "isContextOnly": false, + "prompts": [] + }, + "answerSpan": { + "text": "less than 10 minutes", + "score": 54.92, + "startIndex": 139, + "endIndex": 159 + } + } + ] + } + } + } +} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json deleted file mode 100644 index f3b66f76d644..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsV2.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "parameters": { - "Endpoint": "{Endpoint}", - "Ocp-Apim-Subscription-Key": "{Primary/Secondary EndpointKey}", - "Content-Type": "application/json", - "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", - "generateAnswerPayload": { - "question": "can I integrate qna maker and luis?", - "top": 6, - "isTest": true, - "scoreThreshold": 20, - "strictFilters": [ - { - "name": "category", - "value": "api" - } - ], - "answerSpanRequest": { - "enable": true, - "scoreThreshold": 60, - "topAnswersWithSpan": 1 - }, - "userId": "sd53lsY=" - } - }, - "responses": { - "200": { - "headers": {}, - "body": { - "answers": [ - { - "score": 28.54820341616869, - "id": 20, - "answer": "There is no direct integration of LUIS with QnA Maker. But, in your bot code, you can use LUIS and QnA Maker together.", - "source": "Custom Editorial", - "questions": [ - "How can I integrate LUIS with QnA Maker?" - ], - "metadata": [ - { - "name": "category", - "value": "api" - } - ], - "answerSpan": { - "text": "There is no direct integration of LUIS with QnA Maker.", - "score": 0.12583243371129152, - "startIndex": 0, - "endIndex": 53 - } - } - ] - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsManaged.json similarity index 100% rename from specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsV2.json rename to specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsManaged.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json index c4d8302b7629..6dc5ca492391 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json @@ -3,7 +3,7 @@ "Endpoint": "{Endpoint}", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "{API key}", - "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx", + "kbId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "wordAlterations": { "wordAlterations": [ { diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsManaged.json similarity index 100% rename from specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json rename to specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsManaged.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainV2.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainManaged.json similarity index 100% rename from specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainV2.json rename to specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainManaged.json diff --git a/specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json b/specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json deleted file mode 100644 index 6dc5ca492391..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMakerManaged/preview/v5.0-preview.1/examples/SuccessfulSetAltsV2.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "parameters": { - "Endpoint": "{Endpoint}", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "{API key}", - "kbId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", - "wordAlterations": { - "wordAlterations": [ - { - "alterations": [ - "qnamaker", - "qna maker" - ] - }, - { - "alterations": [ - "botframework", - "bot framework" - ] - }, - { - "alterations": [ - "webchat", - "web chat" - ] - } - ] - } - }, - "responses": { - "204": {} - } -} From a7cc2ae070b56d644c9125c3a6c47018a38a6142 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 19:22:29 +0530 Subject: [PATCH 12/24] Minor string changes and answer span score to a reasonable number --- .../QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 6 +++--- .../v5.0-preview.1/examples/SuccessfulGenAnsManaged.json | 4 ++-- .../preview/v5.0-preview.1/examples/SuccessfulGetAlts.json | 3 +-- .../preview/v5.0-preview.1/examples/SuccessfulSetAlts.json | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 5f28f77d6b37..7023b2e74d23 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -172,7 +172,7 @@ "tags": [ "Alterations" ], - "summary": "Download alterations from runtime", + "summary": "Download alterations from runtime.", "operationId": "Alterations_Get", "consumes": [ "application/json" @@ -279,7 +279,7 @@ "tags": [ "Alterations" ], - "summary": "Replace alterations data per resource or per Knowledgebase (QnAMaker Managed).", + "summary": "Replace alterations data per Knowledgebase (QnAMaker Managed).", "operationId": "Alterations_Replace", "parameters": [ { @@ -1895,7 +1895,7 @@ }, "Endpoint": { "name": "Endpoint", - "description": "Supported Cognitive Services endpoint (e.g., https://< qnamaker-resource-name> .api.cognitiveservices.azure.com).", + "description": "Supported Cognitive Services endpoint (e.g., https://< qnamaker-resource-name >.api.cognitiveservices.azure.com).", "x-ms-parameter-location": "client", "required": true, "type": "string", diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json index f0c755fc2e9d..ca3eb65bf246 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json @@ -1,7 +1,7 @@ { "parameters": { "Endpoint": "{Endpoint}", - "Ocp-Apim-Subscription-Key": "{Primary/Secondary EndpointKey}", + "Ocp-Apim-Subscription-Key": "{API key}", "Content-Type": "application/json", "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", "generateAnswerPayload": { @@ -21,7 +21,7 @@ ], "answerSpanRequest": { "enable": true, - "scoreThreshold": 80, + "scoreThreshold": 50, "topAnswersWithSpan": 1 }, "userId": "sd53lsY=" diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json index 6b7ec3d304b0..465b1152950e 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAlts.json @@ -2,8 +2,7 @@ "parameters": { "Endpoint": "{Endpoint}", "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "{API key}", - "kbId": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx" + "Ocp-Apim-Subscription-Key": "{API key}" }, "responses": { "200": { diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json index 6dc5ca492391..ba8facefde92 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAlts.json @@ -3,7 +3,6 @@ "Endpoint": "{Endpoint}", "Content-Type": "application/json", "Ocp-Apim-Subscription-Key": "{API key}", - "kbId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "wordAlterations": { "wordAlterations": [ { From a7966024fbf276e66bf28affce004c564046bebd Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Thu, 8 Oct 2020 19:45:16 +0530 Subject: [PATCH 13/24] Make answerSpan scoreThreshold in example indicative --- .../v5.0-preview.1/examples/SuccessfulGenAnsManaged.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json index ca3eb65bf246..805f0b343310 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json @@ -21,7 +21,7 @@ ], "answerSpanRequest": { "enable": true, - "scoreThreshold": 50, + "scoreThreshold": 25, "topAnswersWithSpan": 1 }, "userId": "sd53lsY=" From 8dcaea65a82faa3e38c92a7602146e99326e7cf0 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 00:41:23 +0530 Subject: [PATCH 14/24] readme files reorganized added conditions for versions Runtime folder separate in 5.0-preview.1 as the common DTOs should not get overridden. --- .gitignore | 75 +++++++++++++- .../preview/v5.0-preview.1/QnAMaker.json | 4 +- .../data-plane/QnAMaker/readme.go.md | 22 ++--- .../data-plane/QnAMaker/readme.md | 98 ++++++++++++++----- .../data-plane/QnAMaker/readme.nodejs.md | 17 +++- .../data-plane/QnAMaker/readme.python.md | 13 +-- .../data-plane/QnAMaker/readme.ruby.md | 2 +- .../data-plane/QnAMaker/readme.typescript.md | 13 ++- 8 files changed, 195 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index a1c5fcb7f71a..9316744cc290 100644 --- a/.gitignore +++ b/.gitignore @@ -113,4 +113,77 @@ warnings.txt *.js *.d.ts *.js.map -*.d.ts.map \ No newline at end of file +*.d.ts.map +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Alterations.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/AlterationsExtensions.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointKeys.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointKeysExtensions.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointSettings.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointSettingsExtensions.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IAlterations.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IEndpointKeys.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IEndpointSettings.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IKnowledgebase.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IOperations.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IQnAMakerClient.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Knowledgebase.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/KnowledgebaseExtensions.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Operations.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/OperationsExtensions.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/QnAMakerClient.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ActiveLearningSettingsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/AlterationsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/AnswerSpanRequestDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/AnswerSpanResponseDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ContextDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/CreateKbDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/CreateKbInputDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/DeleteKbContentsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EndpointKeysDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EndpointSettingsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EnvironmentType.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/Error.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorCodeType.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorResponse.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorResponseError.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorResponseException.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/FeedbackRecordDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/FeedbackRecordsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/FileDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/InnerErrorModel.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/KnowledgebaseDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/KnowledgebasesDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/KnowledgebaseUpdateHeaders.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/MetadataDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/Operation.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/OperationsGetDetailsHeaders.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/OperationStateType.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/PromptDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/PromptDTOQna.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnADocumentsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnADTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnADTOContext.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResult.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResultAnswerSpan.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResultContext.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResultList.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryContextDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryDTOAnswerSpanRequest.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryDTOContext.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ReplaceKbDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/StrictFiltersCompoundOperationType.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateContextDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbContentsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTOAdd.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTODelete.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTOUpdate.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateMetadataDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTOContext.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTOMetadata.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTOQuestions.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQuestionsDTO.cs +specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/WordAlterationsDTO.cs diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 7023b2e74d23..bef7d4fc216c 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -690,7 +690,7 @@ "Knowledgebases" ], "summary": "GenerateAnswer call to query knowledgebase (QnA Maker Managed).", - "operationId": "Runtime_GenerateAnswer", + "operationId": "Knowledgebase_GenerateAnswer", "parameters": [ { "$ref": "#/parameters/KbId" @@ -732,7 +732,7 @@ "Knowledgebases" ], "summary": "Train call to add suggestions to knowledgebase (QnAMaker Managed).", - "operationId": "Runtime_Train", + "operationId": "Knowledgebase_Train", "parameters": [ { "$ref": "#/parameters/KbId" diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md index 7d45e65122f4..6aef0d498f8e 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md @@ -14,6 +14,8 @@ go: batch: - tag: release_4_0 - tag: runtime_release_4_0 + - tag: release_5_0_preview.1 + - tag: runtime_release_5_0_preview.1 ``` ### Tag: release_4_0 and go @@ -26,17 +28,6 @@ namespace: qnamaker output-folder: $(go-sdk-folder)/services/cognitiveservices/v4.0/$(namespace) ``` -### Tag: release_5_0-preview.1 and go - -These settings apply only when `--tag=release_5_0-preview.1 --go` is specified on the command line. -Please also specify `--go-sdk-folder=`. - -``` yaml $(tag) == 'release_5_0-preview.1' && $(go) -namespace: qnamaker -output-folder: $(go-sdk-folder)/services/cognitiveservices/v5.0-preview.1/$(namespace) -``` - - ### Tag: runtime_release_4_0 and go These settings apply only when `--tag=runtime_release_4_0 --go` is specified on the command line. @@ -47,6 +38,15 @@ namespace: qnamakerruntime output-folder: $(go-sdk-folder)/services/cognitiveservices/v4.0/$(namespace) ``` +### Tag: release_5_0-preview.1 and go + +These settings apply only when `--tag=release_5_0-preview.1 --go` is specified on the command line. +Please also specify `--go-sdk-folder=`. + +``` yaml $(tag) == 'release_5_0-preview.1' && $(go) +namespace: qnamaker +output-folder: $(go-sdk-folder)/services/cognitiveservices/v5.0-preview.1/$(namespace) +``` ### Tag: runtime_release_5_0_preview.1 and go diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.md index d8a2f1fc0ab8..78fe1e2e09b8 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.md @@ -14,14 +14,6 @@ tag: release_4_0 add-credentials: true openapi-type: data-plane ``` -# Releases - -### Release 4.0 -These settings apply only when `--tag=release_4_0` is specified on the command line. - -``` yaml $(tag) == 'release_4_0' -input-file: stable/v4.0/QnAMaker.json -``` ``` yaml tag: runtime_release_4_0 @@ -34,21 +26,21 @@ tag: release_5_0_preview.1 add-credentials: true openapi-type: data-plane ``` -# Releases - -### Release 5.0-preview.1 -These settings apply only when `--tag=release_5_0_preview.1` is specified on the command line. - -``` yaml $(tag) == 'release_5_0_preview.1' -input-file: preview/v5.0-preview.1/QnAMaker.json -``` ``` yaml -batch: - - tag: release_5_0_preview.1 +tag: runtime_release_preview.1 +add-credentials: true +openapi-type: data-plane ``` -# Runtime Releases +# Releases + +### Release 4.0 +These settings apply only when `--tag=release_4_0` is specified on the command line. + +``` yaml $(tag) == 'release_4_0' +input-file: stable/v4.0/QnAMaker.json +``` ### Runtime Release 4.0 These settings apply only when `--tag=runtime_release_4_0` is specified on the command line. @@ -57,6 +49,12 @@ These settings apply only when `--tag=runtime_release_4_0` is specified on the c input-file: stable/v4.0/QnAMakerRuntime.json ``` +### Release 5.0-preview.1 +These settings apply only when `--tag=release_5_0_preview.1` is specified on the command line. + +``` yaml $(tag) == 'release_5_0_preview.1' +input-file: preview/v5.0-preview.1/QnAMaker.json +``` ### Runtime Release 5.0-preview.1 These settings apply only when `--tag=runtime_release_5_0-preview.1` is specified on the command line. @@ -91,9 +89,10 @@ swagger-to-sdk: ``` -## CSharp Settings -These settings apply only when `--csharp` is specified on the command line. -``` yaml $(csharp) +## CSharp Settings Release 4.0 +These settings apply only when `--csharp --tag=release_4_0` is specified on the command line. + +``` yaml $(csharp) && $(tag) == 'release_4_0' csharp: sync-methods: None license-header: MICROSOFT_MIT_NO_VERSION @@ -103,6 +102,39 @@ csharp: clear-output-folder: true ``` +``` yaml $(csharp) && $(tag) == 'runtime_release_4_0' +csharp: + sync-methods: None + license-header: MICROSOFT_MIT_NO_VERSION + azure-arm: false + namespace: Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker + output-folder: $(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/src/Generated + clear-output-folder: true +``` +## CSharp Settings Release 5.0-preview.1 + +These settings apply only when `--csharp --tag=release_5_0_preview.1` is specified on the command line. + +``` yaml $(csharp) && $(tag) == 'release_5_0_preview.1' +csharp: + sync-methods: None + license-header: MICROSOFT_MIT_NO_VERSION + azure-arm: false + namespace: Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker + output-folder: $(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated + clear-output-folder: true +``` + +``` yaml $(csharp) && $(tag) == 'runtime_release_5_0_preview.1' +csharp: + sync-methods: None + license-header: MICROSOFT_MIT_NO_VERSION + azure-arm: false + namespace: Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker + output-folder: $(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Runtime/Generated + clear-output-folder: true +``` + ## Python See configuration in [readme.python.md](./readme.python.md) @@ -113,10 +145,25 @@ See configuration in [readme.go.md](./readme.go.md) ## Java -These settings apply only when `--java` is specified on the command line. +These settings apply only when `--java --tag=release_4_0` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(java) && $(tag) == 'release_4_0' +java: + azure-arm: true + namespace: com.microsoft.azure.cognitiveservices.knowledge.qnamaker + license-header: MICROSOFT_MIT_NO_CODEGEN + payload-flattening-threshold: 1 + output-folder: $(azure-libraries-for-java-folder)/cognitiveservices/data-plane/knowledge/qnamaker + with-optional-parameters: true + with-single-async-method: true +``` + + +These settings apply only when `--java --tag=release_5_0_preview` is specified on the command line. Please also specify `--azure-libraries-for-java-folder=`. -``` yaml $(java) +``` yaml $(java) && $(tag) == 'release_5_0_preview.1' java: azure-arm: true namespace: com.microsoft.azure.cognitiveservices.knowledge.qnamaker @@ -141,7 +188,8 @@ require: $(this-folder)/../../../../profiles/readme.md input-file: - $(this-folder)/stable/v4.0/QnAMaker.json - $(this-folder)/stable/v4.0/QnAMakerRuntime.json - + - $(this-folder)/stable/v5.0-preview.1/QnAMaker.json + - $(this-folder)/stable/v5.0-preview.1/QnAMakerRuntime.js ``` If there are files that should not be in the `all-api-versions` set, diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md index 4a819e11716c..57a72bee2547 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md @@ -1,9 +1,9 @@ ## Node.js -These settings apply only when `--nodejs` is specified on the command line. +These settings apply only when `--nodejs --tag=release_4_0` is specified on the command line. Please also specify `--node-sdks-folder=`. -``` yaml $(nodejs) +``` yaml $(tag) == 'release_4_0' && $(nodejs) nodejs: package-name: azure-cognitiveservices-qnamaker output-folder: $(node-sdks-folder)/lib/services/cognitiveServicesQnAMaker @@ -12,3 +12,16 @@ nodejs: generate-package-json: true generate-readme-md: true ``` + +These settings apply only when `--nodejs --tag=release_5_0-preview.1` is specified on the command line. +Please also specify `--node-sdks-folder=`. + +``` yaml $(tag) == 'release_5_0-preview.1' && $(nodejs) +nodejs: + package-name: azure-cognitiveservices-qnamaker-preview + output-folder: $(node-sdks-folder)/lib/services/cognitiveServicesQnAMaker/preview + azure-arm: false + generate-license-txt: true + generate-package-json: true + generate-readme-md: true +``` diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md index 50a68cdba0ca..7f103446cd7d 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md @@ -12,22 +12,23 @@ package-name: azure-cognitiveservices-knowledge-qnamaker no-namespace-folders: true clear-output-folder: true ``` + ``` yaml $(tag) == 'release_4_0' namespace: azure.cognitiveservices.knowledge.qnamaker.authoring output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring ``` -``` yaml $(tag) == 'release_5_0_preview.1' -namespace: azure.cognitiveservices.knowledge.qnamaker.authoring -output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/preview/v5.0-preview.1 -``` - ``` yaml $(tag) == 'runtime_release_4_0' namespace: azure.cognitiveservices.knowledge.qnamaker.runtime output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime ``` +``` yaml $(tag) == 'release_5_0_preview.1' +namespace: azure.cognitiveservices.knowledge.qnamaker.authoring +output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/preview +``` + ``` yaml $(tag) == 'runtime_release_5_0-preview.1' namespace: azure.cognitiveservices.knowledge.qnamaker.runtime -output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/preview/v5.0-preview.1 +output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/preview/ ``` \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md index 15444b105a53..29b355ae7f1c 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md @@ -34,5 +34,5 @@ Please also specify `--ruby-sdks-folder=`. -``` yaml $(typescript) +``` yaml $(tag) == 'release_4_0' && $(typescript) typescript: package-name: "@azure/cognitiveservices-qnamaker" output-folder: "$(typescript-sdks-folder)/sdk/cognitiveservices/cognitiveservices-qnamaker" azure-arm: false generate-metadata: true ``` + +These settings apply only when `--typescript` is specified on the command line. +Please also specify `--typescript-sdks-folder=`. + +``` yaml $(tag) == 'release_5_0_preview.1' && $(typescript) +typescript: + package-name: "@azure/cognitiveservices-qnamaker" + output-folder: "$(typescript-sdks-folder)/sdk/cognitiveservices/cognitiveservices-qnamaker/preview" + azure-arm: false + generate-metadata: true +``` From 434f6ad4bf954b642b7fa348ee3ad9ab3b8e0a49 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 13:01:25 +0530 Subject: [PATCH 15/24] remove runtime from preview swagger easing the creation of sdk (without conflicting QueryDTO and overriding problem) --- .gitignore | 75 +-- .../preview/v5.0-preview.1/QnAMaker.json | 17 +- .../v5.0-preview.1/QnAMakerRuntime.json | 540 ------------------ .../data-plane/QnAMaker/readme.go.md | 11 - .../data-plane/QnAMaker/readme.md | 19 - .../data-plane/QnAMaker/readme.python.md | 5 - 6 files changed, 5 insertions(+), 662 deletions(-) delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json diff --git a/.gitignore b/.gitignore index 9316744cc290..a1c5fcb7f71a 100644 --- a/.gitignore +++ b/.gitignore @@ -113,77 +113,4 @@ warnings.txt *.js *.d.ts *.js.map -*.d.ts.map -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Alterations.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/AlterationsExtensions.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointKeys.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointKeysExtensions.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointSettings.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/EndpointSettingsExtensions.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IAlterations.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IEndpointKeys.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IEndpointSettings.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IKnowledgebase.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IOperations.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/IQnAMakerClient.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Knowledgebase.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/KnowledgebaseExtensions.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Operations.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/OperationsExtensions.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/QnAMakerClient.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ActiveLearningSettingsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/AlterationsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/AnswerSpanRequestDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/AnswerSpanResponseDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ContextDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/CreateKbDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/CreateKbInputDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/DeleteKbContentsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EndpointKeysDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EndpointSettingsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EndpointSettingsDTOActiveLearning.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/EnvironmentType.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/Error.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorCodeType.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorResponse.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorResponseError.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ErrorResponseException.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/FeedbackRecordDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/FeedbackRecordsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/FileDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/InnerErrorModel.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/KnowledgebaseDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/KnowledgebasesDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/KnowledgebaseUpdateHeaders.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/MetadataDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/Operation.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/OperationsGetDetailsHeaders.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/OperationStateType.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/PromptDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/PromptDTOQna.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnADocumentsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnADTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnADTOContext.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResult.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResultAnswerSpan.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResultContext.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QnASearchResultList.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryContextDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryDTOAnswerSpanRequest.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/QueryDTOContext.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/ReplaceKbDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/StrictFiltersCompoundOperationType.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateContextDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbContentsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTOAdd.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTODelete.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateKbOperationDTOUpdate.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateMetadataDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTOContext.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTOMetadata.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQnaDTOQuestions.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/UpdateQuestionsDTO.cs -specification/cognitiveservices/data-plane/QnAMaker/$(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Generated/Models/WordAlterationsDTO.cs +*.d.ts.map \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index bef7d4fc216c..7c103cff3625 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -242,10 +242,10 @@ "Alterations" ], "summary": "Download alterations per Knowledgebase (QnAMaker Managed).", - "operationId": "Alterations_Get", + "operationId": "Alterations_GetKb", "parameters": [ { - "$ref": "#/parameters/AlterationsKbId" + "$ref": "#/parameters/KbId" } ], "consumes": [ @@ -280,10 +280,10 @@ "Alterations" ], "summary": "Replace alterations data per Knowledgebase (QnAMaker Managed).", - "operationId": "Alterations_Replace", + "operationId": "Alterations_ReplaceKb", "parameters": [ { - "$ref": "#/parameters/AlterationsKbId" + "$ref": "#/parameters/KbId" }, { "$ref": "#/parameters/WordAlterations" @@ -1833,15 +1833,6 @@ "description": "Knowledgebase id.", "x-ms-parameter-location": "method" }, - "AlterationsKbId": { - "type": "string", - "name": "kbId", - "in": "path", - "required": true, - "x-nullable": false, - "description": "Knowledgebase ID required for alterations operations on QnAMaker Managed.", - "x-ms-parameter-location": "method" - }, "OperationId": { "type": "string", "name": "operationId", diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json deleted file mode 100644 index 7149aeabb993..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMakerRuntime.json +++ /dev/null @@ -1,540 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "v5.0-preview.1", - "title": "QnAMaker Runtime Client", - "description": "An API for QnAMaker runtime" - }, - "securityDefinitions": { - "auth_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "security": [ - { - "auth_key": [] - } - ], - "x-ms-parameterized-host": { - "hostTemplate": "{RuntimeEndpoint}/qnamaker", - "useSchemePrefix": false, - "parameters": [ - { - "$ref": "#/parameters/RuntimeEndpoint" - } - ] - }, - "paths": { - "/knowledgebases/{kbId}/generateAnswer": { - "post": { - "tags": [ - "Knowledgebases" - ], - "summary": "GenerateAnswer call to query the knowledgebase.", - "operationId": "Runtime_GenerateAnswer", - "parameters": [ - { - "$ref": "#/parameters/KbId" - }, - { - "$ref": "#/parameters/GenerateAnswerPayload" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "GenerateAnswer call response.", - "schema": { - "$ref": "#/definitions/QnASearchResultList" - } - }, - "default": { - "description": "Error response.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Successful query": { - "$ref": "./examples/SuccessfulGenAns.json" - } - } - } - }, - "/knowledgebases/{kbId}/train": { - "post": { - "tags": [ - "Knowledgebases" - ], - "summary": "Train call to add suggestions to the knowledgebase.", - "operationId": "Runtime_Train", - "parameters": [ - { - "$ref": "#/parameters/KbId" - }, - { - "$ref": "#/parameters/TrainPayload" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "responses": { - "204": { - "description": "HTTP 204 No Content." - }, - "default": { - "description": "Error response.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Successful query": { - "$ref": "./examples/SuccessfulTrain.json" - } - } - } - } - }, - "definitions": { - "QnADTO": { - "type": "object", - "description": "Q-A object.", - "additionalProperties": false, - "required": [ - "answer", - "questions" - ], - "properties": { - "id": { - "type": "integer", - "description": "Unique id for the Q-A.", - "format": "int32" - }, - "answer": { - "type": "string", - "description": "Answer text", - "maxLength": 25000, - "minLength": 1 - }, - "source": { - "type": "string", - "description": "Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs", - "maxLength": 300 - }, - "questions": { - "type": "array", - "description": "List of questions associated with the answer.", - "maxLength": 100, - "minLength": 1, - "items": { - "type": "string" - } - }, - "metadata": { - "type": "array", - "description": "List of metadata associated with the answer.", - "maxLength": 10, - "items": { - "$ref": "#/definitions/MetadataDTO" - } - }, - "context": { - "description": "Context of a QnA", - "allOf": [ - { - "$ref": "#/definitions/ContextDTO" - } - ] - } - } - }, - "ContextDTO": { - "type": "object", - "description": "Context associated with Qna.", - "properties": { - "isContextOnly": { - "type": "boolean", - "description": "To mark if a prompt is relevant only with a previous question or not.\ntrue - Do not include this QnA as search result for queries without context\nfalse - ignores context and includes this QnA in search result" - }, - "prompts": { - "type": "array", - "description": "List of prompts associated with the answer.", - "maxItems": 20, - "items": { - "$ref": "#/definitions/PromptDTO" - } - } - } - }, - "PromptDTO": { - "type": "object", - "description": "Prompt for an answer.", - "properties": { - "displayOrder": { - "type": "integer", - "description": "Index of the prompt - used in ordering of the prompts", - "format": "int32" - }, - "qnaId": { - "type": "integer", - "description": "Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.", - "format": "int32" - }, - "qna": { - "description": "QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object", - "allOf": [ - { - "$ref": "#/definitions/QnADTO" - } - ] - }, - "displayText": { - "type": "string", - "description": "Text displayed to represent a follow up question prompt", - "maxLength": 200 - } - } - }, - "MetadataDTO": { - "type": "object", - "description": "Name - value pair of metadata.", - "additionalProperties": false, - "required": [ - "name", - "value" - ], - "properties": { - "name": { - "type": "string", - "description": "Metadata name.", - "maxLength": 100, - "minLength": 1 - }, - "value": { - "type": "string", - "description": "Metadata value.", - "maxLength": 500, - "minLength": 1 - } - } - }, - "ErrorResponse": { - "type": "object", - "description": "Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", - "additionalProperties": false, - "properties": { - "error": { - "description": "The error object.", - "allOf": [ - { - "$ref": "#/definitions/Error" - } - ] - } - } - }, - "Error": { - "type": "object", - "description": "The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", - "additionalProperties": false, - "required": [ - "code" - ], - "properties": { - "code": { - "description": "One of a server-defined set of error codes.", - "$ref": "#/definitions/ErrorCode" - }, - "message": { - "type": "string", - "description": "A human-readable representation of the error." - }, - "target": { - "type": "string", - "description": "The target of the error." - }, - "details": { - "type": "array", - "description": "An array of details about specific errors that led to this reported error.", - "items": { - "$ref": "#/definitions/Error" - } - }, - "innerError": { - "description": "An object containing more specific information than the current object about the error.", - "$ref": "#/definitions/InnerErrorModel" - } - } - }, - "ErrorCode": { - "type": "string", - "description": "Human readable error code.", - "x-ms-enum": { - "name": "ErrorCodeType", - "modelAsString": true - }, - "enum": [ - "BadArgument", - "Forbidden", - "NotFound", - "KbNotFound", - "Unauthorized", - "Unspecified", - "EndpointKeysError", - "QuotaExceeded", - "QnaRuntimeError", - "SKULimitExceeded", - "OperationNotFound", - "ServiceError", - "ValidationFailure", - "ExtractionFailure" - ] - }, - "InnerErrorModel": { - "type": "object", - "description": "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.", - "additionalProperties": false, - "properties": { - "code": { - "type": "string", - "description": "A more specific error code than was provided by the containing error." - }, - "innerError": { - "description": "An object containing more specific information than the current object about the error.", - "$ref": "#/definitions/InnerErrorModel" - } - } - }, - "QueryDTO": { - "type": "object", - "description": "POST body schema to query the knowledgebase.", - "additionalProperties": false, - "properties": { - "qnaId": { - "type": "string", - "description": "Exact qnaId to fetch from the knowledgebase, this field takes priority over question." - }, - "question": { - "type": "string", - "description": "User question to query against the knowledge base." - }, - "top": { - "type": "integer", - "description": "Max number of answers to be returned for the question.", - "format": "int32" - }, - "userId": { - "type": "string", - "description": "Unique identifier for the user. Optional parameter for telemetry. For more information, refer Analytics and Telemetry." - }, - "isTest": { - "type": "boolean", - "description": "Query against the test index." - }, - "scoreThreshold": { - "type": "number", - "description": "Threshold for answers returned based on score." - }, - "context": { - "description": "Context object with previous QnA's information.", - "allOf": [ - { - "$ref": "#/definitions/QueryContextDTO" - } - ] - }, - "rankerType": { - "type": "string", - "description": "Optional field. Set to 'QuestionOnly' for using a question only Ranker." - }, - "strictFilters": { - "type": "array", - "description": "Find only answers that contain these metadata.", - "items": { - "$ref": "#/definitions/MetadataDTO" - } - }, - "strictFiltersCompoundOperationType": { - "type": "string", - "description": "Optional field. Set to OR for using OR as Operation for Strict Filters.", - "x-ms-enum": { - "name": "StrictFiltersCompoundOperationType", - "modelAsString": true - }, - "enum": [ - "AND", - "OR" - ] - } - } - }, - "QueryContextDTO": { - "type": "object", - "description": "Context object with previous QnA's information.", - "additionalProperties": false, - "properties": { - "previousQnaId": { - "type": "string", - "description": "Previous QnA Id - qnaId of the top result." - }, - "previousUserQuery": { - "type": "string", - "description": "Previous user query." - } - } - }, - "QnASearchResultList": { - "type": "object", - "description": "Represents List of Question Answers.", - "additionalProperties": false, - "properties": { - "answers": { - "type": "array", - "description": "Represents Search Result list.", - "items": { - "$ref": "#/definitions/QnASearchResult" - } - } - } - }, - "QnASearchResult": { - "type": "object", - "description": "Represents Search Result.", - "additionalProperties": false, - "properties": { - "questions": { - "type": "array", - "description": "List of questions.", - "items": { - "type": "string" - } - }, - "answer": { - "type": "string", - "description": "Answer." - }, - "score": { - "type": "number", - "description": "Search result score." - }, - "id": { - "type": "integer", - "description": "Id of the QnA result.", - "format": "int32" - }, - "source": { - "type": "string", - "description": "Source of QnA result." - }, - "metadata": { - "type": "array", - "description": "List of metadata.", - "items": { - "$ref": "#/definitions/MetadataDTO" - } - }, - "context": { - "type": "object", - "description": "Context object of the QnA", - "allOf": [ - { - "$ref": "#/definitions/ContextDTO" - } - ] - } - } - }, - "FeedbackRecordsDTO": { - "type": "object", - "description": "Active learning feedback records.", - "additionalProperties": false, - "properties": { - "feedbackRecords": { - "type": "array", - "description": "List of feedback records.", - "maxLength": 1000, - "items": { - "$ref": "#/definitions/FeedbackRecordDTO" - } - } - } - }, - "FeedbackRecordDTO": { - "type": "object", - "description": "Active learning feedback record.", - "additionalProperties": false, - "properties": { - "userId": { - "type": "string", - "description": "Unique identifier for the user." - }, - "userQuestion": { - "type": "string", - "description": "The suggested question being provided as feedback.", - "maxLength": 1000 - }, - "qnaId": { - "type": "integer", - "description": "The qnaId for which the suggested question is provided as feedback.", - "format": "int32" - } - } - } - }, - "parameters": { - "KbId": { - "type": "string", - "name": "kbId", - "in": "path", - "required": true, - "x-nullable": false, - "description": "Knowledgebase id.", - "x-ms-parameter-location": "method" - }, - "RuntimeEndpoint": { - "name": "RuntimeEndpoint", - "description": "QnA Maker App Service endpoint (for example: https://{qnaservice-hostname}.azurewebsites.net).", - "x-ms-parameter-location": "client", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - }, - "GenerateAnswerPayload": { - "name": "generateAnswerPayload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/QueryDTO" - }, - "x-nullable": true, - "description": "Post body of the request.", - "x-ms-parameter-location": "method" - }, - "TrainPayload": { - "name": "trainPayload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/FeedbackRecordsDTO" - }, - "x-nullable": true, - "description": "Post body of the request.", - "x-ms-parameter-location": "method" - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md index 6aef0d498f8e..d79a89b965fc 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md @@ -15,7 +15,6 @@ batch: - tag: release_4_0 - tag: runtime_release_4_0 - tag: release_5_0_preview.1 - - tag: runtime_release_5_0_preview.1 ``` ### Tag: release_4_0 and go @@ -47,13 +46,3 @@ Please also specify `--go-sdk-folder=`. - -``` yaml $(tag) == 'runtime_release_5_0_preview.1' && $(go) -namespace: qnamakerruntime -output-folder: $(go-sdk-folder)/services/cognitiveservices/v5.0-preview.1/$(namespace) -``` \ No newline at end of file diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.md index 78fe1e2e09b8..1c01d0cd2d1b 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.md @@ -56,19 +56,11 @@ These settings apply only when `--tag=release_5_0_preview.1` is specified on the input-file: preview/v5.0-preview.1/QnAMaker.json ``` -### Runtime Release 5.0-preview.1 -These settings apply only when `--tag=runtime_release_5_0-preview.1` is specified on the command line. - -``` yaml $(tag) == 'runtime_release_5_0_preview.1' -input-file: preview/v5.0-preview.1/QnAMakerRuntime.json -``` - ``` yaml batch: - tag: release_4_0 - tag: runtime_release_4_0 - tag: release_5_0_preview.1 - - tag: runtime_release_5_0_preview.1 ``` ## Swagger to SDK @@ -125,16 +117,6 @@ csharp: clear-output-folder: true ``` -``` yaml $(csharp) && $(tag) == 'runtime_release_5_0_preview.1' -csharp: - sync-methods: None - license-header: MICROSOFT_MIT_NO_VERSION - azure-arm: false - namespace: Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker - output-folder: $(csharp-sdks-folder)/CognitiveServices/Knowledge.QnAMaker/preview/src/Runtime/Generated - clear-output-folder: true -``` - ## Python See configuration in [readme.python.md](./readme.python.md) @@ -189,7 +171,6 @@ input-file: - $(this-folder)/stable/v4.0/QnAMaker.json - $(this-folder)/stable/v4.0/QnAMakerRuntime.json - $(this-folder)/stable/v5.0-preview.1/QnAMaker.json - - $(this-folder)/stable/v5.0-preview.1/QnAMakerRuntime.js ``` If there are files that should not be in the `all-api-versions` set, diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md index 7f103446cd7d..5f4d9503ecc3 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md @@ -27,8 +27,3 @@ output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-k namespace: azure.cognitiveservices.knowledge.qnamaker.authoring output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/preview ``` - -``` yaml $(tag) == 'runtime_release_5_0-preview.1' -namespace: azure.cognitiveservices.knowledge.qnamaker.runtime -output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/preview/ -``` \ No newline at end of file From a393ba0113ed261aa2541f4d694b2c0b39f6700d Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 15:50:40 +0530 Subject: [PATCH 16/24] minor correction nodejs --- .../cognitiveservices/data-plane/QnAMaker/readme.nodejs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md index 57a72bee2547..afc9cb5373d7 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md @@ -16,7 +16,7 @@ nodejs: These settings apply only when `--nodejs --tag=release_5_0-preview.1` is specified on the command line. Please also specify `--node-sdks-folder=`. -``` yaml $(tag) == 'release_5_0-preview.1' && $(nodejs) +``` yaml $(tag) == 'release_5_0_preview.1' && $(nodejs) nodejs: package-name: azure-cognitiveservices-qnamaker-preview output-folder: $(node-sdks-folder)/lib/services/cognitiveServicesQnAMaker/preview From b184f1c79bedf0a26aa90eb90ddd286d7f360fb0 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 20:21:59 +0530 Subject: [PATCH 17/24] typos and string corrections readme files updated as some of the languages already have folder structures with version --- .../QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 4 ++-- .../cognitiveservices/data-plane/QnAMaker/readme.go.md | 6 +++--- .../cognitiveservices/data-plane/QnAMaker/readme.md | 2 +- .../cognitiveservices/data-plane/QnAMaker/readme.nodejs.md | 2 +- .../cognitiveservices/data-plane/QnAMaker/readme.python.md | 4 ++-- .../cognitiveservices/data-plane/QnAMaker/readme.ruby.md | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 7c103cff3625..a13cf575af77 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -242,7 +242,7 @@ "Alterations" ], "summary": "Download alterations per Knowledgebase (QnAMaker Managed).", - "operationId": "Alterations_GetKb", + "operationId": "Alterations_GetAlterationsForKb", "parameters": [ { "$ref": "#/parameters/KbId" @@ -280,7 +280,7 @@ "Alterations" ], "summary": "Replace alterations data per Knowledgebase (QnAMaker Managed).", - "operationId": "Alterations_ReplaceKb", + "operationId": "Alterations_ReplaceKbAlterationsForKb", "parameters": [ { "$ref": "#/parameters/KbId" diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md index d79a89b965fc..810c41516859 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md @@ -37,12 +37,12 @@ namespace: qnamakerruntime output-folder: $(go-sdk-folder)/services/cognitiveservices/v4.0/$(namespace) ``` -### Tag: release_5_0-preview.1 and go +### Tag: release_5_0_preview.1 and go -These settings apply only when `--tag=release_5_0-preview.1 --go` is specified on the command line. +These settings apply only when `--tag=release_5_0_preview.1 --go` is specified on the command line. Please also specify `--go-sdk-folder=`. -``` yaml $(tag) == 'release_5_0-preview.1' && $(go) +``` yaml $(tag) == 'release_5_0_preview.1' && $(go) namespace: qnamaker output-folder: $(go-sdk-folder)/services/cognitiveservices/v5.0-preview.1/$(namespace) ``` diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.md index 1c01d0cd2d1b..cb6c0cb177e2 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.md @@ -151,7 +151,7 @@ java: namespace: com.microsoft.azure.cognitiveservices.knowledge.qnamaker license-header: MICROSOFT_MIT_NO_CODEGEN payload-flattening-threshold: 1 - output-folder: $(azure-libraries-for-java-folder)/cognitiveservices/data-plane/knowledge/qnamaker + output-folder: $(azure-libraries-for-java-folder)/cognitiveservices/data-plane/knowledge/qnamaker/preview with-optional-parameters: true with-single-async-method: true ``` diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md index afc9cb5373d7..3f98fa061bd4 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.nodejs.md @@ -13,7 +13,7 @@ nodejs: generate-readme-md: true ``` -These settings apply only when `--nodejs --tag=release_5_0-preview.1` is specified on the command line. +These settings apply only when `--nodejs --tag=release_5_0_preview.1` is specified on the command line. Please also specify `--node-sdks-folder=`. ``` yaml $(tag) == 'release_5_0_preview.1' && $(nodejs) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md index 5f4d9503ecc3..782efcac951e 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md @@ -24,6 +24,6 @@ output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-k ``` ``` yaml $(tag) == 'release_5_0_preview.1' -namespace: azure.cognitiveservices.knowledge.qnamaker.authoring -output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/preview +namespace: azure.cognitiveservices.knowledge.qnamaker.authoring.preview +output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/ ``` diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md index 29b355ae7f1c..cbcfc7220bdd 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.ruby.md @@ -34,5 +34,5 @@ Please also specify `--ruby-sdks-folder= Date: Fri, 9 Oct 2020 22:32:04 +0530 Subject: [PATCH 18/24] corrected example and swagger for the latest changes --- .../QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 4 ++-- .../v5.0-preview.1/examples/SuccessfulDownloadKb.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index a13cf575af77..7078f2830eeb 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -1164,9 +1164,9 @@ } ] }, - "changedTimeStamp": { + "lastUpdatedTimestampUTC": { "type": "string", - "description": "Timestamp when the operation was created.", + "description": "Timestamp when the QnA was last updated.", "maxLength": 300 } diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json index b458e1e6fb3d..055a73e5f14c 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json @@ -23,7 +23,7 @@ "isContextOnly": false, "prompts": [] }, - "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" }, { "id": 2, @@ -48,7 +48,7 @@ } ] }, - "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" }, { "id": 3, @@ -73,7 +73,7 @@ } ] }, - "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" }, { "id": 4, @@ -87,7 +87,7 @@ "isContextOnly": false, "prompts": [] }, - "changedTimeStamp": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" } ] } From 100ca4f0b7e7fefa3e681d6179afa9e82f064fc2 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 22:35:45 +0530 Subject: [PATCH 19/24] another typo --- .../data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 7078f2830eeb..0a2fc9ca95e2 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -280,7 +280,7 @@ "Alterations" ], "summary": "Replace alterations data per Knowledgebase (QnAMaker Managed).", - "operationId": "Alterations_ReplaceKbAlterationsForKb", + "operationId": "Alterations_ReplaceAlterationsForKb", "parameters": [ { "$ref": "#/parameters/KbId" From 83d96418f01cc1468e2ee7e21e3eec75759da788 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 23:27:15 +0530 Subject: [PATCH 20/24] validation errors fixed --- .../preview/v5.0-preview.1/QnAMaker.json | 12 ++-- .../examples/SuccessfulGenAns.json | 42 ++++++++----- .../examples/SuccessfulGenAnsManaged.json | 59 ------------------- ...naged.json => SuccessfulGetAltsForKb.json} | 0 ...naged.json => SuccessfulSetAltsForKb.json} | 0 .../examples/SuccessfulTrain.json | 4 +- .../examples/SuccessfulTrainManaged.json | 20 ------- .../data-plane/QnAMaker/readme.md | 2 +- 8 files changed, 37 insertions(+), 102 deletions(-) delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json rename specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/{SuccessfulGetAltsManaged.json => SuccessfulGetAltsForKb.json} (100%) rename specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/{SuccessfulSetAltsManaged.json => SuccessfulSetAltsForKb.json} (100%) delete mode 100644 specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainManaged.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 0a2fc9ca95e2..a2b3030f9297 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -271,7 +271,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulGetAltsManaged.json" + "$ref": "./examples/SuccessfulGetAltsForKb.json" } } }, @@ -308,7 +308,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulSetAltsManaged.json" + "$ref": "./examples/SuccessfulSetAltsForKb.json" } } } @@ -721,7 +721,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulGenAnsManaged.json" + "$ref": "./examples/SuccessfulGenAns.json" } } } @@ -760,7 +760,7 @@ }, "x-ms-examples": { "Successful query": { - "$ref": "./examples/SuccessfulTrainManaged.json" + "$ref": "./examples/SuccessfulTrain.json" } } } @@ -1756,9 +1756,9 @@ "description": "Predicted text of answer span." }, "score": { - "type": "integer", + "type": "number", "description": "Predicted score of answer span.", - "format":"int32" + "format":"double" }, "startIndex": { "type": "integer", diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json index 63e0a9556c49..c225ade135db 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAns.json @@ -1,13 +1,17 @@ { "parameters": { - "RuntimeEndpoint": "{RuntimeEndpoint}", - "Authorization": "EndpointKey {Primary/Secondary EndpointKey}", + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{API key}", "Content-Type": "application/json", "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", "generateAnswerPayload": { - "question": "qna maker and luis", + "question": "How much time it takes to complete quickstart guide?", "top": 6, "isTest": true, + "context": { + "previousQnaId": 9, + "previousUserQuery": "Where are QnA Maker quickstarts?" + }, "scoreThreshold": 20, "strictFilters": [ { @@ -15,6 +19,11 @@ "value": "api" } ], + "answerSpanRequest": { + "enable": true, + "scoreThreshold": 25, + "topAnswersWithSpan": 1 + }, "userId": "sd53lsY=" } }, @@ -24,19 +33,24 @@ "body": { "answers": [ { - "score": 28.54820341616869, - "id": 20, - "answer": "There is no direct integration of LUIS with QnA Maker. But, in your bot code, you can use LUIS and QnA Maker together.", - "source": "Custom Editorial", "questions": [ - "How can I integrate LUIS with QnA Maker?" + "Complete a quickstart" ], - "metadata": [ - { - "name": "category", - "value": "api" - } - ] + "answer": "We offer quickstarts in most popular programming languages, each designed to teach you basic design patterns, and have you running code in less than 10 minutes. See the following list for the quickstart for each feature.\n\n* [Get started with the LUIS client library](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/quickstart-sdk)\n\n* [Get started with the LUIS portal](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/create-publish-knowledge-base)\n\n* [Get started with the LUIS REST APis](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/quickstart-rest-curl)", + "score": 46.11, + "id": 9, + "source": "Editorial", + "metadata": [], + "context": { + "isContextOnly": false, + "prompts": [] + }, + "answerSpan": { + "text": "less than 10 minutes", + "score": 54.92, + "startIndex": 139, + "endIndex": 159 + } } ] } diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json deleted file mode 100644 index 805f0b343310..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGenAnsManaged.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "parameters": { - "Endpoint": "{Endpoint}", - "Ocp-Apim-Subscription-Key": "{API key}", - "Content-Type": "application/json", - "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", - "generateAnswerPayload": { - "question": "How much time it takes to complete quickstart guide?", - "top": 6, - "isTest": true, - "context": { - "previousQnAId": 9, - "previousUserQuery": "Where are QnA Maker quickstarts?" - }, - "scoreThreshold": 20, - "strictFilters": [ - { - "name": "category", - "value": "api" - } - ], - "answerSpanRequest": { - "enable": true, - "scoreThreshold": 25, - "topAnswersWithSpan": 1 - }, - "userId": "sd53lsY=" - } - }, - "responses": { - "200": { - "headers": {}, - "body": { - "answers": [ - { - "questions": [ - "Complete a quickstart" - ], - "answer": "We offer quickstarts in most popular programming languages, each designed to teach you basic design patterns, and have you running code in less than 10 minutes. See the following list for the quickstart for each feature.\n\n* [Get started with the LUIS client library](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/quickstart-sdk)\n\n* [Get started with the LUIS portal](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/create-publish-knowledge-base)\n\n* [Get started with the LUIS REST APis](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/quickstarts/quickstart-rest-curl)", - "score": 46.11, - "id": 9, - "source": "Editorial", - "metadata": [], - "context": { - "isContextOnly": false, - "prompts": [] - }, - "answerSpan": { - "text": "less than 10 minutes", - "score": 54.92, - "startIndex": 139, - "endIndex": 159 - } - } - ] - } - } - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsForKb.json similarity index 100% rename from specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsManaged.json rename to specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulGetAltsForKb.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsForKb.json similarity index 100% rename from specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsManaged.json rename to specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulSetAltsForKb.json diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json index 3448a4009b3d..4dabb5d81c35 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrain.json @@ -1,7 +1,7 @@ { "parameters": { - "RuntimeEndpoint": "{RuntimeEndpoint}", - "Authorization": "EndpointKey {Primary/Secondary Endpoint Key}", + "Endpoint": "{Endpoint}", + "Ocp-Apim-Subscription-Key": "{Primary/Secondary Endpoint Key}", "Content-Type": "application/json", "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", "trainPayload": { diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainManaged.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainManaged.json deleted file mode 100644 index 4dabb5d81c35..000000000000 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulTrainManaged.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "parameters": { - "Endpoint": "{Endpoint}", - "Ocp-Apim-Subscription-Key": "{Primary/Secondary Endpoint Key}", - "Content-Type": "application/json", - "kbId": "9d091697-fb8c-4ed5-9ac0-35bf8273bfff", - "trainPayload": { - "feedbackRecords": [ - { - "userId": "sd53lsY=", - "userQuestion": "qna maker with luis", - "qnaId": 4 - } - ] - } - }, - "responses": { - "204": {} - } -} diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.md index cb6c0cb177e2..df7bb80d5701 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.md @@ -170,7 +170,7 @@ require: $(this-folder)/../../../../profiles/readme.md input-file: - $(this-folder)/stable/v4.0/QnAMaker.json - $(this-folder)/stable/v4.0/QnAMakerRuntime.json - - $(this-folder)/stable/v5.0-preview.1/QnAMaker.json + - $(this-folder)/preview/v5.0-preview.1/QnAMaker.json ``` If there are files that should not be in the `all-api-versions` set, From 75555948c7554df51f2d83cd90faac390beb4b96 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Fri, 9 Oct 2020 23:40:37 +0530 Subject: [PATCH 21/24] prettier fixed, model validation fixed --- .../preview/v5.0-preview.1/QnAMaker.json | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index a2b3030f9297..283cf7e6236d 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -1169,7 +1169,6 @@ "description": "Timestamp when the QnA was last updated.", "maxLength": 300 } - } }, "ContextDTO": { @@ -1608,7 +1607,7 @@ "additionalProperties": false, "properties": { "previousQnaId": { - "type": "string", + "type": "integer", "description": "Previous QnA Id - qnaId of the top result." }, "previousUserQuery": { @@ -1751,25 +1750,25 @@ "description": "Answer span object of QnA.", "additionalProperties": false, "properties": { - "text": { - "type": "string", - "description": "Predicted text of answer span." - }, - "score": { - "type": "number", - "description": "Predicted score of answer span.", - "format":"double" - }, - "startIndex": { - "type": "integer", - "description": "Start index of answer span in answer.", - "format":"int32" - }, - "endIndex": { - "type": "integer", - "description": "End index of answer span in answer.", - "format":"int32" - } + "text": { + "type": "string", + "description": "Predicted text of answer span." + }, + "score": { + "type": "number", + "description": "Predicted score of answer span.", + "format": "double" + }, + "startIndex": { + "type": "integer", + "description": "Start index of answer span in answer.", + "format": "int32" + }, + "endIndex": { + "type": "integer", + "description": "End index of answer span in answer.", + "format": "int32" + } } } }, From 7475a21821c9691c63aa5b364e7d66c36abd0521 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Sat, 10 Oct 2020 00:05:04 +0530 Subject: [PATCH 22/24] lastUpdatedTimestamp instead of lastUpdatedTimestampUTC --- .../QnAMaker/preview/v5.0-preview.1/QnAMaker.json | 2 +- .../v5.0-preview.1/examples/SuccessfulDownloadKb.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json index 283cf7e6236d..0d9c4c84d099 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/QnAMaker.json @@ -1164,7 +1164,7 @@ } ] }, - "lastUpdatedTimestampUTC": { + "lastUpdatedTimestamp": { "type": "string", "description": "Timestamp when the QnA was last updated.", "maxLength": 300 diff --git a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json index 055a73e5f14c..9c4bb3d38824 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json +++ b/specification/cognitiveservices/data-plane/QnAMaker/preview/v5.0-preview.1/examples/SuccessfulDownloadKb.json @@ -23,7 +23,7 @@ "isContextOnly": false, "prompts": [] }, - "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestamp": "2020-08-27T16:00:30.272746+00:00" }, { "id": 2, @@ -48,7 +48,7 @@ } ] }, - "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestamp": "2020-08-27T16:00:30.272746+00:00" }, { "id": 3, @@ -73,7 +73,7 @@ } ] }, - "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestamp": "2020-08-27T16:00:30.272746+00:00" }, { "id": 4, @@ -87,7 +87,7 @@ "isContextOnly": false, "prompts": [] }, - "lastUpdatedTimestampUTC": "2020-08-27T16:00:30.272746+00:00" + "lastUpdatedTimestamp": "2020-08-27T16:00:30.272746+00:00" } ] } From 90aea9e239361146c2b853841862eea7dce7cc14 Mon Sep 17 00:00:00 2001 From: Sri Susloka Sahithi K Date: Sat, 10 Oct 2020 00:38:22 +0530 Subject: [PATCH 23/24] output-folder for go sdk for preview to have path format as specified in docuemntation --- .../cognitiveservices/data-plane/QnAMaker/readme.go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md index 810c41516859..ac3d12f87b38 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.go.md @@ -44,5 +44,5 @@ Please also specify `--go-sdk-folder= Date: Sat, 10 Oct 2020 01:26:54 +0530 Subject: [PATCH 24/24] namespace azure.cognitiveservices.knowledge.qnamaker.preview for python --- .../cognitiveservices/data-plane/QnAMaker/readme.python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md index 782efcac951e..6be17bcb15d8 100644 --- a/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md +++ b/specification/cognitiveservices/data-plane/QnAMaker/readme.python.md @@ -24,6 +24,6 @@ output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-k ``` ``` yaml $(tag) == 'release_5_0_preview.1' -namespace: azure.cognitiveservices.knowledge.qnamaker.authoring.preview +namespace: azure.cognitiveservices.knowledge.qnamaker.preview output-folder: $(python-sdks-folder)/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/ ```