Skip to content

Commit

Permalink
Generated from ae13f3bcaab268fc0365a1e0452535827d2bda64 (#4500)
Browse files Browse the repository at this point in the history
Update specification/cognitiveservices/data-plane/InkRecognizer/preview/v1.0/InkRecognizer.json

Co-Authored-By: Nick Schonning <[email protected]>
  • Loading branch information
openapi-sdkautomation[bot] and nschonni authored Aug 5, 2019
1 parent e9d98bc commit b47b06d
Show file tree
Hide file tree
Showing 13 changed files with 1,848 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sdk/cognitiveservices/cognitiveservices-inkrecognizer/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
194 changes: 194 additions & 0 deletions sdk/cognitiveservices/cognitiveservices-inkrecognizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
## An isomorphic javascript sdk for - InkRecognizerClient

This package contains an isomorphic SDK for InkRecognizerClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install

```bash
npm install @azure/cognitiveservices-inkrecognizer
```

### How to use

#### nodejs - Authentication, client creation and recognize inkRecognizer as an example written in TypeScript.

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

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

##### Sample code

```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { InkRecognizerClient, InkRecognizerModels, InkRecognizerMappers } from "@azure/cognitiveservices-inkrecognizer";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new InkRecognizerClient(creds, subscriptionId);
const body: InkRecognizerModels.AnalysisRequest = {
applicationType: "drawing",
inputDeviceKind: "digitizer",
unit: "mm",
unitMultiple: 1.01,
language: "testlanguage",
inkPointValueAttributes: [{
name: "testname",
logicalMinimum: 1.01,
logicalMaximum: 1.01
}],
strokes: [{
id: 1,
language: "testlanguage",
points: [{
x: 1.01,
y: 1.01,
z: 1.01,
tipPressure: 1.01,
barrelPressure: 1.01,
timestamp: 1.01,
xTilt: 1.01,
yTilt: 1.01,
width: 1.01,
height: 1.01,
tipSwitch: true,
inverted: true,
barrelSwitch: true,
eraser: true,
secondaryTip: true
}],
drawingAttributes: {
width: 1.01,
color: {
r: 1.01,
g: 1.01,
b: 1.01,
a: 1.01
},
height: 1.01,
fitToCurve: true,
rasterOp: "noOperation",
ignorePressure: true,
tip: "ellipse"
},
kind: "inkDrawing"
}]
};
const xMsClientRequestId = "testxMsClientRequestId";
client.inkRecognizer.recognize(body, xMsClientRequestId).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and recognize inkRecognizer 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/cognitiveservices-inkrecognizer 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-inkrecognizer/dist/cognitiveservices-inkrecognizer.js"></script>
<script type="text/javascript">
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.CognitiveservicesInkrecognizer.InkRecognizerClient(res.creds, subscriptionId);
const body = {
applicationType: "drawing",
inputDeviceKind: "digitizer",
unit: "mm",
unitMultiple: 1.01,
language: "testlanguage",
inkPointValueAttributes: [{
name: "testname",
logicalMinimum: 1.01,
logicalMaximum: 1.01
}],
strokes: [{
id: 1,
language: "testlanguage",
points: [{
x: 1.01,
y: 1.01,
z: 1.01,
tipPressure: 1.01,
barrelPressure: 1.01,
timestamp: 1.01,
xTilt: 1.01,
yTilt: 1.01,
width: 1.01,
height: 1.01,
tipSwitch: true,
inverted: true,
barrelSwitch: true,
eraser: true,
secondaryTip: true
}],
drawingAttributes: {
width: 1.01,
color: {
r: 1.01,
g: 1.01,
b: 1.01,
a: 1.01
},
height: 1.01,
fitToCurve: true,
rasterOp: "noOperation",
ignorePressure: true,
tip: "ellipse"
},
kind: "inkDrawing"
}]
};
const xMsClientRequestId = "testxMsClientRequestId";
client.inkRecognizer.recognize(body, xMsClientRequestId).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/cognitiveservices/cognitiveservices-inkrecognizer/README.png)
57 changes: 57 additions & 0 deletions sdk/cognitiveservices/cognitiveservices-inkrecognizer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@azure/cognitiveservices-inkrecognizer",
"author": "Microsoft Corporation",
"description": "InkRecognizerClient Library with typescript type definitions for node.js and browser.",
"version": "1.0.0",
"dependencies": {
"@azure/ms-rest-js": "^2.0.3",
"tslib": "^1.10.0"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"license": "MIT",
"main": "./dist/cognitiveservices-inkrecognizer.js",
"module": "./esm/inkRecognizerClient.js",
"types": "./esm/inkRecognizerClient.d.ts",
"devDependencies": {
"typescript": "^3.1.1",
"rollup": "^0.66.2",
"rollup-plugin-node-resolve": "^3.4.0",
"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-inkrecognizer",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
},
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"dist/**/*.d.ts.map",
"esm/**/*.js",
"esm/**/*.js.map",
"esm/**/*.d.ts",
"esm/**/*.d.ts.map",
"src/**/*.ts",
"README.md",
"rollup.config.js",
"tsconfig.json"
],
"scripts": {
"build": "tsc && rollup -c rollup.config.js && npm run minify",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-inkrecognizer.js.map'\" -o ./dist/cognitiveservices-inkrecognizer.min.js ./dist/cognitiveservices-inkrecognizer.js",
"prepack": "npm install && npm run build"
},
"sideEffects": false,
"autoPublish": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import rollup from "rollup";
import nodeResolve from "rollup-plugin-node-resolve";
import sourcemaps from "rollup-plugin-sourcemaps";

/**
* @type {rollup.RollupFileOptions}
*/
const config = {
input: "./esm/inkRecognizerClient.js",
external: [
"@azure/ms-rest-js",
"@azure/ms-rest-azure-js"
],
output: {
file: "./dist/cognitiveservices-inkrecognizer.js",
format: "umd",
name: "Azure.CognitiveservicesInkrecognizer",
sourcemap: true,
globals: {
"@azure/ms-rest-js": "msRest",
"@azure/ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* 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.
*/`
},
plugins: [
nodeResolve({ module: true }),
sourcemaps()
]
};

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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/mappers";
import * as operations from "./operations";
import { InkRecognizerClientContext } from "./inkRecognizerClientContext";

class InkRecognizerClient extends InkRecognizerClientContext {
// Operation groups
inkRecognizer: operations.InkRecognizer;

/**
* Initializes a new instance of the InkRecognizerClient class.
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
* https://westus2.api.cognitive.microsoft.com).
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param [options] The parameter options
*/
constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) {
super(credentials, endpoint, options);
this.inkRecognizer = new operations.InkRecognizer(this);
}
}

// Operation Specifications

export {
InkRecognizerClient,
InkRecognizerClientContext,
Models as InkRecognizerModels,
Mappers as InkRecognizerMappers
};
export * from "./operations";
Loading

0 comments on commit b47b06d

Please sign in to comment.