diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md b/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md
index 9acb604fc652..07443d5c20a0 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md
@@ -15,7 +15,13 @@ npm install @azure/cognitiveservices-qnamaker
### How to use
-#### nodejs - Authentication, client creation and getKeys endpointKeys as an example written in TypeScript.
+#### nodejs - Authentication, client creation and getSettings endpointSettings as an example written in TypeScript.
+
+##### Install @azure/ms-rest-nodeauth
+
+```bash
+npm install @azure/ms-rest-nodeauth
+```
##### Sample code
@@ -24,21 +30,30 @@ import * as msRest from "@azure/ms-rest-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { QnAMakerClient, QnAMakerModels, QnAMakerMappers } from "@azure/cognitiveservices-qnamaker";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
-const endpoint = "https://westus.api.cognitive.microsoft.com"; // OR some other endpoint.
-const creds = new msRest.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': subscriptionId }});
-const client = new QnAMakerClient(creds, endpoint);
-client.endpointKeys.getKeys().then((result) => {
- console.log("The result is:");
- console.log(result);
+
+msRestNodeAuth.interactiveLogin().then((creds) => {
+ const client = new QnAMakerClient(creds, subscriptionId);
+ client.endpointSettings.getSettings().then((result) => {
+ console.log("The result is:");
+ console.log(result);
+ });
}).catch((err) => {
console.error(err);
});
```
-#### browser - Authentication, client creation and getKeys endpointKeys as an example written in JavaScript.
+#### browser - Authentication, client creation and getSettings endpointSettings as an example written in JavaScript.
+
+##### Install @azure/ms-rest-browserauth
+
+```bash
+npm install @azure/ms-rest-browserauth
+```
##### Sample code
+See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
+
- index.html
```html
@@ -50,15 +65,23 @@ client.endpointKeys.getKeys().then((result) => {
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json b/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json
index 86831bce930f..f49593106f8b 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json
@@ -4,7 +4,7 @@
"description": "QnAMakerClient Library with typescript type definitions for node.js and browser.",
"version": "2.0.0",
"dependencies": {
- "@azure/ms-rest-js": "^1.8.4",
+ "@azure/ms-rest-js": "^1.8.1",
"tslib": "^1.9.3"
},
"keywords": [
@@ -25,7 +25,7 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.4.9"
},
- "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-qnamaker",
+ "homepage": "https://github.com/azure/azure-sdk-for-js",
"repository": {
"type": "git",
"url": "https://github.com/azure/azure-sdk-for-js.git"
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/endpointSettingsMappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/endpointSettingsMappers.ts
new file mode 100644
index 000000000000..41a5e8575e4f
--- /dev/null
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/endpointSettingsMappers.ts
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
+
+export {
+ ActiveLearningSettingsDTO,
+ EndpointSettingsDTO,
+ EndpointSettingsDTOActiveLearning,
+ ErrorModel,
+ ErrorResponse,
+ ErrorResponseError,
+ InnerErrorModel
+} from "../models/mappers";
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/index.ts
index 540a6c146fca..f061b6ae676f 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/index.ts
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/index.ts
@@ -494,6 +494,32 @@ export interface KnowledgebasesDTO {
knowledgebases?: KnowledgebaseDTO[];
}
+/**
+ * Active Learning settings of the endpoint.
+ */
+export interface ActiveLearningSettingsDTO {
+ /**
+ * True/False string providing Active Learning
+ */
+ enable?: string;
+}
+
+/**
+ * Active Learning settings of the endpoint.
+ */
+export interface EndpointSettingsDTOActiveLearning extends ActiveLearningSettingsDTO {
+}
+
+/**
+ * Endpoint settings.
+ */
+export interface EndpointSettingsDTO {
+ /**
+ * Active Learning settings of the endpoint.
+ */
+ activeLearning?: EndpointSettingsDTOActiveLearning;
+}
+
/**
* Collection of words that are synonyms.
*/
@@ -592,6 +618,51 @@ export type OperationStateType = 'Failed' | 'NotStarted' | 'Running' | 'Succeede
*/
export type EnvironmentType = 'Prod' | 'Test';
+/**
+ * Contains response data for the getSettings operation.
+ */
+export type EndpointSettingsGetSettingsResponse = EndpointSettingsDTO & {
+ /**
+ * The underlying HTTP response.
+ */
+ _response: msRest.HttpResponse & {
+ /**
+ * The response body as text (string format)
+ */
+ bodyAsText: string;
+
+ /**
+ * The response body as parsed JSON or XML
+ */
+ parsedBody: EndpointSettingsDTO;
+ };
+};
+
+/**
+ * Contains response data for the updateSettings operation.
+ */
+export type EndpointSettingsUpdateSettingsResponse = {
+ /**
+ * The parsed response body.
+ */
+ body: string;
+
+ /**
+ * The underlying HTTP response.
+ */
+ _response: msRest.HttpResponse & {
+ /**
+ * The response body as text (string format)
+ */
+ bodyAsText: string;
+
+ /**
+ * The response body as parsed JSON or XML
+ */
+ parsedBody: string;
+ };
+};
+
/**
* Contains response data for the getKeys operation.
*/
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/mappers.ts
index ac4a6e0de483..2bab9366e2b8 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/mappers.ts
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/models/mappers.ts
@@ -950,6 +950,50 @@ export const KnowledgebasesDTO: msRest.CompositeMapper = {
}
};
+export const ActiveLearningSettingsDTO: msRest.CompositeMapper = {
+ serializedName: "ActiveLearningSettingsDTO",
+ type: {
+ name: "Composite",
+ className: "ActiveLearningSettingsDTO",
+ modelProperties: {
+ enable: {
+ serializedName: "enable",
+ type: {
+ name: "String"
+ }
+ }
+ }
+ }
+};
+
+export const EndpointSettingsDTOActiveLearning: msRest.CompositeMapper = {
+ serializedName: "EndpointSettingsDTO_activeLearning",
+ type: {
+ name: "Composite",
+ className: "EndpointSettingsDTOActiveLearning",
+ modelProperties: {
+ ...ActiveLearningSettingsDTO.type.modelProperties
+ }
+ }
+};
+
+export const EndpointSettingsDTO: msRest.CompositeMapper = {
+ serializedName: "EndpointSettingsDTO",
+ type: {
+ name: "Composite",
+ className: "EndpointSettingsDTO",
+ modelProperties: {
+ activeLearning: {
+ serializedName: "activeLearning",
+ type: {
+ name: "Composite",
+ className: "EndpointSettingsDTOActiveLearning"
+ }
+ }
+ }
+ }
+};
+
export const AlterationsDTO: msRest.CompositeMapper = {
serializedName: "AlterationsDTO",
type: {
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/endpointSettings.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/endpointSettings.ts
new file mode 100644
index 000000000000..9b21f50dbcdf
--- /dev/null
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/endpointSettings.ts
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+import * as msRest from "@azure/ms-rest-js";
+import * as Models from "../models";
+import * as Mappers from "../models/endpointSettingsMappers";
+import * as Parameters from "../models/parameters";
+import { QnAMakerClientContext } from "../qnAMakerClientContext";
+
+/** Class representing a EndpointSettings. */
+export class EndpointSettings {
+ private readonly client: QnAMakerClientContext;
+
+ /**
+ * Create a EndpointSettings.
+ * @param {QnAMakerClientContext} client Reference to the service client.
+ */
+ constructor(client: QnAMakerClientContext) {
+ this.client = client;
+ }
+
+ /**
+ * @summary Gets endpoint settings for an endpoint.
+ * @param [options] The optional parameters
+ * @returns Promise
+ */
+ getSettings(options?: msRest.RequestOptionsBase): Promise;
+ /**
+ * @param callback The callback
+ */
+ getSettings(callback: msRest.ServiceCallback): void;
+ /**
+ * @param options The optional parameters
+ * @param callback The callback
+ */
+ getSettings(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void;
+ getSettings(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise {
+ return this.client.sendOperationRequest(
+ {
+ options
+ },
+ getSettingsOperationSpec,
+ callback) as Promise;
+ }
+
+ /**
+ * @summary Updates endpoint settings for an endpoint.
+ * @param endpointSettingsPayload Post body of the request.
+ * @param [options] The optional parameters
+ * @returns Promise
+ */
+ updateSettings(endpointSettingsPayload: Models.EndpointSettingsDTO, options?: msRest.RequestOptionsBase): Promise;
+ /**
+ * @param endpointSettingsPayload Post body of the request.
+ * @param callback The callback
+ */
+ updateSettings(endpointSettingsPayload: Models.EndpointSettingsDTO, callback: msRest.ServiceCallback): void;
+ /**
+ * @param endpointSettingsPayload Post body of the request.
+ * @param options The optional parameters
+ * @param callback The callback
+ */
+ updateSettings(endpointSettingsPayload: Models.EndpointSettingsDTO, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void;
+ updateSettings(endpointSettingsPayload: Models.EndpointSettingsDTO, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise {
+ return this.client.sendOperationRequest(
+ {
+ endpointSettingsPayload,
+ options
+ },
+ updateSettingsOperationSpec,
+ callback) as Promise;
+ }
+}
+
+// Operation Specifications
+const serializer = new msRest.Serializer(Mappers);
+const getSettingsOperationSpec: msRest.OperationSpec = {
+ httpMethod: "GET",
+ path: "endpointSettings",
+ urlParameters: [
+ Parameters.endpoint
+ ],
+ responses: {
+ 200: {
+ bodyMapper: Mappers.EndpointSettingsDTO
+ },
+ default: {
+ bodyMapper: Mappers.ErrorResponse
+ }
+ },
+ serializer
+};
+
+const updateSettingsOperationSpec: msRest.OperationSpec = {
+ httpMethod: "PATCH",
+ path: "endpointSettings",
+ urlParameters: [
+ Parameters.endpoint
+ ],
+ requestBody: {
+ parameterPath: "endpointSettingsPayload",
+ mapper: {
+ ...Mappers.EndpointSettingsDTO,
+ required: true
+ }
+ },
+ responses: {
+ 200: {
+ bodyMapper: {
+ serializedName: "parsedResponse",
+ type: {
+ name: "String"
+ }
+ }
+ },
+ default: {
+ bodyMapper: Mappers.ErrorResponse
+ }
+ },
+ serializer
+};
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/index.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/index.ts
index e46ec2db7f23..e67a8e209eb3 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/index.ts
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/operations/index.ts
@@ -8,6 +8,7 @@
* regenerated.
*/
+export * from "./endpointSettings";
export * from "./endpointKeys";
export * from "./alterations";
export * from "./knowledgebase";
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClient.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClient.ts
index ee10e56a80ad..bf1194ce9e10 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClient.ts
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClient.ts
@@ -16,6 +16,7 @@ import { QnAMakerClientContext } from "./qnAMakerClientContext";
class QnAMakerClient extends QnAMakerClientContext {
// Operation groups
+ endpointSettings: operations.EndpointSettings;
endpointKeys: operations.EndpointKeys;
alterations: operations.Alterations;
knowledgebase: operations.Knowledgebase;
@@ -30,6 +31,7 @@ class QnAMakerClient extends QnAMakerClientContext {
*/
constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) {
super(credentials, endpoint, options);
+ this.endpointSettings = new operations.EndpointSettings(this);
this.endpointKeys = new operations.EndpointKeys(this);
this.alterations = new operations.Alterations(this);
this.knowledgebase = new operations.Knowledgebase(this);
diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClientContext.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClientContext.ts
index e76db2de129e..556970b3af33 100644
--- a/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClientContext.ts
+++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/src/qnAMakerClientContext.ts
@@ -11,7 +11,7 @@
import * as msRest from "@azure/ms-rest-js";
const packageName = "@azure/cognitiveservices-qnamaker";
-const packageVersion = "1.0.0";
+const packageVersion = "2.0.0";
export class QnAMakerClientContext extends msRest.ServiceClient {
endpoint: string;