Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/@azure/cognitiveservices-qnamaker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ npm install @azure/cognitiveservices-qnamaker

## How to use

### nodejs - Authentication, client creation and getKeys endpoint as an example written in TypeScript.
### nodejs - Authentication, client creation and getKeys endpointKeys as an example written in TypeScript.

```ts
import * as msRest from "ms-rest-js";
Expand All @@ -26,7 +26,7 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new QnAMakerClient(creds, subscriptionId);
client.endpoint.getKeys().then((result) => {
client.endpointKeys.getKeys().then((result) => {
console.log("The result is:");
console.log(result);
});
Expand All @@ -35,7 +35,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => {
});
```

### browser - Authentication, client creation and getKeys endpoint as an example written in javascript.
### browser - Authentication, client creation and getKeys endpointKeys as an example written in javascript.

- index.html
```html
Expand All @@ -58,7 +58,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => {
authManager.login();
}
const client = new Azure.CognitiveservicesQnamaker.QnAMakerClient(res.creds, subscriptionId);
client.endpoint.getKeys().then((result) => {
client.endpointKeys.getKeys().then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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 {
EndpointKeysDTO,
ErrorResponse,
ErrorResponseError,
ErrorModel,
InnerErrorModel
} from "../models/mappers";

Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ export type EnvironmentType = 'Prod' | 'Test';
/**
* Contains response data for the getKeys operation.
*/
export type EndpointGetKeysResponse = EndpointKeysDTO & {
export type EndpointKeysGetKeysResponse = EndpointKeysDTO & {
/**
* The underlying HTTP response.
*/
Expand All @@ -661,7 +661,7 @@ export type EndpointGetKeysResponse = EndpointKeysDTO & {
/**
* Contains response data for the refreshKeys operation.
*/
export type EndpointRefreshKeysResponse = EndpointKeysDTO & {
export type EndpointKeysRefreshKeysResponse = EndpointKeysDTO & {
/**
* The underlying HTTP response.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* 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 "ms-rest-js";
import * as Models from "../models";
import * as Mappers from "../models/endpointKeysMappers";
import * as Parameters from "../models/parameters";
import { QnAMakerClientContext } from "../qnAMakerClientContext";

/** Class representing a EndpointKeys. */
export class EndpointKeys {
private readonly client: QnAMakerClientContext;

/**
* Create a EndpointKeys.
* @param {QnAMakerClientContext} client Reference to the service client.
*/
constructor(client: QnAMakerClientContext) {
this.client = client;
}

/**
* @summary Gets endpoint keys for an endpoint
* @param [options] The optional parameters
* @returns Promise<Models.EndpointKeysGetKeysResponse>
*/
getKeys(options?: msRest.RequestOptionsBase): Promise<Models.EndpointKeysGetKeysResponse>;
/**
* @param callback The callback
*/
getKeys(callback: msRest.ServiceCallback<Models.EndpointKeysDTO>): void;
/**
* @param options The optional parameters
* @param callback The callback
*/
getKeys(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.EndpointKeysDTO>): void;
getKeys(options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.EndpointKeysDTO>, callback?: msRest.ServiceCallback<Models.EndpointKeysDTO>): Promise<Models.EndpointKeysGetKeysResponse> {
return this.client.sendOperationRequest(
{
options
},
getKeysOperationSpec,
callback) as Promise<Models.EndpointKeysGetKeysResponse>;
}

/**
* @summary Re-generates an endpoint key.
* @param keyType Type of Key
* @param [options] The optional parameters
* @returns Promise<Models.EndpointKeysRefreshKeysResponse>
*/
refreshKeys(keyType: string, options?: msRest.RequestOptionsBase): Promise<Models.EndpointKeysRefreshKeysResponse>;
/**
* @param keyType Type of Key
* @param callback The callback
*/
refreshKeys(keyType: string, callback: msRest.ServiceCallback<Models.EndpointKeysDTO>): void;
/**
* @param keyType Type of Key
* @param options The optional parameters
* @param callback The callback
*/
refreshKeys(keyType: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.EndpointKeysDTO>): void;
refreshKeys(keyType: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.EndpointKeysDTO>, callback?: msRest.ServiceCallback<Models.EndpointKeysDTO>): Promise<Models.EndpointKeysRefreshKeysResponse> {
return this.client.sendOperationRequest(
{
keyType,
options
},
refreshKeysOperationSpec,
callback) as Promise<Models.EndpointKeysRefreshKeysResponse>;
}
}

// Operation Specifications
const serializer = new msRest.Serializer(Mappers);
const getKeysOperationSpec: msRest.OperationSpec = {
httpMethod: "GET",
path: "endpointkeys",
urlParameters: [
Parameters.endpoint
],
responses: {
200: {
bodyMapper: Mappers.EndpointKeysDTO
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};

const refreshKeysOperationSpec: msRest.OperationSpec = {
httpMethod: "PATCH",
path: "endpointkeys/{keyType}",
urlParameters: [
Parameters.endpoint,
Parameters.keyType
],
responses: {
200: {
bodyMapper: Mappers.EndpointKeysDTO
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* regenerated.
*/

export * from "./endpoint";
export * from "./endpointKeys";
export * from "./alterations";
export * from "./knowledgebase";
export * from "./operations";
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { QnAMakerClientContext } from "./qnAMakerClientContext";

class QnAMakerClient extends QnAMakerClientContext {
// Operation groups
endpoint: operations.Endpoint;
endpointKeys: operations.EndpointKeys;
alterations: operations.Alterations;
knowledgebase: operations.Knowledgebase;
operations: operations.Operations;
Expand All @@ -30,7 +30,7 @@ class QnAMakerClient extends QnAMakerClientContext {
*/
constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) {
super(endpoint, credentials, options);
this.endpoint = new operations.Endpoint(this);
this.endpointKeys = new operations.EndpointKeys(this);
this.alterations = new operations.Alterations(this);
this.knowledgebase = new operations.Knowledgebase(this);
this.operations = new operations.Operations(this);
Expand Down