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

Commit

Permalink
Generate azure-cognitiveservices-face package (#5053)
Browse files Browse the repository at this point in the history
* Generate azure-cognitiveservices-face package

* Bump the version to 3.0.0
  • Loading branch information
kpajdzik committed Mar 29, 2019
1 parent ba41b34 commit 0a241bc
Show file tree
Hide file tree
Showing 31 changed files with 5,766 additions and 982 deletions.
41 changes: 41 additions & 0 deletions lib/services/cognitiveServicesFace/.scripts/postinstall.js
@@ -0,0 +1,41 @@
// 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.

const resetColor = "\x1b[0m";
const brightColor = "\x1b[1m";
const highlightColor = "\x1b[31m";

try {
const invisibleCharactersLength = resetColor.length + brightColor.length + highlightColor.length;

const firstLine = `Active development of this SDK has been moved to ${highlightColor}@azure/cognitiveservices-face${resetColor}${brightColor} package.`;
const secondLine = "This package is in maintenance mode and will be deprecated in July 2019.";
const thirdLine = "Visit https://aka.ms/azure-sdk-for-js-migration for more information.";

const framePadding = 4;
const adjustedFirstLineLength = firstLine.length - invisibleCharactersLength;
const width = Math.max(adjustedFirstLineLength, secondLine.length, thirdLine.length) + framePadding;
const getPaddingLength = (strLength) => width - strLength - framePadding;

const firstLinePaddingLength = getPaddingLength(adjustedFirstLineLength);
const secondLinePaddingLength = getPaddingLength(secondLine.length);
const thirdLinePaddingLength = getPaddingLength(thirdLine.length);
const line = "#".repeat(width);

const formatTextLine = (text, padding) => `#${" ".repeat(Math.floor(padding / 2))} ${text} ${" ".repeat(Math.ceil(padding / 2))}#`;

console.log(brightColor);
console.log("\n" + line);
console.log(formatTextLine(firstLine, firstLinePaddingLength));
console.log(formatTextLine(secondLine, secondLinePaddingLength));
console.log(formatTextLine(thirdLine, thirdLinePaddingLength));
console.log(line + "\n");
console.log(resetColor);
} catch (err) {
// ignore
}
2 changes: 1 addition & 1 deletion lib/services/cognitiveServicesFace/LICENSE.txt
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft
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
Expand Down
11 changes: 6 additions & 5 deletions lib/services/cognitiveServicesFace/README.md
Expand Up @@ -3,8 +3,10 @@ uid: azure-cognitiveservices-face
summary: *content

---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://www.npmjs.com/package/@azure/cognitiveservices-face) which works on Node.js and browsers.**
**See https://aka.ms/azure-sdk-for-js-migration to learn more.**
## 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**

Expand All @@ -19,7 +21,7 @@ npm install azure-cognitiveservices-face

### How to use

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

```javascript
const msRest = require("ms-rest");
Expand All @@ -31,17 +33,16 @@ 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)


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-node%2Flib%2Fservices%2FcognitiveServicesFace%2FREADME.png)
1 change: 1 addition & 0 deletions lib/services/cognitiveServicesFace/lib/faceClient.d.ts
Expand Up @@ -46,6 +46,7 @@ export default class FaceClient extends ServiceClient {
largePersonGroupPerson: operations.LargePersonGroupPerson;
largePersonGroupOperations: operations.LargePersonGroupOperations;
largeFaceListOperations: operations.LargeFaceListOperations;
snapshotOperations: operations.SnapshotOperations;
}

export { FaceClient, models as FaceModels };
1 change: 1 addition & 0 deletions lib/services/cognitiveServicesFace/lib/faceClient.js
Expand Up @@ -58,6 +58,7 @@ class FaceClient extends ServiceClient {
this.largePersonGroupPerson = new operations.LargePersonGroupPerson(this);
this.largePersonGroupOperations = new operations.LargePersonGroupOperations(this);
this.largeFaceListOperations = new operations.LargeFaceListOperations(this);
this.snapshotOperations = new operations.SnapshotOperations(this);
this.models = models;
msRest.addSerializationMixin(this);
}
Expand Down
@@ -0,0 +1,73 @@
/*
* 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.
*/

'use strict';

/**
* Request body for applying snapshot operation.
*
*/
class ApplySnapshotRequest {
/**
* Create a ApplySnapshotRequest.
* @property {string} objectId User specified target object id to be created
* from the snapshot.
* @property {string} [mode] Snapshot applying mode. Currently only CreateNew
* is supported, which means the apply operation will fail if target
* subscription already contains an object of same type and using the same
* objectId. Users can specify the "objectId" in request body to avoid such
* conflicts. Possible values include: 'CreateNew'. Default value:
* 'CreateNew' .
*/
constructor() {
}

/**
* Defines the metadata of ApplySnapshotRequest
*
* @returns {object} metadata of ApplySnapshotRequest
*
*/
mapper() {
return {
required: false,
serializedName: 'ApplySnapshotRequest',
type: {
name: 'Composite',
className: 'ApplySnapshotRequest',
modelProperties: {
objectId: {
required: true,
serializedName: 'objectId',
constraints: {
MaxLength: 64,
Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
}
},
mode: {
required: false,
nullable: false,
serializedName: 'mode',
defaultValue: 'CreateNew',
type: {
name: 'Enum',
allowedValues: [ 'CreateNew' ]
}
}
}
}
};
}
}

module.exports = ApplySnapshotRequest;
13 changes: 12 additions & 1 deletion lib/services/cognitiveServicesFace/lib/models/detectedFace.js
Expand Up @@ -18,6 +18,8 @@ class DetectedFace {
/**
* Create a DetectedFace.
* @property {uuid} [faceId]
* @property {string} [recognitionModel] Possible values include:
* 'recognition_01', 'recognition_02'. Default value: 'recognition_01' .
* @property {object} faceRectangle
* @property {number} [faceRectangle.width] The width of the rectangle, in
* pixels.
Expand Down Expand Up @@ -166,7 +168,7 @@ class DetectedFace {
* @property {object} [faceAttributes]
* @property {number} [faceAttributes.age] Age in years
* @property {string} [faceAttributes.gender] Possible gender of the face.
* Possible values include: 'male', 'female', 'genderless'
* Possible values include: 'male', 'female'
* @property {number} [faceAttributes.smile] Smile intensity, a number
* between [0,1]
* @property {object} [faceAttributes.facialHair] Properties describing
Expand Down Expand Up @@ -265,6 +267,15 @@ class DetectedFace {
name: 'String'
}
},
recognitionModel: {
required: false,
nullable: false,
serializedName: 'recognitionModel',
defaultValue: 'recognition_01',
type: {
name: 'String'
}
},
faceRectangle: {
required: true,
serializedName: 'faceRectangle',
Expand Down
Expand Up @@ -19,7 +19,7 @@ class FaceAttributes {
* Create a FaceAttributes.
* @property {number} [age] Age in years
* @property {string} [gender] Possible gender of the face. Possible values
* include: 'male', 'female', 'genderless'
* include: 'male', 'female'
* @property {number} [smile] Smile intensity, a number between [0,1]
* @property {object} [facialHair] Properties describing facial hair
* attributes.
Expand Down Expand Up @@ -117,7 +117,7 @@ class FaceAttributes {
serializedName: 'gender',
type: {
name: 'Enum',
allowedValues: [ 'male', 'female', 'genderless' ]
allowedValues: [ 'male', 'female' ]
}
},
smile: {
Expand Down
15 changes: 12 additions & 3 deletions lib/services/cognitiveServicesFace/lib/models/faceList.js
Expand Up @@ -15,9 +15,9 @@ const models = require('./index');
/**
* Face list object.
*
* @extends models['NameAndUserDataContract']
* @extends models['MetaDataContract']
*/
class FaceList extends models['NameAndUserDataContract'] {
class FaceList extends models['MetaDataContract'] {
/**
* Create a FaceList.
* @property {string} faceListId FaceListId of the target face list.
Expand Down Expand Up @@ -61,12 +61,21 @@ class FaceList extends models['NameAndUserDataContract'] {
name: 'String'
}
},
recognitionModel: {
required: false,
nullable: false,
serializedName: 'recognitionModel',
defaultValue: 'recognition_01',
type: {
name: 'String'
}
},
faceListId: {
required: true,
serializedName: 'faceListId',
constraints: {
MaxLength: 64,
Pattern: '^[a-z0-9-_]+$'
Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
Expand Down
Expand Up @@ -24,7 +24,7 @@ class FindSimilarRequest {
* candidate face list, created in Face List - Create a Face List. Face list
* contains a set of persistedFaceIds which are persisted and will never
* expire. Parameter faceListId, largeFaceListId and faceIds should not be
* provided at the same time
* provided at the same time.
* @property {string} [largeFaceListId] An existing user-specified unique
* candidate large face list, created in LargeFaceList - Create. Large face
* list contains a set of persistedFaceIds which are persisted and will never
Expand Down Expand Up @@ -70,7 +70,7 @@ class FindSimilarRequest {
serializedName: 'faceListId',
constraints: {
MaxLength: 64,
Pattern: '^[a-z0-9-_]+$'
Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
Expand All @@ -81,7 +81,7 @@ class FindSimilarRequest {
serializedName: 'largeFaceListId',
constraints: {
MaxLength: 64,
Pattern: '^[a-z0-9-_]+$'
Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
Expand Down
Expand Up @@ -73,7 +73,7 @@ class IdentifyRequest {
serializedName: 'personGroupId',
constraints: {
MaxLength: 64,
Pattern: '^[a-z0-9-_]+$'
Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
Expand All @@ -84,7 +84,7 @@ class IdentifyRequest {
serializedName: 'largePersonGroupId',
constraints: {
MaxLength: 64,
Pattern: '^[a-z0-9-_]+$'
Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
Expand Down

0 comments on commit 0a241bc

Please sign in to comment.