Skip to content

Commit

Permalink
Generated from 799edc5059454d0f8cc35229323406fe3faa26eb (#296)
Browse files Browse the repository at this point in the history
Update read me files
  • Loading branch information
openapi-sdkautomation[bot] authored Oct 11, 2019
1 parent c85a4c3 commit 942dfa2
Show file tree
Hide file tree
Showing 28 changed files with 2,126 additions and 3,022 deletions.
89 changes: 43 additions & 46 deletions sdk/cognitiveservices/cognitiveservices-luis-authoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,83 +17,80 @@ npm install @azure/cognitiveservices-luis-authoring

#### nodejs - Authentication, client creation and listApplicationVersionPatternFeatures features as an example written in TypeScript.

##### Install @azure/ms-rest-azure-js
##### Install @azure/ms-rest-nodeauth

```bash
npm install @azure/ms-rest-azure-js
npm install @azure/ms-rest-nodeauth
```

##### Sample code

```typescript
import { CognitiveServicesCredentials } from "@azure/ms-rest-azure-js";
import { LUISAuthoringClient } from "@azure/cognitiveservices-luis-authoring";

let authoringKey = process.env["luis-authoring-key"];
const creds = new CognitiveServicesCredentials(authoringKey);

// check the following link to find your region
// https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-reference-regions
const region = "<your-region>";
const client = new LUISAuthoringClient(
creds,
"https://" + region + ".api.cognitive.microsoft.com/"
);

const appId = "<your-app-id>"; // replace this with your appId.
const versionId = "0.1"; // replace with version of your luis application. Initial value will be 0.1

const skip = 1;
const take = 1;

client.features
.listApplicationVersionPatternFeatures(appId, versionId, { skip, take })
.then((result) => {
import * as msRest from "@azure/ms-rest-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { LUISAuthoringClient, LUISAuthoringModels, LUISAuthoringMappers } from "@azure/cognitiveservices-luis-authoring";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new LUISAuthoringClient(creds, subscriptionId);
const appId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
const versionId = "testversionId";
const skip = 1;
const take = 1;
client.features.listApplicationVersionPatternFeatures(appId, versionId, skip, take).then((result) => {
console.log("The result is:");
console.log(result);
})
.catch((err) => {
console.error(err);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and listApplicationVersionPatternFeatures features as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```bash
npm install @azure/ms-rest-browserauth
```

##### Sample code

- index.html
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/cognitiveservices-luis-authoring sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/cognitiveservices-luis-authoring/dist/cognitiveservices-luis-authoring.js"></script>
<script type="text/javascript">
let authoringKey = process.env["luis-authoring-key"];
const creds = new msRest.ApiKeyCredentials({ inHeader: { 'Ocp-Apim-Subscription-Key': authoringKey } });
const region = "<your-region>";
const client = new Azure.CognitiveservicesLuisAuthoring.LUISAuthoringClient(
creds,
"https://" + region + ".api.cognitive.microsoft.com/"
);
const appId = "<your-app-id>"; // replace this with your appId.
const versionId = "0.1"; // replace with version of your luis application. Initial value will be 0.1
const skip = 1;
const take = 1;
client.features
.listApplicationVersionPatternFeatures(appId, versionId, { skip, take })
.then((result) => {
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.CognitiveservicesLuisAuthoring.LUISAuthoringClient(res.creds, subscriptionId);
const appId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
const versionId = "testversionId";
const skip = 1;
const take = 1;
client.features.listApplicationVersionPatternFeatures(appId, versionId, skip, take).then((result) => {
console.log("The result is:");
console.log(result);
})
.catch((err) => {
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "LUISAuthoringClient Library with typescript type definitions for node.js and browser.",
"version": "3.0.1",
"dependencies": {
"@azure/ms-rest-js": "^2.0.3",
"tslib": "^1.10.0"
"@azure/ms-rest-js": "^1.8.1",
"tslib": "^1.9.3"
},
"keywords": [
"node",
Expand All @@ -19,20 +19,13 @@
"module": "./esm/lUISAuthoringClient.js",
"types": "./esm/lUISAuthoringClient.d.ts",
"devDependencies": {
"@types/chai": "^4.2.0",
"@types/mocha": "^5.2.7",
"mocha": "^6.1.4",
"nock": "^10.0.0",
"typescript": "^3.1.1",
"rollup": "^0.66.2",
"@azure/ms-rest-azure-js": "^2.0.1",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"ts-node": "^8.3.0",
"typescript": "^3.1.1",
"uglify-js": "^3.4.9",
"ts-mocha": "^6.0.0"
"uglify-js": "^3.4.9"
},
"homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-luis-authoring",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-luis-authoring",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand All @@ -57,8 +50,7 @@
"scripts": {
"build": "tsc && rollup -c rollup.config.js && npm run minify",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-luis-authoring.js.map'\" -o ./dist/cognitiveservices-luis-authoring.min.js ./dist/cognitiveservices-luis-authoring.js",
"prepack": "npm install && npm run build",
"test": "ts-mocha -p tsconfig.test.json test/**/*.test.ts --timeout 100000"
"prepack": "npm install && npm run build"
},
"sideEffects": false,
"autoPublish": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import sourcemaps from "rollup-plugin-sourcemaps";
*/
const config = {
input: "./esm/lUISAuthoringClient.js",
external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"],
external: [
"@azure/ms-rest-js",
"@azure/ms-rest-azure-js"
],
output: {
file: "./dist/cognitiveservices-luis-authoring.js",
format: "umd",
Expand All @@ -19,14 +22,16 @@ const config = {
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* 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.
*/`
},
plugins: [nodeResolve({ module: true }), sourcemaps()]
plugins: [
nodeResolve({ module: true }),
sourcemaps()
]
};

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
* 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/mappers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

import * as msRest from "@azure/ms-rest-js";
Expand All @@ -23,11 +24,7 @@ export class LUISAuthoringClientContext extends msRest.ServiceClient {
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param [options] The parameter options
*/
constructor(
credentials: msRest.ServiceClientCredentials,
endpoint: string,
options?: msRest.ServiceClientOptions
) {
constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) {
if (endpoint == undefined) {
throw new Error("'endpoint' cannot be null.");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* 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.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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 {
AzureAccountInfoObject,
ErrorResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* 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 {
ErrorResponse,
FeatureInfoObject,
Expand Down
Loading

0 comments on commit 942dfa2

Please sign in to comment.