Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3241 from Azure/restapi_auto_cognitiveservices/da…
Browse files Browse the repository at this point in the history
…ta-plane/Face

[AutoPR] cognitiveservices/data-plane/Face
  • Loading branch information
Dan Schulte authored Aug 29, 2018
2 parents 7577659 + ce5c1c2 commit 4ea71a7
Show file tree
Hide file tree
Showing 66 changed files with 14,097 additions and 4,275 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Microsoft
Copyright (c) 2018 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
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
43 changes: 43 additions & 0 deletions lib/services/cognitiveServicesFace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
uid: azure-cognitiveservices-face
summary: *content

---
# Microsoft Azure SDK for Node.js - FaceClient
This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

## Features


## How to Install

```bash
npm install azure-cognitiveservices-face
```

## How to use

### Authentication, client creation and list personGroupPerson as an example.

```javascript
const msRest = require("ms-rest");
const FaceClient = require("azure-cognitiveservices-face");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new FaceClient(creds, subscriptionId);
const personGroupId = "testpersonGroupId";
const start = "teststart";
const top = 1;
client.personGroupPerson.list(personGroupId, start, top).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});

## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
*/

import { ServiceClient, ServiceClientOptions, ServiceClientCredentials } from 'ms-rest';
import * as models from "./models";
import * as operations from "./operations";

declare class FaceAPIClient extends ServiceClient {
export default class FaceClient extends ServiceClient {
/**
* @class
* Initializes a new instance of the FaceAPIClient class.
* Initializes a new instance of the FaceClient class.
* @constructor
*
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
*
* @param {azureRegions} azureRegion - Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'
* @param {string} endpoint - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
*
* @param {object} [options] - The parameter options
*
Expand All @@ -31,17 +32,20 @@ declare class FaceAPIClient extends ServiceClient {
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
*/
constructor(credentials: ServiceClientCredentials, azureRegion: string, options?: ServiceClientOptions);
constructor(credentials: ServiceClientCredentials, endpoint: string, options?: ServiceClientOptions);

credentials: ServiceClientCredentials;

azureRegion: string;
endpoint: string;

// Operation groups
face: operations.Face;
person: operations.Person;
personGroup: operations.PersonGroup;
faceList: operations.FaceList;
personGroupPerson: operations.PersonGroupPerson;
personGroupOperations: operations.PersonGroupOperations;
faceListOperations: operations.FaceListOperations;
largePersonGroupPerson: operations.LargePersonGroupPerson;
largePersonGroupOperations: operations.LargePersonGroupOperations;
largeFaceListOperations: operations.LargeFaceListOperations;
}

export = FaceAPIClient;
export { FaceClient, models as FaceModels };
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,50 @@ const models = require('./models');
const operations = require('./operations');


/** Class representing a FaceAPIClient. */
class FaceAPIClient extends ServiceClient {
/** Class representing a FaceClient. */
class FaceClient extends ServiceClient {
/**
* Create a FaceAPIClient.
* Create a FaceClient.
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
* @param {azureRegions} azureRegion - Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'
* @param {string} endpoint - Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
* @param {object} [options] - The parameter options
* @param {Array} [options.filters] - Filters to be added to the request pipeline
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*/
constructor(credentials, azureRegion, options) {
constructor(credentials, endpoint, options) {
if (credentials === null || credentials === undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (azureRegion === null || azureRegion === undefined) {
throw new Error('\'azureRegion\' cannot be null.');
if (endpoint === null || endpoint === undefined) {
throw new Error('\'endpoint\' cannot be null.');
}

if (!options) options = {};

super(credentials, options);

this.baseUri = 'https://{AzureRegion}.api.cognitive.microsoft.com/face/v1.0';
this.baseUri = '{Endpoint}/face/v1.0';
this.credentials = credentials;
this.azureRegion = azureRegion;
this.endpoint = endpoint;

let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
this.face = new operations.Face(this);
this.person = new operations.Person(this);
this.personGroup = new operations.PersonGroup(this);
this.faceList = new operations.FaceList(this);
this.personGroupPerson = new operations.PersonGroupPerson(this);
this.personGroupOperations = new operations.PersonGroupOperations(this);
this.faceListOperations = new operations.FaceListOperations(this);
this.largePersonGroupPerson = new operations.LargePersonGroupPerson(this);
this.largePersonGroupOperations = new operations.LargePersonGroupOperations(this);
this.largeFaceListOperations = new operations.LargeFaceListOperations(this);
this.models = models;
msRest.addSerializationMixin(this);
}

}

module.exports = FaceAPIClient;
module.exports = FaceClient;
module.exports['default'] = FaceClient;
module.exports.FaceClient = FaceClient;
module.exports.FaceModels = models;
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

const models = require('./index');

/**
* Error information returned by the API
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,42 @@
* Accessory item and corresponding confidence level.
*
*/
class AccessoryItem {
class Accessory {
/**
* Create a AccessoryItem.
* @member {string} [type] Description of an accessory
* @member {number} [confidence]
* Create a Accessory.
* @member {string} [type] Type of an accessory. Possible values include:
* 'headWear', 'glasses', 'mask'
* @member {number} [confidence] Confidence level of an accessory
*/
constructor() {
}

/**
* Defines the metadata of AccessoryItem
* Defines the metadata of Accessory
*
* @returns {object} metadata of AccessoryItem
* @returns {object} metadata of Accessory
*
*/
mapper() {
return {
required: false,
serializedName: 'AccessoryItem',
serializedName: 'Accessory',
type: {
name: 'Composite',
className: 'AccessoryItem',
className: 'Accessory',
modelProperties: {
type: {
required: false,
nullable: false,
serializedName: 'type',
type: {
name: 'String'
name: 'Enum',
allowedValues: [ 'headWear', 'glasses', 'mask' ]
}
},
confidence: {
required: false,
nullable: false,
serializedName: 'confidence',
type: {
name: 'Number'
Expand All @@ -57,4 +61,4 @@ class AccessoryItem {
}
}

module.exports = AccessoryItem;
module.exports = Accessory;
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* Properties describing any presence of blur within the image.
*
*/
class BlurProperties {
class Blur {
/**
* Create a BlurProperties.
* Create a Blur.
* @member {string} [blurLevel] An enum value indicating level of blurriness.
* Possible values include: 'Low', 'Medium', 'High'
* @member {number} [value] A number indicating level of blurriness ranging
Expand All @@ -26,21 +26,22 @@ class BlurProperties {
}

/**
* Defines the metadata of BlurProperties
* Defines the metadata of Blur
*
* @returns {object} metadata of BlurProperties
* @returns {object} metadata of Blur
*
*/
mapper() {
return {
required: false,
serializedName: 'BlurProperties',
serializedName: 'Blur',
type: {
name: 'Composite',
className: 'BlurProperties',
className: 'Blur',
modelProperties: {
blurLevel: {
required: false,
nullable: false,
serializedName: 'blurLevel',
type: {
name: 'Enum',
Expand All @@ -49,11 +50,8 @@ class BlurProperties {
},
value: {
required: false,
nullable: false,
serializedName: 'value',
constraints: {
InclusiveMaximum: 1,
InclusiveMinimum: 0
},
type: {
name: 'Number'
}
Expand All @@ -64,4 +62,4 @@ class BlurProperties {
}
}

module.exports = BlurProperties;
module.exports = Blur;
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
* Coordinates within an image
*
*/
class Position {
class Coordinate {
/**
* Create a Position.
* Create a Coordinate.
* @member {number} x The horizontal component, in pixels.
* @member {number} y The vertical component, in pixels.
*/
constructor() {
}

/**
* Defines the metadata of Position
* Defines the metadata of Coordinate
*
* @returns {object} metadata of Position
* @returns {object} metadata of Coordinate
*
*/
mapper() {
return {
required: false,
serializedName: 'Position',
serializedName: 'Coordinate',
type: {
name: 'Composite',
className: 'Position',
className: 'Coordinate',
modelProperties: {
x: {
required: true,
Expand All @@ -57,4 +57,4 @@ class Position {
}
}

module.exports = Position;
module.exports = Coordinate;
Loading

0 comments on commit 4ea71a7

Please sign in to comment.