diff --git a/lib/services/cognitiveServicesFace/.scripts/postinstall.js b/lib/services/cognitiveServicesFace/.scripts/postinstall.js
new file mode 100644
index 0000000000..a705addbda
--- /dev/null
+++ b/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
+}
diff --git a/lib/services/cognitiveServicesFace/LICENSE.txt b/lib/services/cognitiveServicesFace/LICENSE.txt
index 5431ba98b9..8f3d856145 100644
--- a/lib/services/cognitiveServicesFace/LICENSE.txt
+++ b/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
diff --git a/lib/services/cognitiveServicesFace/README.md b/lib/services/cognitiveServicesFace/README.md
index bc40389831..5ad30ccd11 100644
--- a/lib/services/cognitiveServicesFace/README.md
+++ b/lib/services/cognitiveServicesFace/README.md
@@ -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**
@@ -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");
@@ -31,6 +33,7 @@ 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);
@@ -38,10 +41,8 @@ client.personGroupPerson.list(personGroupId, start, top).then((result) => {
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)
diff --git a/lib/services/cognitiveServicesFace/lib/faceClient.d.ts b/lib/services/cognitiveServicesFace/lib/faceClient.d.ts
index 6485fa976a..55da26bbcf 100644
--- a/lib/services/cognitiveServicesFace/lib/faceClient.d.ts
+++ b/lib/services/cognitiveServicesFace/lib/faceClient.d.ts
@@ -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 };
diff --git a/lib/services/cognitiveServicesFace/lib/faceClient.js b/lib/services/cognitiveServicesFace/lib/faceClient.js
index b8403a3e8a..37f792b756 100644
--- a/lib/services/cognitiveServicesFace/lib/faceClient.js
+++ b/lib/services/cognitiveServicesFace/lib/faceClient.js
@@ -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);
}
diff --git a/lib/services/cognitiveServicesFace/lib/models/applySnapshotRequest.js b/lib/services/cognitiveServicesFace/lib/models/applySnapshotRequest.js
new file mode 100644
index 0000000000..da01c5823a
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/models/applySnapshotRequest.js
@@ -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;
diff --git a/lib/services/cognitiveServicesFace/lib/models/detectedFace.js b/lib/services/cognitiveServicesFace/lib/models/detectedFace.js
index 896a81c062..9ee105862e 100644
--- a/lib/services/cognitiveServicesFace/lib/models/detectedFace.js
+++ b/lib/services/cognitiveServicesFace/lib/models/detectedFace.js
@@ -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.
@@ -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
@@ -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',
diff --git a/lib/services/cognitiveServicesFace/lib/models/faceAttributes.js b/lib/services/cognitiveServicesFace/lib/models/faceAttributes.js
index feb621698c..b63d6d1431 100644
--- a/lib/services/cognitiveServicesFace/lib/models/faceAttributes.js
+++ b/lib/services/cognitiveServicesFace/lib/models/faceAttributes.js
@@ -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.
@@ -117,7 +117,7 @@ class FaceAttributes {
serializedName: 'gender',
type: {
name: 'Enum',
- allowedValues: [ 'male', 'female', 'genderless' ]
+ allowedValues: [ 'male', 'female' ]
}
},
smile: {
diff --git a/lib/services/cognitiveServicesFace/lib/models/faceList.js b/lib/services/cognitiveServicesFace/lib/models/faceList.js
index 3bb30f696e..b3340ad8a9 100644
--- a/lib/services/cognitiveServicesFace/lib/models/faceList.js
+++ b/lib/services/cognitiveServicesFace/lib/models/faceList.js
@@ -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.
@@ -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'
diff --git a/lib/services/cognitiveServicesFace/lib/models/findSimilarRequest.js b/lib/services/cognitiveServicesFace/lib/models/findSimilarRequest.js
index d9dfa71b0f..ccdb66b252 100644
--- a/lib/services/cognitiveServicesFace/lib/models/findSimilarRequest.js
+++ b/lib/services/cognitiveServicesFace/lib/models/findSimilarRequest.js
@@ -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
@@ -70,7 +70,7 @@ class FindSimilarRequest {
serializedName: 'faceListId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
@@ -81,7 +81,7 @@ class FindSimilarRequest {
serializedName: 'largeFaceListId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
diff --git a/lib/services/cognitiveServicesFace/lib/models/identifyRequest.js b/lib/services/cognitiveServicesFace/lib/models/identifyRequest.js
index 03012c7dd8..637690d711 100644
--- a/lib/services/cognitiveServicesFace/lib/models/identifyRequest.js
+++ b/lib/services/cognitiveServicesFace/lib/models/identifyRequest.js
@@ -73,7 +73,7 @@ class IdentifyRequest {
serializedName: 'personGroupId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
@@ -84,7 +84,7 @@ class IdentifyRequest {
serializedName: 'largePersonGroupId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
diff --git a/lib/services/cognitiveServicesFace/lib/models/index.d.ts b/lib/services/cognitiveServicesFace/lib/models/index.d.ts
index 2e7cfaa3b1..4c9a55e051 100644
--- a/lib/services/cognitiveServicesFace/lib/models/index.d.ts
+++ b/lib/services/cognitiveServicesFace/lib/models/index.d.ts
@@ -1,24 +1,15 @@
/*
* 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.
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as moment from "moment";
-
/**
- * @class
- * Initializes a new instance of the ErrorModel class.
- * @constructor
* Error body.
- *
- * @property {string} [code]
- * @property {string} [message]
*/
export interface ErrorModel {
code?: string;
@@ -26,147 +17,51 @@ export interface ErrorModel {
}
/**
- * @class
- * Initializes a new instance of the APIError class.
- * @constructor
* Error information returned by the API
- *
- * @property {object} [error]
- * @property {string} [error.code]
- * @property {string} [error.message]
- */
+*/
export interface APIError {
error?: ErrorModel;
}
/**
- * @class
- * Initializes a new instance of the FaceRectangle class.
- * @constructor
* A rectangle within which a face can be found
- *
- * @property {number} width The width of the rectangle, in pixels.
- * @property {number} height The height of the rectangle, in pixels.
- * @property {number} left The distance from the left edge if the image to the
- * left edge of the rectangle, in pixels.
- * @property {number} top The distance from the top edge if the image to the
- * top edge of the rectangle, in pixels.
- */
+*/
export interface FaceRectangle {
+ /**
+ * The width of the rectangle, in pixels.
+ */
width: number;
+ /**
+ * The height of the rectangle, in pixels.
+ */
height: number;
+ /**
+ * The distance from the left edge if the image to the left edge of the rectangle, in pixels.
+ */
left: number;
+ /**
+ * The distance from the top edge if the image to the top edge of the rectangle, in pixels.
+ */
top: number;
}
/**
- * @class
- * Initializes a new instance of the Coordinate class.
- * @constructor
* Coordinates within an image
- *
- * @property {number} x The horizontal component, in pixels.
- * @property {number} y The vertical component, in pixels.
- */
+*/
export interface Coordinate {
+ /**
+ * The horizontal component, in pixels.
+ */
x: number;
+ /**
+ * The vertical component, in pixels.
+ */
y: number;
}
/**
- * @class
- * Initializes a new instance of the FaceLandmarks class.
- * @constructor
- * A collection of 27-point face landmarks pointing to the important positions
- * of face components.
- *
- * @property {object} [pupilLeft]
- * @property {number} [pupilLeft.x] The horizontal component, in pixels.
- * @property {number} [pupilLeft.y] The vertical component, in pixels.
- * @property {object} [pupilRight]
- * @property {number} [pupilRight.x] The horizontal component, in pixels.
- * @property {number} [pupilRight.y] The vertical component, in pixels.
- * @property {object} [noseTip]
- * @property {number} [noseTip.x] The horizontal component, in pixels.
- * @property {number} [noseTip.y] The vertical component, in pixels.
- * @property {object} [mouthLeft]
- * @property {number} [mouthLeft.x] The horizontal component, in pixels.
- * @property {number} [mouthLeft.y] The vertical component, in pixels.
- * @property {object} [mouthRight]
- * @property {number} [mouthRight.x] The horizontal component, in pixels.
- * @property {number} [mouthRight.y] The vertical component, in pixels.
- * @property {object} [eyebrowLeftOuter]
- * @property {number} [eyebrowLeftOuter.x] The horizontal component, in pixels.
- * @property {number} [eyebrowLeftOuter.y] The vertical component, in pixels.
- * @property {object} [eyebrowLeftInner]
- * @property {number} [eyebrowLeftInner.x] The horizontal component, in pixels.
- * @property {number} [eyebrowLeftInner.y] The vertical component, in pixels.
- * @property {object} [eyeLeftOuter]
- * @property {number} [eyeLeftOuter.x] The horizontal component, in pixels.
- * @property {number} [eyeLeftOuter.y] The vertical component, in pixels.
- * @property {object} [eyeLeftTop]
- * @property {number} [eyeLeftTop.x] The horizontal component, in pixels.
- * @property {number} [eyeLeftTop.y] The vertical component, in pixels.
- * @property {object} [eyeLeftBottom]
- * @property {number} [eyeLeftBottom.x] The horizontal component, in pixels.
- * @property {number} [eyeLeftBottom.y] The vertical component, in pixels.
- * @property {object} [eyeLeftInner]
- * @property {number} [eyeLeftInner.x] The horizontal component, in pixels.
- * @property {number} [eyeLeftInner.y] The vertical component, in pixels.
- * @property {object} [eyebrowRightInner]
- * @property {number} [eyebrowRightInner.x] The horizontal component, in
- * pixels.
- * @property {number} [eyebrowRightInner.y] The vertical component, in pixels.
- * @property {object} [eyebrowRightOuter]
- * @property {number} [eyebrowRightOuter.x] The horizontal component, in
- * pixels.
- * @property {number} [eyebrowRightOuter.y] The vertical component, in pixels.
- * @property {object} [eyeRightInner]
- * @property {number} [eyeRightInner.x] The horizontal component, in pixels.
- * @property {number} [eyeRightInner.y] The vertical component, in pixels.
- * @property {object} [eyeRightTop]
- * @property {number} [eyeRightTop.x] The horizontal component, in pixels.
- * @property {number} [eyeRightTop.y] The vertical component, in pixels.
- * @property {object} [eyeRightBottom]
- * @property {number} [eyeRightBottom.x] The horizontal component, in pixels.
- * @property {number} [eyeRightBottom.y] The vertical component, in pixels.
- * @property {object} [eyeRightOuter]
- * @property {number} [eyeRightOuter.x] The horizontal component, in pixels.
- * @property {number} [eyeRightOuter.y] The vertical component, in pixels.
- * @property {object} [noseRootLeft]
- * @property {number} [noseRootLeft.x] The horizontal component, in pixels.
- * @property {number} [noseRootLeft.y] The vertical component, in pixels.
- * @property {object} [noseRootRight]
- * @property {number} [noseRootRight.x] The horizontal component, in pixels.
- * @property {number} [noseRootRight.y] The vertical component, in pixels.
- * @property {object} [noseLeftAlarTop]
- * @property {number} [noseLeftAlarTop.x] The horizontal component, in pixels.
- * @property {number} [noseLeftAlarTop.y] The vertical component, in pixels.
- * @property {object} [noseRightAlarTop]
- * @property {number} [noseRightAlarTop.x] The horizontal component, in pixels.
- * @property {number} [noseRightAlarTop.y] The vertical component, in pixels.
- * @property {object} [noseLeftAlarOutTip]
- * @property {number} [noseLeftAlarOutTip.x] The horizontal component, in
- * pixels.
- * @property {number} [noseLeftAlarOutTip.y] The vertical component, in pixels.
- * @property {object} [noseRightAlarOutTip]
- * @property {number} [noseRightAlarOutTip.x] The horizontal component, in
- * pixels.
- * @property {number} [noseRightAlarOutTip.y] The vertical component, in
- * pixels.
- * @property {object} [upperLipTop]
- * @property {number} [upperLipTop.x] The horizontal component, in pixels.
- * @property {number} [upperLipTop.y] The vertical component, in pixels.
- * @property {object} [upperLipBottom]
- * @property {number} [upperLipBottom.x] The horizontal component, in pixels.
- * @property {number} [upperLipBottom.y] The vertical component, in pixels.
- * @property {object} [underLipTop]
- * @property {number} [underLipTop.x] The horizontal component, in pixels.
- * @property {number} [underLipTop.y] The vertical component, in pixels.
- * @property {object} [underLipBottom]
- * @property {number} [underLipBottom.x] The horizontal component, in pixels.
- * @property {number} [underLipBottom.y] The vertical component, in pixels.
- */
+ * A collection of 27-point face landmarks pointing to the important positions of face components.
+*/
export interface FaceLandmarks {
pupilLeft?: Coordinate;
pupilRight?: Coordinate;
@@ -198,15 +93,8 @@ export interface FaceLandmarks {
}
/**
- * @class
- * Initializes a new instance of the FacialHair class.
- * @constructor
* Properties describing facial hair attributes.
- *
- * @property {number} [moustache]
- * @property {number} [beard]
- * @property {number} [sideburns]
- */
+*/
export interface FacialHair {
moustache?: number;
beard?: number;
@@ -214,15 +102,8 @@ export interface FacialHair {
}
/**
- * @class
- * Initializes a new instance of the HeadPose class.
- * @constructor
* Properties indicating head pose of the face.
- *
- * @property {number} [roll]
- * @property {number} [yaw]
- * @property {number} [pitch]
- */
+*/
export interface HeadPose {
roll?: number;
yaw?: number;
@@ -230,21 +111,8 @@ export interface HeadPose {
}
/**
- * @class
- * Initializes a new instance of the Emotion class.
- * @constructor
- * Properties describing facial emotion in form of confidence ranging from 0 to
- * 1.
- *
- * @property {number} [anger]
- * @property {number} [contempt]
- * @property {number} [disgust]
- * @property {number} [fear]
- * @property {number} [happiness]
- * @property {number} [neutral]
- * @property {number} [sadness]
- * @property {number} [surprise]
- */
+ * Properties describing facial emotion in form of confidence ranging from 0 to 1.
+*/
export interface Emotion {
anger?: number;
contempt?: number;
@@ -257,837 +125,702 @@ export interface Emotion {
}
/**
- * @class
- * Initializes a new instance of the HairColor class.
- * @constructor
* Hair color and associated confidence
- *
- * @property {string} [color] Name of the hair color. Possible values include:
- * 'unknown', 'white', 'gray', 'blond', 'brown', 'red', 'black', 'other'
- * @property {number} [confidence] Confidence level of the color
- */
+*/
export interface HairColor {
+ /**
+ * Name of the hair color. Possible values include: 'unknown', 'white', 'gray', 'blond', 'brown',
+ * 'red', 'black', 'other'
+ */
color?: string;
+ /**
+ * Confidence level of the color
+ */
confidence?: number;
}
/**
- * @class
- * Initializes a new instance of the Hair class.
- * @constructor
* Properties describing hair attributes.
- *
- * @property {number} [bald] A number describing confidence level of whether
- * the person is bald.
- * @property {boolean} [invisible] A boolean value describing whether the hair
- * is visible in the image.
- * @property {array} [hairColor] An array of candidate colors and confidence
- * level in the presence of each.
- */
+*/
export interface Hair {
+ /**
+ * A number describing confidence level of whether the person is bald.
+ */
bald?: number;
+ /**
+ * A boolean value describing whether the hair is visible in the image.
+ */
invisible?: boolean;
+ /**
+ * An array of candidate colors and confidence level in the presence of each.
+ */
hairColor?: HairColor[];
}
/**
- * @class
- * Initializes a new instance of the Makeup class.
- * @constructor
* Properties describing present makeups on a given face.
- *
- * @property {boolean} [eyeMakeup] A boolean value describing whether eye
- * makeup is present on a face.
- * @property {boolean} [lipMakeup] A boolean value describing whether lip
- * makeup is present on a face.
- */
+*/
export interface Makeup {
+ /**
+ * A boolean value describing whether eye makeup is present on a face.
+ */
eyeMakeup?: boolean;
+ /**
+ * A boolean value describing whether lip makeup is present on a face.
+ */
lipMakeup?: boolean;
}
/**
- * @class
- * Initializes a new instance of the Occlusion class.
- * @constructor
* Properties describing occlusions on a given face.
- *
- * @property {boolean} [foreheadOccluded] A boolean value indicating whether
- * forehead is occluded.
- * @property {boolean} [eyeOccluded] A boolean value indicating whether eyes
- * are occluded.
- * @property {boolean} [mouthOccluded] A boolean value indicating whether the
- * mouth is occluded.
- */
+*/
export interface Occlusion {
+ /**
+ * A boolean value indicating whether forehead is occluded.
+ */
foreheadOccluded?: boolean;
+ /**
+ * A boolean value indicating whether eyes are occluded.
+ */
eyeOccluded?: boolean;
+ /**
+ * A boolean value indicating whether the mouth is occluded.
+ */
mouthOccluded?: boolean;
}
/**
- * @class
- * Initializes a new instance of the Accessory class.
- * @constructor
* Accessory item and corresponding confidence level.
- *
- * @property {string} [type] Type of an accessory. Possible values include:
- * 'headWear', 'glasses', 'mask'
- * @property {number} [confidence] Confidence level of an accessory
- */
+*/
export interface Accessory {
+ /**
+ * Type of an accessory. Possible values include: 'headWear', 'glasses', 'mask'
+ */
type?: string;
+ /**
+ * Confidence level of an accessory
+ */
confidence?: number;
}
/**
- * @class
- * Initializes a new instance of the Blur class.
- * @constructor
* Properties describing any presence of blur within the image.
- *
- * @property {string} [blurLevel] An enum value indicating level of blurriness.
- * Possible values include: 'Low', 'Medium', 'High'
- * @property {number} [value] A number indicating level of blurriness ranging
- * from 0 to 1.
- */
+*/
export interface Blur {
+ /**
+ * An enum value indicating level of blurriness. Possible values include: 'Low', 'Medium', 'High'
+ */
blurLevel?: string;
+ /**
+ * A number indicating level of blurriness ranging from 0 to 1.
+ */
value?: number;
}
/**
- * @class
- * Initializes a new instance of the Exposure class.
- * @constructor
* Properties describing exposure level of the image.
- *
- * @property {string} [exposureLevel] An enum value indicating level of
- * exposure. Possible values include: 'UnderExposure', 'GoodExposure',
- * 'OverExposure'
- * @property {number} [value] A number indicating level of exposure level
- * ranging from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75) is good
- * exposure. [0.75, 1] is over exposure.
- */
+*/
export interface Exposure {
+ /**
+ * An enum value indicating level of exposure. Possible values include: 'UnderExposure',
+ * 'GoodExposure', 'OverExposure'
+ */
exposureLevel?: string;
+ /**
+ * A number indicating level of exposure level ranging from 0 to 1. [0, 0.25) is under exposure.
+ * [0.25, 0.75) is good exposure. [0.75, 1] is over exposure.
+ */
value?: number;
}
/**
- * @class
- * Initializes a new instance of the Noise class.
- * @constructor
* Properties describing noise level of the image.
- *
- * @property {string} [noiseLevel] An enum value indicating level of noise.
- * Possible values include: 'Low', 'Medium', 'High'
- * @property {number} [value] A number indicating level of noise level ranging
- * from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75) is good exposure.
- * [0.75, 1] is over exposure. [0, 0.3) is low noise level. [0.3, 0.7) is
- * medium noise level. [0.7, 1] is high noise level.
- */
+*/
export interface Noise {
+ /**
+ * An enum value indicating level of noise. Possible values include: 'Low', 'Medium', 'High'
+ */
noiseLevel?: string;
+ /**
+ * A number indicating level of noise level ranging from 0 to 1. [0, 0.25) is under exposure.
+ * [0.25, 0.75) is good exposure. [0.75, 1] is over exposure. [0, 0.3) is low noise level. [0.3,
+ * 0.7) is medium noise level. [0.7, 1] is high noise level.
+ */
value?: number;
}
/**
- * @class
- * Initializes a new instance of the FaceAttributes class.
- * @constructor
* Face Attributes
- *
- * @property {number} [age] Age in years
- * @property {string} [gender] Possible gender of the face. Possible values
- * include: 'male', 'female', 'genderless'
- * @property {number} [smile] Smile intensity, a number between [0,1]
- * @property {object} [facialHair] Properties describing facial hair
- * attributes.
- * @property {number} [facialHair.moustache]
- * @property {number} [facialHair.beard]
- * @property {number} [facialHair.sideburns]
- * @property {string} [glasses] Glasses type if any of the face. Possible
- * values include: 'noGlasses', 'readingGlasses', 'sunglasses',
- * 'swimmingGoggles'
- * @property {object} [headPose] Properties indicating head pose of the face.
- * @property {number} [headPose.roll]
- * @property {number} [headPose.yaw]
- * @property {number} [headPose.pitch]
- * @property {object} [emotion] Properties describing facial emotion in form of
- * confidence ranging from 0 to 1.
- * @property {number} [emotion.anger]
- * @property {number} [emotion.contempt]
- * @property {number} [emotion.disgust]
- * @property {number} [emotion.fear]
- * @property {number} [emotion.happiness]
- * @property {number} [emotion.neutral]
- * @property {number} [emotion.sadness]
- * @property {number} [emotion.surprise]
- * @property {object} [hair] Properties describing hair attributes.
- * @property {number} [hair.bald] A number describing confidence level of
- * whether the person is bald.
- * @property {boolean} [hair.invisible] A boolean value describing whether the
- * hair is visible in the image.
- * @property {array} [hair.hairColor] An array of candidate colors and
- * confidence level in the presence of each.
- * @property {object} [makeup] Properties describing present makeups on a given
- * face.
- * @property {boolean} [makeup.eyeMakeup] A boolean value describing whether
- * eye makeup is present on a face.
- * @property {boolean} [makeup.lipMakeup] A boolean value describing whether
- * lip makeup is present on a face.
- * @property {object} [occlusion] Properties describing occlusions on a given
- * face.
- * @property {boolean} [occlusion.foreheadOccluded] A boolean value indicating
- * whether forehead is occluded.
- * @property {boolean} [occlusion.eyeOccluded] A boolean value indicating
- * whether eyes are occluded.
- * @property {boolean} [occlusion.mouthOccluded] A boolean value indicating
- * whether the mouth is occluded.
- * @property {array} [accessories] Properties describing any accessories on a
- * given face.
- * @property {object} [blur] Properties describing any presence of blur within
- * the image.
- * @property {string} [blur.blurLevel] An enum value indicating level of
- * blurriness. Possible values include: 'Low', 'Medium', 'High'
- * @property {number} [blur.value] A number indicating level of blurriness
- * ranging from 0 to 1.
- * @property {object} [exposure] Properties describing exposure level of the
- * image.
- * @property {string} [exposure.exposureLevel] An enum value indicating level
- * of exposure. Possible values include: 'UnderExposure', 'GoodExposure',
- * 'OverExposure'
- * @property {number} [exposure.value] A number indicating level of exposure
- * level ranging from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75) is good
- * exposure. [0.75, 1] is over exposure.
- * @property {object} [noise] Properties describing noise level of the image.
- * @property {string} [noise.noiseLevel] An enum value indicating level of
- * noise. Possible values include: 'Low', 'Medium', 'High'
- * @property {number} [noise.value] A number indicating level of noise level
- * ranging from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75) is good
- * exposure. [0.75, 1] is over exposure. [0, 0.3) is low noise level. [0.3,
- * 0.7) is medium noise level. [0.7, 1] is high noise level.
- */
+*/
export interface FaceAttributes {
+ /**
+ * Age in years
+ */
age?: number;
+ /**
+ * Possible gender of the face. Possible values include: 'male', 'female'
+ */
gender?: string;
+ /**
+ * Smile intensity, a number between [0,1]
+ */
smile?: number;
+ /**
+ * Properties describing facial hair attributes.
+ */
facialHair?: FacialHair;
+ /**
+ * Glasses type if any of the face. Possible values include: 'noGlasses', 'readingGlasses',
+ * 'sunglasses', 'swimmingGoggles'
+ */
glasses?: string;
+ /**
+ * Properties indicating head pose of the face.
+ */
headPose?: HeadPose;
+ /**
+ * Properties describing facial emotion in form of confidence ranging from 0 to 1.
+ */
emotion?: Emotion;
+ /**
+ * Properties describing hair attributes.
+ */
hair?: Hair;
+ /**
+ * Properties describing present makeups on a given face.
+ */
makeup?: Makeup;
+ /**
+ * Properties describing occlusions on a given face.
+ */
occlusion?: Occlusion;
+ /**
+ * Properties describing any accessories on a given face.
+ */
accessories?: Accessory[];
+ /**
+ * Properties describing any presence of blur within the image.
+ */
blur?: Blur;
+ /**
+ * Properties describing exposure level of the image.
+ */
exposure?: Exposure;
+ /**
+ * Properties describing noise level of the image.
+ */
noise?: Noise;
}
/**
- * @class
- * Initializes a new instance of the DetectedFace class.
- * @constructor
* Detected Face object.
- *
- * @property {uuid} [faceId]
- * @property {object} faceRectangle
- * @property {number} [faceRectangle.width] The width of the rectangle, in
- * pixels.
- * @property {number} [faceRectangle.height] The height of the rectangle, in
- * pixels.
- * @property {number} [faceRectangle.left] The distance from the left edge if
- * the image to the left edge of the rectangle, in pixels.
- * @property {number} [faceRectangle.top] The distance from the top edge if the
- * image to the top edge of the rectangle, in pixels.
- * @property {object} [faceLandmarks]
- * @property {object} [faceLandmarks.pupilLeft]
- * @property {number} [faceLandmarks.pupilLeft.x] The horizontal component, in
- * pixels.
- * @property {number} [faceLandmarks.pupilLeft.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.pupilRight]
- * @property {number} [faceLandmarks.pupilRight.x] The horizontal component, in
- * pixels.
- * @property {number} [faceLandmarks.pupilRight.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.noseTip]
- * @property {number} [faceLandmarks.noseTip.x] The horizontal component, in
- * pixels.
- * @property {number} [faceLandmarks.noseTip.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.mouthLeft]
- * @property {number} [faceLandmarks.mouthLeft.x] The horizontal component, in
- * pixels.
- * @property {number} [faceLandmarks.mouthLeft.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.mouthRight]
- * @property {number} [faceLandmarks.mouthRight.x] The horizontal component, in
- * pixels.
- * @property {number} [faceLandmarks.mouthRight.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.eyebrowLeftOuter]
- * @property {number} [faceLandmarks.eyebrowLeftOuter.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.eyebrowLeftOuter.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.eyebrowLeftInner]
- * @property {number} [faceLandmarks.eyebrowLeftInner.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.eyebrowLeftInner.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.eyeLeftOuter]
- * @property {number} [faceLandmarks.eyeLeftOuter.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.eyeLeftOuter.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.eyeLeftTop]
- * @property {number} [faceLandmarks.eyeLeftTop.x] The horizontal component, in
- * pixels.
- * @property {number} [faceLandmarks.eyeLeftTop.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.eyeLeftBottom]
- * @property {number} [faceLandmarks.eyeLeftBottom.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.eyeLeftBottom.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.eyeLeftInner]
- * @property {number} [faceLandmarks.eyeLeftInner.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.eyeLeftInner.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.eyebrowRightInner]
- * @property {number} [faceLandmarks.eyebrowRightInner.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.eyebrowRightInner.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.eyebrowRightOuter]
- * @property {number} [faceLandmarks.eyebrowRightOuter.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.eyebrowRightOuter.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.eyeRightInner]
- * @property {number} [faceLandmarks.eyeRightInner.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.eyeRightInner.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.eyeRightTop]
- * @property {number} [faceLandmarks.eyeRightTop.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.eyeRightTop.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.eyeRightBottom]
- * @property {number} [faceLandmarks.eyeRightBottom.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.eyeRightBottom.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.eyeRightOuter]
- * @property {number} [faceLandmarks.eyeRightOuter.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.eyeRightOuter.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.noseRootLeft]
- * @property {number} [faceLandmarks.noseRootLeft.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.noseRootLeft.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.noseRootRight]
- * @property {number} [faceLandmarks.noseRootRight.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.noseRootRight.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.noseLeftAlarTop]
- * @property {number} [faceLandmarks.noseLeftAlarTop.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.noseLeftAlarTop.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.noseRightAlarTop]
- * @property {number} [faceLandmarks.noseRightAlarTop.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.noseRightAlarTop.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.noseLeftAlarOutTip]
- * @property {number} [faceLandmarks.noseLeftAlarOutTip.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.noseLeftAlarOutTip.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.noseRightAlarOutTip]
- * @property {number} [faceLandmarks.noseRightAlarOutTip.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.noseRightAlarOutTip.y] The vertical
- * component, in pixels.
- * @property {object} [faceLandmarks.upperLipTop]
- * @property {number} [faceLandmarks.upperLipTop.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.upperLipTop.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.upperLipBottom]
- * @property {number} [faceLandmarks.upperLipBottom.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.upperLipBottom.y] The vertical component,
- * in pixels.
- * @property {object} [faceLandmarks.underLipTop]
- * @property {number} [faceLandmarks.underLipTop.x] The horizontal component,
- * in pixels.
- * @property {number} [faceLandmarks.underLipTop.y] The vertical component, in
- * pixels.
- * @property {object} [faceLandmarks.underLipBottom]
- * @property {number} [faceLandmarks.underLipBottom.x] The horizontal
- * component, in pixels.
- * @property {number} [faceLandmarks.underLipBottom.y] The vertical component,
- * in pixels.
- * @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'
- * @property {number} [faceAttributes.smile] Smile intensity, a number between
- * [0,1]
- * @property {object} [faceAttributes.facialHair] Properties describing facial
- * hair attributes.
- * @property {number} [faceAttributes.facialHair.moustache]
- * @property {number} [faceAttributes.facialHair.beard]
- * @property {number} [faceAttributes.facialHair.sideburns]
- * @property {string} [faceAttributes.glasses] Glasses type if any of the face.
- * Possible values include: 'noGlasses', 'readingGlasses', 'sunglasses',
- * 'swimmingGoggles'
- * @property {object} [faceAttributes.headPose] Properties indicating head pose
- * of the face.
- * @property {number} [faceAttributes.headPose.roll]
- * @property {number} [faceAttributes.headPose.yaw]
- * @property {number} [faceAttributes.headPose.pitch]
- * @property {object} [faceAttributes.emotion] Properties describing facial
- * emotion in form of confidence ranging from 0 to 1.
- * @property {number} [faceAttributes.emotion.anger]
- * @property {number} [faceAttributes.emotion.contempt]
- * @property {number} [faceAttributes.emotion.disgust]
- * @property {number} [faceAttributes.emotion.fear]
- * @property {number} [faceAttributes.emotion.happiness]
- * @property {number} [faceAttributes.emotion.neutral]
- * @property {number} [faceAttributes.emotion.sadness]
- * @property {number} [faceAttributes.emotion.surprise]
- * @property {object} [faceAttributes.hair] Properties describing hair
- * attributes.
- * @property {number} [faceAttributes.hair.bald] A number describing confidence
- * level of whether the person is bald.
- * @property {boolean} [faceAttributes.hair.invisible] A boolean value
- * describing whether the hair is visible in the image.
- * @property {array} [faceAttributes.hair.hairColor] An array of candidate
- * colors and confidence level in the presence of each.
- * @property {object} [faceAttributes.makeup] Properties describing present
- * makeups on a given face.
- * @property {boolean} [faceAttributes.makeup.eyeMakeup] A boolean value
- * describing whether eye makeup is present on a face.
- * @property {boolean} [faceAttributes.makeup.lipMakeup] A boolean value
- * describing whether lip makeup is present on a face.
- * @property {object} [faceAttributes.occlusion] Properties describing
- * occlusions on a given face.
- * @property {boolean} [faceAttributes.occlusion.foreheadOccluded] A boolean
- * value indicating whether forehead is occluded.
- * @property {boolean} [faceAttributes.occlusion.eyeOccluded] A boolean value
- * indicating whether eyes are occluded.
- * @property {boolean} [faceAttributes.occlusion.mouthOccluded] A boolean value
- * indicating whether the mouth is occluded.
- * @property {array} [faceAttributes.accessories] Properties describing any
- * accessories on a given face.
- * @property {object} [faceAttributes.blur] Properties describing any presence
- * of blur within the image.
- * @property {string} [faceAttributes.blur.blurLevel] An enum value indicating
- * level of blurriness. Possible values include: 'Low', 'Medium', 'High'
- * @property {number} [faceAttributes.blur.value] A number indicating level of
- * blurriness ranging from 0 to 1.
- * @property {object} [faceAttributes.exposure] Properties describing exposure
- * level of the image.
- * @property {string} [faceAttributes.exposure.exposureLevel] An enum value
- * indicating level of exposure. Possible values include: 'UnderExposure',
- * 'GoodExposure', 'OverExposure'
- * @property {number} [faceAttributes.exposure.value] A number indicating level
- * of exposure level ranging from 0 to 1. [0, 0.25) is under exposure. [0.25,
- * 0.75) is good exposure. [0.75, 1] is over exposure.
- * @property {object} [faceAttributes.noise] Properties describing noise level
- * of the image.
- * @property {string} [faceAttributes.noise.noiseLevel] An enum value
- * indicating level of noise. Possible values include: 'Low', 'Medium', 'High'
- * @property {number} [faceAttributes.noise.value] A number indicating level of
- * noise level ranging from 0 to 1. [0, 0.25) is under exposure. [0.25, 0.75)
- * is good exposure. [0.75, 1] is over exposure. [0, 0.3) is low noise level.
- * [0.3, 0.7) is medium noise level. [0.7, 1] is high noise level.
- */
+*/
export interface DetectedFace {
faceId?: string;
+ /**
+ * Possible values include: 'recognition_01', 'recognition_02'
+ */
+ recognitionModel?: string;
faceRectangle: FaceRectangle;
faceLandmarks?: FaceLandmarks;
faceAttributes?: FaceAttributes;
}
/**
- * @class
- * Initializes a new instance of the FindSimilarRequest class.
- * @constructor
* Request body for find similar operation.
- *
- * @property {uuid} faceId FaceId of the query face. User needs to call Face -
- * Detect first to get a valid faceId. Note that this faceId is not persisted
- * and will expire 24 hours after the detection call
- * @property {string} [faceListId] An existing user-specified unique 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。
- * @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
- * expire. Parameter faceListId, largeFaceListId and faceIds should not be
- * provided at the same time.
- * @property {array} [faceIds] An array of candidate faceIds. All of them are
- * created by Face - Detect and the faceIds will expire 24 hours after the
- * detection call. The number of faceIds is limited to 1000. Parameter
- * faceListId, largeFaceListId and faceIds should not be provided at the same
- * time.
- * @property {number} [maxNumOfCandidatesReturned] The number of top similar
- * faces returned. The valid range is [1, 1000]. Default value: 20 .
- * @property {string} [mode] Similar face searching mode. It can be
- * "matchPerson" or "matchFace". Possible values include: 'matchPerson',
- * 'matchFace'. Default value: 'matchPerson' .
- */
+*/
export interface FindSimilarRequest {
+ /**
+ * FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note
+ * that this faceId is not persisted and will expire 24 hours after the detection call
+ */
faceId: string;
+ /**
+ * An existing user-specified unique 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.
+ */
faceListId?: string;
+ /**
+ * 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
+ * expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same
+ * time.
+ */
largeFaceListId?: string;
+ /**
+ * An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will
+ * expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter
+ * faceListId, largeFaceListId and faceIds should not be provided at the same time.
+ */
faceIds?: string[];
+ /**
+ * The number of top similar faces returned. The valid range is [1, 1000].
+ */
maxNumOfCandidatesReturned?: number;
+ /**
+ * Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include:
+ * 'matchPerson', 'matchFace'
+ */
mode?: string;
}
/**
- * @class
- * Initializes a new instance of the SimilarFace class.
- * @constructor
* Response body for find similar face operation.
- *
- * @property {uuid} [faceId] FaceId of candidate face when find by faceIds.
- * faceId is created by Face - Detect and will expire 24 hours after the
- * detection call
- * @property {uuid} [persistedFaceId] PersistedFaceId of candidate face when
- * find by faceListId. persistedFaceId in face list is persisted and will not
- * expire. As showed in below response
- * @property {number} confidence Similarity confidence of the candidate face.
- * The higher confidence, the more similar. Range between [0,1].
- */
+*/
export interface SimilarFace {
+ /**
+ * FaceId of candidate face when find by faceIds. faceId is created by Face - Detect and will
+ * expire 24 hours after the detection call
+ */
faceId?: string;
+ /**
+ * PersistedFaceId of candidate face when find by faceListId. persistedFaceId in face list is
+ * persisted and will not expire. As showed in below response
+ */
persistedFaceId?: string;
+ /**
+ * Similarity confidence of the candidate face. The higher confidence, the more similar. Range
+ * between [0,1].
+ */
confidence: number;
}
/**
- * @class
- * Initializes a new instance of the GroupRequest class.
- * @constructor
* Request body for group request.
- *
- * @property {array} faceIds Array of candidate faceId created by Face -
- * Detect. The maximum is 1000 faces
- */
+*/
export interface GroupRequest {
+ /**
+ * Array of candidate faceId created by Face - Detect. The maximum is 1000 faces
+ */
faceIds: string[];
}
/**
- * @class
- * Initializes a new instance of the GroupResult class.
- * @constructor
* An array of face groups based on face similarity.
- *
- * @property {array} groups A partition of the original faces based on face
- * similarity. Groups are ranked by number of faces
- * @property {array} [messyGroup] Face ids array of faces that cannot find any
- * similar faces from original faces.
- */
+*/
export interface GroupResult {
+ /**
+ * A partition of the original faces based on face similarity. Groups are ranked by number of
+ * faces
+ */
groups: string[][];
+ /**
+ * Face ids array of faces that cannot find any similar faces from original faces.
+ */
messyGroup?: string[];
}
/**
- * @class
- * Initializes a new instance of the IdentifyRequest class.
- * @constructor
* Request body for identify face operation.
- *
- * @property {array} faceIds Array of query faces faceIds, created by the Face
- * - Detect. Each of the faces are identified independently. The valid number
- * of faceIds is between [1, 10].
- * @property {string} [personGroupId] PersonGroupId of the target person group,
- * created by PersonGroup - Create. Parameter personGroupId and
- * largePersonGroupId should not be provided at the same time.
- * @property {string} [largePersonGroupId] LargePersonGroupId of the target
- * large person group, created by LargePersonGroup - Create. Parameter
- * personGroupId and largePersonGroupId should not be provided at the same
- * time.
- * @property {number} [maxNumOfCandidatesReturned] The range of
- * maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default value:
- * 1 .
- * @property {number} [confidenceThreshold] Confidence threshold of
- * identification, used to judge whether one face belong to one person. The
- * range of confidenceThreshold is [0, 1] (default specified by algorithm).
- */
+*/
export interface IdentifyRequest {
+ /**
+ * Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified
+ * independently. The valid number of faceIds is between [1, 10].
+ */
faceIds: string[];
+ /**
+ * PersonGroupId of the target person group, created by PersonGroup - Create. Parameter
+ * personGroupId and largePersonGroupId should not be provided at the same time.
+ */
personGroupId?: string;
+ /**
+ * LargePersonGroupId of the target large person group, created by LargePersonGroup - Create.
+ * Parameter personGroupId and largePersonGroupId should not be provided at the same time.
+ */
largePersonGroupId?: string;
+ /**
+ * The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1).
+ */
maxNumOfCandidatesReturned?: number;
+ /**
+ * Confidence threshold of identification, used to judge whether one face belong to one person.
+ * The range of confidenceThreshold is [0, 1] (default specified by algorithm).
+ */
confidenceThreshold?: number;
}
/**
- * @class
- * Initializes a new instance of the IdentifyCandidate class.
- * @constructor
* All possible faces that may qualify.
- *
- * @property {uuid} personId Id of candidate
- * @property {number} confidence Confidence threshold of identification, used
- * to judge whether one face belong to one person. The range of
- * confidenceThreshold is [0, 1] (default specified by algorithm).
- */
+*/
export interface IdentifyCandidate {
+ /**
+ * Id of candidate
+ */
personId: string;
+ /**
+ * Confidence threshold of identification, used to judge whether one face belong to one person.
+ * The range of confidenceThreshold is [0, 1] (default specified by algorithm).
+ */
confidence: number;
}
/**
- * @class
- * Initializes a new instance of the IdentifyResult class.
- * @constructor
* Response body for identify face operation.
- *
- * @property {uuid} faceId FaceId of the query face
- * @property {array} candidates Identified person candidates for that face
- * (ranked by confidence). Array size should be no larger than input
- * maxNumOfCandidatesReturned. If no person is identified, will return an empty
- * array.
- */
+*/
export interface IdentifyResult {
+ /**
+ * FaceId of the query face
+ */
faceId: string;
+ /**
+ * Identified person candidates for that face (ranked by confidence). Array size should be no
+ * larger than input maxNumOfCandidatesReturned. If no person is identified, will return an empty
+ * array.
+ */
candidates: IdentifyCandidate[];
}
/**
- * @class
- * Initializes a new instance of the VerifyFaceToPersonRequest class.
- * @constructor
* Request body for face to person verification.
- *
- * @property {uuid} faceId FaceId of the face, comes from Face - Detect
- * @property {string} [personGroupId] Using existing personGroupId and personId
- * for fast loading a specified person. personGroupId is created in PersonGroup
- * - Create. Parameter personGroupId and largePersonGroupId should not be
- * provided at the same time.
- * @property {string} [largePersonGroupId] Using existing largePersonGroupId
- * and personId for fast loading a specified person. largePersonGroupId is
- * created in LargePersonGroup - Create. Parameter personGroupId and
- * largePersonGroupId should not be provided at the same time.
- * @property {uuid} personId Specify a certain person in a person group or a
- * large person group. personId is created in PersonGroup Person - Create or
- * LargePersonGroup Person - Create.
- */
+*/
export interface VerifyFaceToPersonRequest {
+ /**
+ * FaceId of the face, comes from Face - Detect
+ */
faceId: string;
+ /**
+ * Using existing personGroupId and personId for fast loading a specified person. personGroupId
+ * is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not
+ * be provided at the same time.
+ */
personGroupId?: string;
+ /**
+ * Using existing largePersonGroupId and personId for fast loading a specified person.
+ * largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and
+ * largePersonGroupId should not be provided at the same time.
+ */
largePersonGroupId?: string;
+ /**
+ * Specify a certain person in a person group or a large person group. personId is created in
+ * PersonGroup Person - Create or LargePersonGroup Person - Create.
+ */
personId: string;
}
/**
- * @class
- * Initializes a new instance of the VerifyFaceToFaceRequest class.
- * @constructor
* Request body for face to face verification.
- *
- * @property {uuid} faceId1 FaceId of the first face, comes from Face - Detect
- * @property {uuid} faceId2 FaceId of the second face, comes from Face - Detect
- */
+*/
export interface VerifyFaceToFaceRequest {
+ /**
+ * FaceId of the first face, comes from Face - Detect
+ */
faceId1: string;
+ /**
+ * FaceId of the second face, comes from Face - Detect
+ */
faceId2: string;
}
/**
- * @class
- * Initializes a new instance of the VerifyResult class.
- * @constructor
* Result of the verify operation.
- *
- * @property {boolean} isIdentical True if the two faces belong to the same
- * person or the face belongs to the person, otherwise false.
- * @property {number} confidence A number indicates the similarity confidence
- * of whether two faces belong to the same person, or whether the face belongs
- * to the person. By default, isIdentical is set to True if similarity
- * confidence is greater than or equal to 0.5. This is useful for advanced
- * users to override "isIdentical" and fine-tune the result on their own data.
- */
+*/
export interface VerifyResult {
+ /**
+ * True if the two faces belong to the same person or the face belongs to the person, otherwise
+ * false.
+ */
isIdentical: boolean;
+ /**
+ * A number indicates the similarity confidence of whether two faces belong to the same person,
+ * or whether the face belongs to the person. By default, isIdentical is set to True if
+ * similarity confidence is greater than or equal to 0.5. This is useful for advanced users to
+ * override "isIdentical" and fine-tune the result on their own data.
+ */
confidence: number;
}
/**
- * @class
- * Initializes a new instance of the PersistedFace class.
- * @constructor
* PersonFace object.
- *
- * @property {uuid} persistedFaceId The persistedFaceId of the target face,
- * which is persisted and will not expire. Different from faceId created by
- * Face - Detect and will expire in 24 hours after the detection call.
- * @property {string} [userData] User-provided data attached to the face. The
- * size limit is 1KB.
- */
+*/
export interface PersistedFace {
+ /**
+ * The persistedFaceId of the target face, which is persisted and will not expire. Different from
+ * faceId created by Face - Detect and will expire in 24 hours after the detection call.
+ */
persistedFaceId: string;
+ /**
+ * User-provided data attached to the face. The size limit is 1KB.
+ */
userData?: string;
}
/**
- * @class
- * Initializes a new instance of the NameAndUserDataContract class.
- * @constructor
* A combination of user defined name and user specified data for the person,
* largePersonGroup/personGroup, and largeFaceList/faceList.
- *
- * @property {string} [name] User defined name, maximum length is 128.
- * @property {string} [userData] User specified data. Length should not exceed
- * 16KB.
- */
+*/
export interface NameAndUserDataContract {
+ /**
+ * User defined name, maximum length is 128.
+ */
name?: string;
+ /**
+ * User specified data. Length should not exceed 16KB.
+ */
userData?: string;
}
/**
- * @class
- * Initializes a new instance of the FaceList class.
- * @constructor
+ * A combination of user defined name and user specified data and recognition model name for
+ * largePersonGroup/personGroup, and largeFaceList/faceList.
+*/
+export interface MetaDataContract extends NameAndUserDataContract {
+ /**
+ * Possible values include: 'recognition_01', 'recognition_02'
+ */
+ recognitionModel?: string;
+}
+
+/**
* Face list object.
- *
- * @property {string} faceListId FaceListId of the target face list.
- * @property {array} [persistedFaces] Persisted faces within the face list.
- */
-export interface FaceList extends NameAndUserDataContract {
+*/
+export interface FaceList extends MetaDataContract {
+ /**
+ * FaceListId of the target face list.
+ */
faceListId: string;
+ /**
+ * Persisted faces within the face list.
+ */
persistedFaces?: PersistedFace[];
}
/**
- * @class
- * Initializes a new instance of the PersonGroup class.
- * @constructor
* Person group object.
- *
- * @property {string} personGroupId PersonGroupId of the target person group.
- */
-export interface PersonGroup extends NameAndUserDataContract {
+*/
+export interface PersonGroup extends MetaDataContract {
+ /**
+ * PersonGroupId of the target person group.
+ */
personGroupId: string;
}
/**
- * @class
- * Initializes a new instance of the Person class.
- * @constructor
* Person object.
- *
- * @property {uuid} personId PersonId of the target face list.
- * @property {array} [persistedFaceIds] PersistedFaceIds of registered faces in
- * the person. These persistedFaceIds are returned from Person - Add a Person
- * Face, and will not expire.
- */
+*/
export interface Person extends NameAndUserDataContract {
+ /**
+ * PersonId of the target face list.
+ */
personId: string;
+ /**
+ * PersistedFaceIds of registered faces in the person. These persistedFaceIds are returned from
+ * Person - Add a Person Face, and will not expire.
+ */
persistedFaceIds?: string[];
}
/**
- * @class
- * Initializes a new instance of the LargeFaceList class.
- * @constructor
* Large face list object.
- *
- * @property {string} largeFaceListId LargeFaceListId of the target large face
- * list.
- */
-export interface LargeFaceList extends NameAndUserDataContract {
+*/
+export interface LargeFaceList extends MetaDataContract {
+ /**
+ * LargeFaceListId of the target large face list.
+ */
largeFaceListId: string;
}
/**
- * @class
- * Initializes a new instance of the LargePersonGroup class.
- * @constructor
* Large person group object.
- *
- * @property {string} largePersonGroupId LargePersonGroupId of the target large
- * person groups
- */
-export interface LargePersonGroup extends NameAndUserDataContract {
+*/
+export interface LargePersonGroup extends MetaDataContract {
+ /**
+ * LargePersonGroupId of the target large person groups
+ */
largePersonGroupId: string;
}
/**
- * @class
- * Initializes a new instance of the UpdateFaceRequest class.
- * @constructor
* Request to update face data.
- *
- * @property {string} [userData] User-provided data attached to the face. The
- * size limit is 1KB.
- */
+*/
export interface UpdateFaceRequest {
+ /**
+ * User-provided data attached to the face. The size limit is 1KB.
+ */
userData?: string;
}
/**
- * @class
- * Initializes a new instance of the TrainingStatus class.
- * @constructor
* Training status object.
- *
- * @property {string} status Training status: notstarted, running, succeeded,
- * failed. If the training process is waiting to perform, the status is
- * notstarted. If the training is ongoing, the status is running. Status
- * succeed means this person group or large person group is ready for Face -
- * Identify, or this large face list is ready for Face - Find Similar. Status
- * failed is often caused by no person or no persisted face exist in the person
- * group or large person group, or no persisted face exist in the large face
- * list. Possible values include: 'nonstarted', 'running', 'succeeded',
- * 'failed'
- * @property {date} created A combined UTC date and time string that describes
- * the created time of the person group, large person group or large face list.
- * @property {date} [lastAction] A combined UTC date and time string that
- * describes the last modify time of the person group, large person group or
- * large face list, could be null value when the group is not successfully
- * trained.
- * @property {date} [lastSuccessfulTraining] A combined UTC date and time
- * string that describes the last successful training time of the person group,
- * large person group or large face list.
- * @property {string} [message] Show failure message when training failed
- * (omitted when training succeed).
- */
+*/
export interface TrainingStatus {
+ /**
+ * Training status: notstarted, running, succeeded, failed. If the training process is waiting to
+ * perform, the status is notstarted. If the training is ongoing, the status is running. Status
+ * succeed means this person group or large person group is ready for Face - Identify, or this
+ * large face list is ready for Face - Find Similar. Status failed is often caused by no person
+ * or no persisted face exist in the person group or large person group, or no persisted face
+ * exist in the large face list. Possible values include: 'nonstarted', 'running', 'succeeded',
+ * 'failed'
+ */
status: string;
+ /**
+ * A combined UTC date and time string that describes the created time of the person group, large
+ * person group or large face list.
+ */
created: Date;
+ /**
+ * A combined UTC date and time string that describes the last modify time of the person group,
+ * large person group or large face list, could be null value when the group is not successfully
+ * trained.
+ */
lastAction?: Date;
+ /**
+ * A combined UTC date and time string that describes the last successful training time of the
+ * person group, large person group or large face list.
+ */
lastSuccessfulTraining?: Date;
+ /**
+ * Show failure message when training failed (omitted when training succeed).
+ */
message?: string;
}
/**
- * @class
- * Initializes a new instance of the ImageUrl class.
- * @constructor
- * @property {string} url Publicly reachable URL of an image
- */
+ * Request body for applying snapshot operation.
+*/
+export interface ApplySnapshotRequest {
+ /**
+ * User specified target object id to be created from the snapshot.
+ */
+ objectId: string;
+ /**
+ * 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'
+ */
+ mode?: string;
+}
+
+/**
+ * Snapshot object.
+*/
+export interface Snapshot {
+ /**
+ * Snapshot id.
+ */
+ id: string;
+ /**
+ * Azure Cognitive Service Face account id of the subscriber who created the snapshot by Snapshot
+ * - Take.
+ */
+ account: string;
+ /**
+ * Type of the source object in the snapshot, specified by the subscriber who created the
+ * snapshot when calling Snapshot - Take. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList', 'LargeFaceList',
+ * 'LargePersonGroup', 'PersonGroup'
+ */
+ type: string;
+ /**
+ * Array of the target Face subscription ids for the snapshot, specified by the user who created
+ * the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ */
+ applyScope: string[];
+ /**
+ * User specified data about the snapshot for any purpose. Length should not exceed 16KB.
+ */
+ userData?: string;
+ /**
+ * A combined UTC date and time string that describes the created time of the snapshot. E.g.
+ * 2018-12-25T11:41:02.2331413Z.
+ */
+ createdTime: Date;
+ /**
+ * A combined UTC date and time string that describes the last time when the snapshot was created
+ * or updated by Snapshot - Update. E.g. 2018-12-25T11:51:27.8705696Z.
+ */
+ lastUpdateTime: Date;
+}
+
+/**
+ * Request body for taking snapshot operation.
+*/
+export interface TakeSnapshotRequest {
+ /**
+ * User specified type for the source object to take snapshot from. Currently FaceList,
+ * PersonGroup, LargeFaceList and LargePersonGroup are supported. Possible values include:
+ * 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ */
+ type: string;
+ /**
+ * User specified source object id to take snapshot from.
+ */
+ objectId: string;
+ /**
+ * User specified array of target Face subscription ids for the snapshot. For each snapshot, only
+ * subscriptions included in the applyScope of Snapshot - Take can apply it.
+ */
+ applyScope: string[];
+ /**
+ * User specified data about the snapshot for any purpose. Length should not exceed 16KB.
+ */
+ userData?: string;
+}
+
+/**
+ * Request body for updating a snapshot, with a combination of user defined apply scope and user
+ * specified data.
+*/
+export interface UpdateSnapshotRequest {
+ /**
+ * Array of the target Face subscription ids for the snapshot, specified by the user who created
+ * the snapshot when calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ */
+ applyScope?: string[];
+ /**
+ * User specified data about the snapshot for any purpose. Length should not exceed 16KB.
+ */
+ userData?: string;
+}
+
+/**
+ * Operation status object. Operation refers to the asynchronous backend task including taking a
+ * snapshot and applying a snapshot.
+*/
+export interface OperationStatus {
+ /**
+ * Operation status: notstarted, running, succeeded, failed. If the operation is requested and
+ * waiting to perform, the status is notstarted. If the operation is ongoing in backend, the
+ * status is running. Status succeeded means the operation is completed successfully,
+ * specifically for snapshot taking operation, it illustrates the snapshot is well taken and
+ * ready to apply, and for snapshot applying operation, it presents the target object has
+ * finished creating by the snapshot and ready to be used. Status failed is often caused by
+ * editing the source object while taking the snapshot or editing the target object while
+ * applying the snapshot before completion, see the field "message" to check the failure reason.
+ * Possible values include: 'notstarted', 'running', 'succeeded', 'failed'
+ */
+ status: string;
+ /**
+ * A combined UTC date and time string that describes the time when the operation (take or apply
+ * a snapshot) is requested. E.g. 2018-12-25T11:41:02.2331413Z.
+ */
+ createdTime: Date;
+ /**
+ * A combined UTC date and time string that describes the last time the operation (take or apply
+ * a snapshot) is actively migrating data. The lastActionTime will keep increasing until the
+ * operation finishes. E.g. 2018-12-25T11:51:27.8705696Z.
+ */
+ lastActionTime?: Date;
+ /**
+ * When the operation succeeds successfully, for snapshot taking operation the snapshot id will
+ * be included in this field, and for snapshot applying operation, the path to get the target
+ * object will be returned in this field.
+ */
+ resourceLocation?: string;
+ /**
+ * Show failure message when operation fails (omitted when operation succeeds).
+ */
+ message?: string;
+}
+
export interface ImageUrl {
+ /**
+ * Publicly reachable URL of an image
+ */
url: string;
}
diff --git a/lib/services/cognitiveServicesFace/lib/models/index.js b/lib/services/cognitiveServicesFace/lib/models/index.js
index f73b1269ae..002cee70db 100644
--- a/lib/services/cognitiveServicesFace/lib/models/index.js
+++ b/lib/services/cognitiveServicesFace/lib/models/index.js
@@ -44,6 +44,7 @@ exports.VerifyFaceToFaceRequest = require('./verifyFaceToFaceRequest');
exports.VerifyResult = require('./verifyResult');
exports.PersistedFace = require('./persistedFace');
exports.NameAndUserDataContract = require('./nameAndUserDataContract');
+exports.MetaDataContract = require('./metaDataContract');
exports.FaceList = require('./faceList');
exports.PersonGroup = require('./personGroup');
exports.Person = require('./person');
@@ -51,4 +52,9 @@ exports.LargeFaceList = require('./largeFaceList');
exports.LargePersonGroup = require('./largePersonGroup');
exports.UpdateFaceRequest = require('./updateFaceRequest');
exports.TrainingStatus = require('./trainingStatus');
+exports.ApplySnapshotRequest = require('./applySnapshotRequest');
+exports.Snapshot = require('./snapshot');
+exports.TakeSnapshotRequest = require('./takeSnapshotRequest');
+exports.UpdateSnapshotRequest = require('./updateSnapshotRequest');
+exports.OperationStatus = require('./operationStatus');
exports.ImageUrl = require('./imageUrl');
diff --git a/lib/services/cognitiveServicesFace/lib/models/largeFaceList.js b/lib/services/cognitiveServicesFace/lib/models/largeFaceList.js
index 8daaacfdf5..5e18a3e380 100644
--- a/lib/services/cognitiveServicesFace/lib/models/largeFaceList.js
+++ b/lib/services/cognitiveServicesFace/lib/models/largeFaceList.js
@@ -15,9 +15,9 @@ const models = require('./index');
/**
* Large face list object.
*
- * @extends models['NameAndUserDataContract']
+ * @extends models['MetaDataContract']
*/
-class LargeFaceList extends models['NameAndUserDataContract'] {
+class LargeFaceList extends models['MetaDataContract'] {
/**
* Create a LargeFaceList.
* @property {string} largeFaceListId LargeFaceListId of the target large
@@ -61,12 +61,21 @@ class LargeFaceList extends models['NameAndUserDataContract'] {
name: 'String'
}
},
+ recognitionModel: {
+ required: false,
+ nullable: false,
+ serializedName: 'recognitionModel',
+ defaultValue: 'recognition_01',
+ type: {
+ name: 'String'
+ }
+ },
largeFaceListId: {
required: true,
serializedName: 'largeFaceListId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
diff --git a/lib/services/cognitiveServicesFace/lib/models/largePersonGroup.js b/lib/services/cognitiveServicesFace/lib/models/largePersonGroup.js
index fb03f2fef2..69296f2b83 100644
--- a/lib/services/cognitiveServicesFace/lib/models/largePersonGroup.js
+++ b/lib/services/cognitiveServicesFace/lib/models/largePersonGroup.js
@@ -15,9 +15,9 @@ const models = require('./index');
/**
* Large person group object.
*
- * @extends models['NameAndUserDataContract']
+ * @extends models['MetaDataContract']
*/
-class LargePersonGroup extends models['NameAndUserDataContract'] {
+class LargePersonGroup extends models['MetaDataContract'] {
/**
* Create a LargePersonGroup.
* @property {string} largePersonGroupId LargePersonGroupId of the target
@@ -61,12 +61,21 @@ class LargePersonGroup extends models['NameAndUserDataContract'] {
name: 'String'
}
},
+ recognitionModel: {
+ required: false,
+ nullable: false,
+ serializedName: 'recognitionModel',
+ defaultValue: 'recognition_01',
+ type: {
+ name: 'String'
+ }
+ },
largePersonGroupId: {
required: true,
serializedName: 'largePersonGroupId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
diff --git a/lib/services/cognitiveServicesFace/lib/models/metaDataContract.js b/lib/services/cognitiveServicesFace/lib/models/metaDataContract.js
new file mode 100644
index 0000000000..d70178973e
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/models/metaDataContract.js
@@ -0,0 +1,80 @@
+/*
+ * 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';
+
+const models = require('./index');
+
+/**
+ * A combination of user defined name and user specified data and recognition
+ * model name for largePersonGroup/personGroup, and largeFaceList/faceList.
+ *
+ * @extends models['NameAndUserDataContract']
+ */
+class MetaDataContract extends models['NameAndUserDataContract'] {
+ /**
+ * Create a MetaDataContract.
+ * @property {string} [recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' .
+ */
+ constructor() {
+ super();
+ }
+
+ /**
+ * Defines the metadata of MetaDataContract
+ *
+ * @returns {object} metadata of MetaDataContract
+ *
+ */
+ mapper() {
+ return {
+ required: false,
+ serializedName: 'MetaDataContract',
+ type: {
+ name: 'Composite',
+ className: 'MetaDataContract',
+ modelProperties: {
+ name: {
+ required: false,
+ serializedName: 'name',
+ constraints: {
+ MaxLength: 128
+ },
+ type: {
+ name: 'String'
+ }
+ },
+ userData: {
+ required: false,
+ serializedName: 'userData',
+ constraints: {
+ MaxLength: 16384
+ },
+ type: {
+ name: 'String'
+ }
+ },
+ recognitionModel: {
+ required: false,
+ nullable: false,
+ serializedName: 'recognitionModel',
+ defaultValue: 'recognition_01',
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ }
+ };
+ }
+}
+
+module.exports = MetaDataContract;
diff --git a/lib/services/cognitiveServicesFace/lib/models/operationStatus.js b/lib/services/cognitiveServicesFace/lib/models/operationStatus.js
new file mode 100644
index 0000000000..a811558b74
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/models/operationStatus.js
@@ -0,0 +1,106 @@
+/*
+ * 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';
+
+/**
+ * Operation status object. Operation refers to the asynchronous backend task
+ * including taking a snapshot and applying a snapshot.
+ *
+ */
+class OperationStatus {
+ /**
+ * Create a OperationStatus.
+ * @property {string} status Operation status: notstarted, running,
+ * succeeded, failed. If the operation is requested and waiting to perform,
+ * the status is notstarted. If the operation is ongoing in backend, the
+ * status is running. Status succeeded means the operation is completed
+ * successfully, specifically for snapshot taking operation, it illustrates
+ * the snapshot is well taken and ready to apply, and for snapshot applying
+ * operation, it presents the target object has finished creating by the
+ * snapshot and ready to be used. Status failed is often caused by editing
+ * the source object while taking the snapshot or editing the target object
+ * while applying the snapshot before completion, see the field "message" to
+ * check the failure reason. Possible values include: 'notstarted',
+ * 'running', 'succeeded', 'failed'
+ * @property {date} createdTime A combined UTC date and time string that
+ * describes the time when the operation (take or apply a snapshot) is
+ * requested. E.g. 2018-12-25T11:41:02.2331413Z.
+ * @property {date} [lastActionTime] A combined UTC date and time string that
+ * describes the last time the operation (take or apply a snapshot) is
+ * actively migrating data. The lastActionTime will keep increasing until the
+ * operation finishes. E.g. 2018-12-25T11:51:27.8705696Z.
+ * @property {string} [resourceLocation] When the operation succeeds
+ * successfully, for snapshot taking operation the snapshot id will be
+ * included in this field, and for snapshot applying operation, the path to
+ * get the target object will be returned in this field.
+ * @property {string} [message] Show failure message when operation fails
+ * (omitted when operation succeeds).
+ */
+ constructor() {
+ }
+
+ /**
+ * Defines the metadata of OperationStatus
+ *
+ * @returns {object} metadata of OperationStatus
+ *
+ */
+ mapper() {
+ return {
+ required: false,
+ serializedName: 'OperationStatus',
+ type: {
+ name: 'Composite',
+ className: 'OperationStatus',
+ modelProperties: {
+ status: {
+ required: true,
+ serializedName: 'status',
+ type: {
+ name: 'Enum',
+ allowedValues: [ 'notstarted', 'running', 'succeeded', 'failed' ]
+ }
+ },
+ createdTime: {
+ required: true,
+ serializedName: 'createdTime',
+ type: {
+ name: 'DateTime'
+ }
+ },
+ lastActionTime: {
+ required: false,
+ serializedName: 'lastActionTime',
+ type: {
+ name: 'DateTime'
+ }
+ },
+ resourceLocation: {
+ required: false,
+ serializedName: 'resourceLocation',
+ type: {
+ name: 'String'
+ }
+ },
+ message: {
+ required: false,
+ serializedName: 'message',
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ }
+ };
+ }
+}
+
+module.exports = OperationStatus;
diff --git a/lib/services/cognitiveServicesFace/lib/models/personGroup.js b/lib/services/cognitiveServicesFace/lib/models/personGroup.js
index 8a29bb25d3..a48b9878f9 100644
--- a/lib/services/cognitiveServicesFace/lib/models/personGroup.js
+++ b/lib/services/cognitiveServicesFace/lib/models/personGroup.js
@@ -15,9 +15,9 @@ const models = require('./index');
/**
* Person group object.
*
- * @extends models['NameAndUserDataContract']
+ * @extends models['MetaDataContract']
*/
-class PersonGroup extends models['NameAndUserDataContract'] {
+class PersonGroup extends models['MetaDataContract'] {
/**
* Create a PersonGroup.
* @property {string} personGroupId PersonGroupId of the target person group.
@@ -60,12 +60,21 @@ class PersonGroup extends models['NameAndUserDataContract'] {
name: 'String'
}
},
+ recognitionModel: {
+ required: false,
+ nullable: false,
+ serializedName: 'recognitionModel',
+ defaultValue: 'recognition_01',
+ type: {
+ name: 'String'
+ }
+ },
personGroupId: {
required: true,
serializedName: 'personGroupId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
diff --git a/lib/services/cognitiveServicesFace/lib/models/snapshot.js b/lib/services/cognitiveServicesFace/lib/models/snapshot.js
new file mode 100644
index 0000000000..e89c5249ee
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/models/snapshot.js
@@ -0,0 +1,124 @@
+/*
+ * 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';
+
+/**
+ * Snapshot object.
+ *
+ */
+class Snapshot {
+ /**
+ * Create a Snapshot.
+ * @property {uuid} id Snapshot id.
+ * @property {string} account Azure Cognitive Service Face account id of the
+ * subscriber who created the snapshot by Snapshot - Take.
+ * @property {string} type Type of the source object in the snapshot,
+ * specified by the subscriber who created the snapshot when calling Snapshot
+ * - Take. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ * @property {array} applyScope Array of the target Face subscription ids for
+ * the snapshot, specified by the user who created the snapshot when calling
+ * Snapshot - Take. For each snapshot, only subscriptions included in the
+ * applyScope of Snapshot - Take can apply it.
+ * @property {string} [userData] User specified data about the snapshot for
+ * any purpose. Length should not exceed 16KB.
+ * @property {date} createdTime A combined UTC date and time string that
+ * describes the created time of the snapshot. E.g.
+ * 2018-12-25T11:41:02.2331413Z.
+ * @property {date} lastUpdateTime A combined UTC date and time string that
+ * describes the last time when the snapshot was created or updated by
+ * Snapshot - Update. E.g. 2018-12-25T11:51:27.8705696Z.
+ */
+ constructor() {
+ }
+
+ /**
+ * Defines the metadata of Snapshot
+ *
+ * @returns {object} metadata of Snapshot
+ *
+ */
+ mapper() {
+ return {
+ required: false,
+ serializedName: 'Snapshot',
+ type: {
+ name: 'Composite',
+ className: 'Snapshot',
+ modelProperties: {
+ id: {
+ required: true,
+ serializedName: 'id',
+ type: {
+ name: 'String'
+ }
+ },
+ account: {
+ required: true,
+ serializedName: 'account',
+ type: {
+ name: 'String'
+ }
+ },
+ type: {
+ required: true,
+ serializedName: 'type',
+ type: {
+ name: 'Enum',
+ allowedValues: [ 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' ]
+ }
+ },
+ applyScope: {
+ required: true,
+ serializedName: 'applyScope',
+ type: {
+ name: 'Sequence',
+ element: {
+ required: false,
+ serializedName: 'UuidElementType',
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ },
+ userData: {
+ required: false,
+ serializedName: 'userData',
+ constraints: {
+ MaxLength: 16384
+ },
+ type: {
+ name: 'String'
+ }
+ },
+ createdTime: {
+ required: true,
+ serializedName: 'createdTime',
+ type: {
+ name: 'DateTime'
+ }
+ },
+ lastUpdateTime: {
+ required: true,
+ serializedName: 'lastUpdateTime',
+ type: {
+ name: 'DateTime'
+ }
+ }
+ }
+ }
+ };
+ }
+}
+
+module.exports = Snapshot;
diff --git a/lib/services/cognitiveServicesFace/lib/models/takeSnapshotRequest.js b/lib/services/cognitiveServicesFace/lib/models/takeSnapshotRequest.js
new file mode 100644
index 0000000000..d0de06dbe7
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/models/takeSnapshotRequest.js
@@ -0,0 +1,98 @@
+/*
+ * 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 taking snapshot operation.
+ *
+ */
+class TakeSnapshotRequest {
+ /**
+ * Create a TakeSnapshotRequest.
+ * @property {string} type User specified type for the source object to take
+ * snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ * @property {string} objectId User specified source object id to take
+ * snapshot from.
+ * @property {array} applyScope User specified array of target Face
+ * subscription ids for the snapshot. For each snapshot, only subscriptions
+ * included in the applyScope of Snapshot - Take can apply it.
+ * @property {string} [userData] User specified data about the snapshot for
+ * any purpose. Length should not exceed 16KB.
+ */
+ constructor() {
+ }
+
+ /**
+ * Defines the metadata of TakeSnapshotRequest
+ *
+ * @returns {object} metadata of TakeSnapshotRequest
+ *
+ */
+ mapper() {
+ return {
+ required: false,
+ serializedName: 'TakeSnapshotRequest',
+ type: {
+ name: 'Composite',
+ className: 'TakeSnapshotRequest',
+ modelProperties: {
+ type: {
+ required: true,
+ serializedName: 'type',
+ type: {
+ name: 'Enum',
+ allowedValues: [ 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' ]
+ }
+ },
+ objectId: {
+ required: true,
+ serializedName: 'objectId',
+ constraints: {
+ MaxLength: 64,
+ Pattern: /^[a-z0-9-_]+$/
+ },
+ type: {
+ name: 'String'
+ }
+ },
+ applyScope: {
+ required: true,
+ serializedName: 'applyScope',
+ type: {
+ name: 'Sequence',
+ element: {
+ required: false,
+ serializedName: 'UuidElementType',
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ },
+ userData: {
+ required: false,
+ serializedName: 'userData',
+ constraints: {
+ MaxLength: 16384
+ },
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ }
+ };
+ }
+}
+
+module.exports = TakeSnapshotRequest;
diff --git a/lib/services/cognitiveServicesFace/lib/models/updateSnapshotRequest.js b/lib/services/cognitiveServicesFace/lib/models/updateSnapshotRequest.js
new file mode 100644
index 0000000000..52ba76b0a8
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/models/updateSnapshotRequest.js
@@ -0,0 +1,75 @@
+/*
+ * 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 updating a snapshot, with a combination of user defined
+ * apply scope and user specified data.
+ *
+ */
+class UpdateSnapshotRequest {
+ /**
+ * Create a UpdateSnapshotRequest.
+ * @property {array} [applyScope] Array of the target Face subscription ids
+ * for the snapshot, specified by the user who created the snapshot when
+ * calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ * @property {string} [userData] User specified data about the snapshot for
+ * any purpose. Length should not exceed 16KB.
+ */
+ constructor() {
+ }
+
+ /**
+ * Defines the metadata of UpdateSnapshotRequest
+ *
+ * @returns {object} metadata of UpdateSnapshotRequest
+ *
+ */
+ mapper() {
+ return {
+ required: false,
+ serializedName: 'UpdateSnapshotRequest',
+ type: {
+ name: 'Composite',
+ className: 'UpdateSnapshotRequest',
+ modelProperties: {
+ applyScope: {
+ required: false,
+ serializedName: 'applyScope',
+ type: {
+ name: 'Sequence',
+ element: {
+ required: false,
+ serializedName: 'UuidElementType',
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ },
+ userData: {
+ required: false,
+ serializedName: 'userData',
+ constraints: {
+ MaxLength: 16384
+ },
+ type: {
+ name: 'String'
+ }
+ }
+ }
+ }
+ };
+ }
+}
+
+module.exports = UpdateSnapshotRequest;
diff --git a/lib/services/cognitiveServicesFace/lib/models/verifyFaceToPersonRequest.js b/lib/services/cognitiveServicesFace/lib/models/verifyFaceToPersonRequest.js
index 8893e5bcf0..250e68a9ec 100644
--- a/lib/services/cognitiveServicesFace/lib/models/verifyFaceToPersonRequest.js
+++ b/lib/services/cognitiveServicesFace/lib/models/verifyFaceToPersonRequest.js
@@ -59,7 +59,7 @@ class VerifyFaceToPersonRequest {
serializedName: 'personGroupId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
@@ -70,7 +70,7 @@ class VerifyFaceToPersonRequest {
serializedName: 'largePersonGroupId',
constraints: {
MaxLength: 64,
- Pattern: '^[a-z0-9-_]+$'
+ Pattern: /^[a-z0-9-_]+$/
},
type: {
name: 'String'
diff --git a/lib/services/cognitiveServicesFace/lib/operations/face.js b/lib/services/cognitiveServicesFace/lib/operations/face.js
index 12399e2440..c902dcf3c8 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/face.js
+++ b/lib/services/cognitiveServicesFace/lib/operations/face.js
@@ -14,8 +14,31 @@ const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
- * Given query face's faceId, find the similar-looking faces from a faceId
- * array, a face list or a large face list.
+ * Given query face's faceId, to search the similar-looking faces from a faceId
+ * array, a face list or a large face list. faceId array contains the faces
+ * created by [Face -
+ * Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
+ * which will expire 24 hours after creation. A "faceListId" is created by
+ * [FaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
+ * containing persistedFaceIds that will not expire. And a "largeFaceListId" is
+ * created by [LargeFaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * containing persistedFaceIds that will also not expire. Depending on the
+ * input the returned similar faces list contains faceIds or persistedFaceIds
+ * ranked by similarity.
+ *
Find similar has two working modes, "matchPerson" and "matchFace".
+ * "matchPerson" is the default mode that it tries to find faces of the same
+ * person as possible by using internal same-person thresholds. It is useful to
+ * find a known person's other photos. Note that an empty list will be returned
+ * if no faces pass the internal thresholds. "matchFace" mode ignores
+ * same-person thresholds and returns ranked similar faces anyway, even the
+ * similarity is low. It can be used in the cases like searching
+ * celebrity-looking faces.
+ *
The 'recognitionModel' associated with the query face's faceId should
+ * be the same as the 'recognitionModel' used by the target faceId array, face
+ * list or large face list.
+ *
*
* @param {uuid} faceId FaceId of the query face. User needs to call Face -
* Detect first to get a valid faceId. Note that this faceId is not persisted
@@ -27,7 +50,7 @@ const WebResource = msRest.WebResource;
* 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.
*
* @param {string} [options.largeFaceListId] An existing user-specified unique
* candidate large face list, created in LargeFaceList - Create. Large face
@@ -264,7 +287,22 @@ function _findSimilar(faceId, options, callback) {
}
/**
- * Divide candidate faces into groups based on face similarity.
+ * Divide candidate faces into groups based on face similarity.
+ * * The output is one or more disjointed face groups and a messyGroup. A face
+ * group contains faces that have similar looking, often of the same person.
+ * Face groups are ranked by group size, i.e. number of faces. Notice that
+ * faces belonging to a same person might be split into several groups in the
+ * result.
+ * * MessyGroup is a special face group containing faces that cannot find any
+ * similar counterpart face from original faces. The messyGroup will not appear
+ * in the result if all faces found their counterparts.
+ * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to
+ * try [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a)
+ * when you only have 2 candidate faces.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same.
+ *
*
* @param {array} faceIds Array of candidate faceId created by Face - Detect.
* The maximum is 1000 faces
@@ -419,6 +457,36 @@ function _group(faceIds, options, callback) {
/**
* 1-to-many identification to find the closest matches of the specific query
* person face from a person group or large person group.
+ *
For each face in the faceIds array, Face Identify will compute
+ * similarities between the query face and all the faces in the person group
+ * (given by personGroupId) or large person group (given by
+ * largePersonGroupId), and return candidate person(s) for that face ranked by
+ * similarity confidence. The person group/large person group should be trained
+ * to make it ready for identification. See more in [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * and [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4).
+ *
+ *
+ * Remarks:
+ * * The algorithm allows more than one face to be identified independently at
+ * the same request, but no more than 10 faces.
+ * * Each person in the person group/large person group could have more than
+ * one face, but no more than 248 faces.
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * Number of candidates returned is restricted by maxNumOfCandidatesReturned
+ * and confidenceThreshold. If no person is identified, the returned candidates
+ * will be an empty array.
+ * * Try [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237)
+ * when you need to find similar faces from a face list/large face list instead
+ * of a person group/large person group.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target person group or large
+ * person group.
+ *
*
* @param {array} faceIds Array of query faces faceIds, created by the Face -
* Detect. Each of the faces are identified independently. The valid number of
@@ -653,6 +721,17 @@ function _identify(faceIds, options, callback) {
/**
* Verify whether two faces belong to a same person or whether one face belongs
* to a person.
+ *
+ * Remarks:
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * For the scenarios that are sensitive to accuracy please make your own
+ * judgment.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target face, person group or
+ * large person group.
+ *
*
* @param {uuid} faceId1 FaceId of the first face, comes from Face - Detect
*
@@ -799,8 +878,45 @@ function _verifyFaceToFace(faceId1, faceId2, options, callback) {
}
/**
- * Detect human faces in an image and returns face locations, and optionally
- * with faceIds, landmarks, and attributes.
+ * Detect human faces in an image, return face rectangles, and optionally with
+ * faceIds, landmarks, and attributes.
+ * * Optional parameters including faceId, landmarks, and attributes.
+ * Attributes include age, gender, headPose, smile, facialHair, glasses,
+ * emotion, hair, makeup, occlusion, accessories, blur, exposure and noise.
+ * * The extracted face feature, instead of the actual image, will be stored on
+ * server. The faceId is an identifier of the face feature and will be used in
+ * [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
+ * [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
+ * and [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * It will expire 24 hours after the detection call.
+ * * Higher face image quality means better detection and recognition
+ * precision. Please consider high-quality faces: frontal, clear, and face size
+ * is 200x200 pixels (100 pixels between eyes) or bigger.
+ * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
+ * allowed image file size is from 1KB to 6MB.
+ * * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If need
+ * to detect very small but clear faces, please try to enlarge the input image.
+ * * Up to 64 faces can be returned for an image. Faces are ranked by face
+ * rectangle size from large to small.
+ * * Face detector prefer frontal and near-frontal faces. There are cases that
+ * faces may not be detected, e.g. exceptionally large face angles (head-pose)
+ * or being occluded, or wrong image orientation.
+ * * Attributes (age, gender, headPose, smile, facialHair, glasses, emotion,
+ * hair, makeup, occlusion, accessories, blur, exposure and noise) may not be
+ * perfectly accurate. HeadPose's pitch value is a reserved field and will
+ * always return 0.
+ * * Different 'recognitionModel' values are provided. If follow-up operations
+ * like Verify, Identify, Find Similar are needed, please specify the
+ * recognition model with 'recognitionModel' parameter. The default value for
+ * 'recognitionModel' is 'recognition_01', if latest model needed, please
+ * explicitly specify the model you need in this parameter. Once specified, the
+ * detected faceIds will be associated with the specified recognition model.
+ * More details, please refer to [How to specify a recognition
+ * model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
+ *
*
* @param {string} url Publicly reachable URL of an image
*
@@ -818,6 +934,17 @@ function _verifyFaceToFace(faceId1, faceId2, options, callback) {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -846,6 +973,8 @@ function _detectWithUrl(url, options, callback) {
let returnFaceId = (options && options.returnFaceId !== undefined) ? options.returnFaceId : true;
let returnFaceLandmarks = (options && options.returnFaceLandmarks !== undefined) ? options.returnFaceLandmarks : false;
let returnFaceAttributes = (options && options.returnFaceAttributes !== undefined) ? options.returnFaceAttributes : undefined;
+ let recognitionModel = (options && options.recognitionModel !== undefined) ? options.recognitionModel : 'recognition_01';
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -867,6 +996,12 @@ function _detectWithUrl(url, options, callback) {
}
}
}
+ if (recognitionModel !== null && recognitionModel !== undefined && typeof recognitionModel.valueOf() !== 'string') {
+ throw new Error('recognitionModel must be of type string.');
+ }
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
if (url === null || url === undefined || typeof url.valueOf() !== 'string') {
throw new Error('url cannot be null or undefined and it must be of type string.');
}
@@ -893,6 +1028,12 @@ function _detectWithUrl(url, options, callback) {
if (returnFaceAttributes !== null && returnFaceAttributes !== undefined) {
queryParameters.push('returnFaceAttributes=' + encodeURIComponent(returnFaceAttributes.join(',')));
}
+ if (recognitionModel !== null && recognitionModel !== undefined) {
+ queryParameters.push('recognitionModel=' + encodeURIComponent(recognitionModel));
+ }
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
@@ -1208,6 +1349,17 @@ function _verifyFaceToPerson(faceId, personId, options, callback) {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1236,6 +1388,8 @@ function _detectWithStream(image, options, callback) {
let returnFaceId = (options && options.returnFaceId !== undefined) ? options.returnFaceId : true;
let returnFaceLandmarks = (options && options.returnFaceLandmarks !== undefined) ? options.returnFaceLandmarks : false;
let returnFaceAttributes = (options && options.returnFaceAttributes !== undefined) ? options.returnFaceAttributes : undefined;
+ let recognitionModel = (options && options.recognitionModel !== undefined) ? options.recognitionModel : 'recognition_01';
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -1260,6 +1414,12 @@ function _detectWithStream(image, options, callback) {
if (image === null || image === undefined) {
throw new Error('image cannot be null or undefined and it must be of type object.');
}
+ if (recognitionModel !== null && recognitionModel !== undefined && typeof recognitionModel.valueOf() !== 'string') {
+ throw new Error('recognitionModel must be of type string.');
+ }
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -1278,6 +1438,12 @@ function _detectWithStream(image, options, callback) {
if (returnFaceAttributes !== null && returnFaceAttributes !== undefined) {
queryParameters.push('returnFaceAttributes=' + encodeURIComponent(returnFaceAttributes.join(',')));
}
+ if (recognitionModel !== null && recognitionModel !== undefined) {
+ queryParameters.push('recognitionModel=' + encodeURIComponent(recognitionModel));
+ }
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
@@ -1388,8 +1554,31 @@ class Face {
}
/**
- * Given query face's faceId, find the similar-looking faces from a faceId
- * array, a face list or a large face list.
+ * Given query face's faceId, to search the similar-looking faces from a faceId
+ * array, a face list or a large face list. faceId array contains the faces
+ * created by [Face -
+ * Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
+ * which will expire 24 hours after creation. A "faceListId" is created by
+ * [FaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
+ * containing persistedFaceIds that will not expire. And a "largeFaceListId" is
+ * created by [LargeFaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * containing persistedFaceIds that will also not expire. Depending on the
+ * input the returned similar faces list contains faceIds or persistedFaceIds
+ * ranked by similarity.
+ *
Find similar has two working modes, "matchPerson" and "matchFace".
+ * "matchPerson" is the default mode that it tries to find faces of the same
+ * person as possible by using internal same-person thresholds. It is useful to
+ * find a known person's other photos. Note that an empty list will be returned
+ * if no faces pass the internal thresholds. "matchFace" mode ignores
+ * same-person thresholds and returns ranked similar faces anyway, even the
+ * similarity is low. It can be used in the cases like searching
+ * celebrity-looking faces.
+ *
The 'recognitionModel' associated with the query face's faceId should
+ * be the same as the 'recognitionModel' used by the target faceId array, face
+ * list or large face list.
+ *
*
* @param {uuid} faceId FaceId of the query face. User needs to call Face -
* Detect first to get a valid faceId. Note that this faceId is not persisted
@@ -1401,7 +1590,7 @@ class Face {
* 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.
*
* @param {string} [options.largeFaceListId] An existing user-specified unique
* candidate large face list, created in LargeFaceList - Create. Large face
@@ -1446,8 +1635,31 @@ class Face {
}
/**
- * Given query face's faceId, find the similar-looking faces from a faceId
- * array, a face list or a large face list.
+ * Given query face's faceId, to search the similar-looking faces from a faceId
+ * array, a face list or a large face list. faceId array contains the faces
+ * created by [Face -
+ * Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
+ * which will expire 24 hours after creation. A "faceListId" is created by
+ * [FaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
+ * containing persistedFaceIds that will not expire. And a "largeFaceListId" is
+ * created by [LargeFaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * containing persistedFaceIds that will also not expire. Depending on the
+ * input the returned similar faces list contains faceIds or persistedFaceIds
+ * ranked by similarity.
+ *
Find similar has two working modes, "matchPerson" and "matchFace".
+ * "matchPerson" is the default mode that it tries to find faces of the same
+ * person as possible by using internal same-person thresholds. It is useful to
+ * find a known person's other photos. Note that an empty list will be returned
+ * if no faces pass the internal thresholds. "matchFace" mode ignores
+ * same-person thresholds and returns ranked similar faces anyway, even the
+ * similarity is low. It can be used in the cases like searching
+ * celebrity-looking faces.
+ *
The 'recognitionModel' associated with the query face's faceId should
+ * be the same as the 'recognitionModel' used by the target faceId array, face
+ * list or large face list.
+ *
*
* @param {uuid} faceId FaceId of the query face. User needs to call Face -
* Detect first to get a valid faceId. Note that this faceId is not persisted
@@ -1459,7 +1671,7 @@ class Face {
* 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.
*
* @param {string} [options.largeFaceListId] An existing user-specified unique
* candidate large face list, created in LargeFaceList - Create. Large face
@@ -1525,7 +1737,22 @@ class Face {
}
/**
- * Divide candidate faces into groups based on face similarity.
+ * Divide candidate faces into groups based on face similarity.
+ * * The output is one or more disjointed face groups and a messyGroup. A face
+ * group contains faces that have similar looking, often of the same person.
+ * Face groups are ranked by group size, i.e. number of faces. Notice that
+ * faces belonging to a same person might be split into several groups in the
+ * result.
+ * * MessyGroup is a special face group containing faces that cannot find any
+ * similar counterpart face from original faces. The messyGroup will not appear
+ * in the result if all faces found their counterparts.
+ * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to
+ * try [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a)
+ * when you only have 2 candidate faces.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same.
+ *
*
* @param {array} faceIds Array of candidate faceId created by Face - Detect.
* The maximum is 1000 faces
@@ -1556,7 +1783,22 @@ class Face {
}
/**
- * Divide candidate faces into groups based on face similarity.
+ * Divide candidate faces into groups based on face similarity.
+ * * The output is one or more disjointed face groups and a messyGroup. A face
+ * group contains faces that have similar looking, often of the same person.
+ * Face groups are ranked by group size, i.e. number of faces. Notice that
+ * faces belonging to a same person might be split into several groups in the
+ * result.
+ * * MessyGroup is a special face group containing faces that cannot find any
+ * similar counterpart face from original faces. The messyGroup will not appear
+ * in the result if all faces found their counterparts.
+ * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to
+ * try [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a)
+ * when you only have 2 candidate faces.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same.
+ *
*
* @param {array} faceIds Array of candidate faceId created by Face - Detect.
* The maximum is 1000 faces
@@ -1611,6 +1853,36 @@ class Face {
/**
* 1-to-many identification to find the closest matches of the specific query
* person face from a person group or large person group.
+ *
For each face in the faceIds array, Face Identify will compute
+ * similarities between the query face and all the faces in the person group
+ * (given by personGroupId) or large person group (given by
+ * largePersonGroupId), and return candidate person(s) for that face ranked by
+ * similarity confidence. The person group/large person group should be trained
+ * to make it ready for identification. See more in [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * and [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4).
+ *
+ *
+ * Remarks:
+ * * The algorithm allows more than one face to be identified independently at
+ * the same request, but no more than 10 faces.
+ * * Each person in the person group/large person group could have more than
+ * one face, but no more than 248 faces.
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * Number of candidates returned is restricted by maxNumOfCandidatesReturned
+ * and confidenceThreshold. If no person is identified, the returned candidates
+ * will be an empty array.
+ * * Try [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237)
+ * when you need to find similar faces from a face list/large face list instead
+ * of a person group/large person group.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target person group or large
+ * person group.
+ *
*
* @param {array} faceIds Array of query faces faceIds, created by the Face -
* Detect. Each of the faces are identified independently. The valid number of
@@ -1660,6 +1932,36 @@ class Face {
/**
* 1-to-many identification to find the closest matches of the specific query
* person face from a person group or large person group.
+ *
For each face in the faceIds array, Face Identify will compute
+ * similarities between the query face and all the faces in the person group
+ * (given by personGroupId) or large person group (given by
+ * largePersonGroupId), and return candidate person(s) for that face ranked by
+ * similarity confidence. The person group/large person group should be trained
+ * to make it ready for identification. See more in [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * and [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4).
+ *
+ *
+ * Remarks:
+ * * The algorithm allows more than one face to be identified independently at
+ * the same request, but no more than 10 faces.
+ * * Each person in the person group/large person group could have more than
+ * one face, but no more than 248 faces.
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * Number of candidates returned is restricted by maxNumOfCandidatesReturned
+ * and confidenceThreshold. If no person is identified, the returned candidates
+ * will be an empty array.
+ * * Try [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237)
+ * when you need to find similar faces from a face list/large face list instead
+ * of a person group/large person group.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target person group or large
+ * person group.
+ *
*
* @param {array} faceIds Array of query faces faceIds, created by the Face -
* Detect. Each of the faces are identified independently. The valid number of
@@ -1730,6 +2032,17 @@ class Face {
/**
* Verify whether two faces belong to a same person or whether one face belongs
* to a person.
+ *
+ * Remarks:
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * For the scenarios that are sensitive to accuracy please make your own
+ * judgment.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target face, person group or
+ * large person group.
+ *
*
* @param {uuid} faceId1 FaceId of the first face, comes from Face - Detect
*
@@ -1763,6 +2076,17 @@ class Face {
/**
* Verify whether two faces belong to a same person or whether one face belongs
* to a person.
+ *
+ * Remarks:
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * For the scenarios that are sensitive to accuracy please make your own
+ * judgment.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target face, person group or
+ * large person group.
+ *
*
* @param {uuid} faceId1 FaceId of the first face, comes from Face - Detect
*
@@ -1816,8 +2140,45 @@ class Face {
}
/**
- * Detect human faces in an image and returns face locations, and optionally
- * with faceIds, landmarks, and attributes.
+ * Detect human faces in an image, return face rectangles, and optionally with
+ * faceIds, landmarks, and attributes.
+ * * Optional parameters including faceId, landmarks, and attributes.
+ * Attributes include age, gender, headPose, smile, facialHair, glasses,
+ * emotion, hair, makeup, occlusion, accessories, blur, exposure and noise.
+ * * The extracted face feature, instead of the actual image, will be stored on
+ * server. The faceId is an identifier of the face feature and will be used in
+ * [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
+ * [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
+ * and [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * It will expire 24 hours after the detection call.
+ * * Higher face image quality means better detection and recognition
+ * precision. Please consider high-quality faces: frontal, clear, and face size
+ * is 200x200 pixels (100 pixels between eyes) or bigger.
+ * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
+ * allowed image file size is from 1KB to 6MB.
+ * * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If need
+ * to detect very small but clear faces, please try to enlarge the input image.
+ * * Up to 64 faces can be returned for an image. Faces are ranked by face
+ * rectangle size from large to small.
+ * * Face detector prefer frontal and near-frontal faces. There are cases that
+ * faces may not be detected, e.g. exceptionally large face angles (head-pose)
+ * or being occluded, or wrong image orientation.
+ * * Attributes (age, gender, headPose, smile, facialHair, glasses, emotion,
+ * hair, makeup, occlusion, accessories, blur, exposure and noise) may not be
+ * perfectly accurate. HeadPose's pitch value is a reserved field and will
+ * always return 0.
+ * * Different 'recognitionModel' values are provided. If follow-up operations
+ * like Verify, Identify, Find Similar are needed, please specify the
+ * recognition model with 'recognitionModel' parameter. The default value for
+ * 'recognitionModel' is 'recognition_01', if latest model needed, please
+ * explicitly specify the model you need in this parameter. Once specified, the
+ * detected faceIds will be associated with the specified recognition model.
+ * More details, please refer to [How to specify a recognition
+ * model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
+ *
*
* @param {string} url Publicly reachable URL of an image
*
@@ -1835,6 +2196,17 @@ class Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1859,8 +2231,45 @@ class Face {
}
/**
- * Detect human faces in an image and returns face locations, and optionally
- * with faceIds, landmarks, and attributes.
+ * Detect human faces in an image, return face rectangles, and optionally with
+ * faceIds, landmarks, and attributes.
+ * * Optional parameters including faceId, landmarks, and attributes.
+ * Attributes include age, gender, headPose, smile, facialHair, glasses,
+ * emotion, hair, makeup, occlusion, accessories, blur, exposure and noise.
+ * * The extracted face feature, instead of the actual image, will be stored on
+ * server. The faceId is an identifier of the face feature and will be used in
+ * [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
+ * [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
+ * and [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * It will expire 24 hours after the detection call.
+ * * Higher face image quality means better detection and recognition
+ * precision. Please consider high-quality faces: frontal, clear, and face size
+ * is 200x200 pixels (100 pixels between eyes) or bigger.
+ * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
+ * allowed image file size is from 1KB to 6MB.
+ * * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If need
+ * to detect very small but clear faces, please try to enlarge the input image.
+ * * Up to 64 faces can be returned for an image. Faces are ranked by face
+ * rectangle size from large to small.
+ * * Face detector prefer frontal and near-frontal faces. There are cases that
+ * faces may not be detected, e.g. exceptionally large face angles (head-pose)
+ * or being occluded, or wrong image orientation.
+ * * Attributes (age, gender, headPose, smile, facialHair, glasses, emotion,
+ * hair, makeup, occlusion, accessories, blur, exposure and noise) may not be
+ * perfectly accurate. HeadPose's pitch value is a reserved field and will
+ * always return 0.
+ * * Different 'recognitionModel' values are provided. If follow-up operations
+ * like Verify, Identify, Find Similar are needed, please specify the
+ * recognition model with 'recognitionModel' parameter. The default value for
+ * 'recognitionModel' is 'recognition_01', if latest model needed, please
+ * explicitly specify the model you need in this parameter. Once specified, the
+ * detected faceIds will be associated with the specified recognition model.
+ * More details, please refer to [How to specify a recognition
+ * model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
+ *
*
* @param {string} url Publicly reachable URL of an image
*
@@ -1878,6 +2287,17 @@ class Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2056,6 +2476,17 @@ class Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2099,6 +2530,17 @@ class Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
diff --git a/lib/services/cognitiveServicesFace/lib/operations/faceListOperations.js b/lib/services/cognitiveServicesFace/lib/operations/faceListOperations.js
index 4a07e8019a..8d52369ca0 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/faceListOperations.js
+++ b/lib/services/cognitiveServicesFace/lib/operations/faceListOperations.js
@@ -14,8 +14,36 @@ const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
- * Create an empty face list. Up to 64 face lists are allowed to exist in one
+ * Create an empty face list with user-specified faceListId, name, an optional
+ * userData and recognitionModel. Up to 64 face lists are allowed in one
* subscription.
+ *
Face list is a list of faces, up to 1,000 faces, and used by [Face -
+ * Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [FaceList - Add
+ * Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250)
+ * to import the faces. Faces are stored on server until [FaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
Please consider
+ * [LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * when the face number is large. It can support up to 1,000,000 faces.
+ * 'recognitionModel' should be specified to associate with this face list. The
+ * default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing face list will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a face list can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
@@ -26,6 +54,9 @@ const WebResource = msRest.WebResource;
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -53,6 +84,7 @@ function _create(faceListId, options, callback) {
}
let name = (options && options.name !== undefined) ? options.name : undefined;
let userData = (options && options.userData !== undefined) ? options.userData : undefined;
+ let recognitionModel = (options && options.recognitionModel !== undefined) ? options.recognitionModel : 'recognition_01';
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -89,14 +121,18 @@ function _create(faceListId, options, callback) {
throw new Error('"userData" should satisfy the constraint - "MaxLength": 16384');
}
}
+ if (recognitionModel !== null && recognitionModel !== undefined && typeof recognitionModel.valueOf() !== 'string') {
+ throw new Error('recognitionModel must be of type string.');
+ }
} catch (error) {
return callback(error);
}
let body;
- if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined)) {
- body = new client.models['NameAndUserDataContract']();
+ if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined) || (recognitionModel !== null && recognitionModel !== undefined)) {
+ body = new client.models['MetaDataContract']();
body.name = name;
body.userData = userData;
+ body.recognitionModel = recognitionModel;
}
// Construct URL
@@ -124,7 +160,7 @@ function _create(faceListId, options, callback) {
let requestModel = null;
try {
if (body !== null && body !== undefined) {
- let requestModelMapper = new client.models['NameAndUserDataContract']().mapper();
+ let requestModelMapper = new client.models['MetaDataContract']().mapper();
requestModel = client.serialize(requestModelMapper, body, 'body');
requestContent = JSON.stringify(requestModel);
}
@@ -175,12 +211,17 @@ function _create(faceListId, options, callback) {
}
/**
- * Retrieve a face list's information.
+ * Retrieve a face list’s faceListId, name, userData, recognitionModel and
+ * faces in the face list.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -207,6 +248,7 @@ function _get(faceListId, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -225,6 +267,9 @@ function _get(faceListId, options, callback) {
throw new Error('"faceListId" should satisfy the constraint - "Pattern": /^[a-z0-9-_]+$/');
}
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -234,6 +279,13 @@ function _get(faceListId, options, callback) {
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'facelists/{faceListId}';
requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
requestUrl = requestUrl.replace('{faceListId}', encodeURIComponent(faceListId));
+ let queryParameters = [];
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
// Create HTTP transport objects
let httpRequest = new WebResource();
@@ -584,11 +636,16 @@ function _deleteMethod(faceListId, options, callback) {
}
/**
- * Retrieve information about all existing face lists. Only faceListId, name
- * and userData will be returned.
+ * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c)
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -614,11 +671,15 @@ function _list(options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -627,6 +688,13 @@ function _list(options, callback) {
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'facelists';
requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ let queryParameters = [];
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
// Create HTTP transport objects
let httpRequest = new WebResource();
@@ -715,7 +783,7 @@ function _list(options, callback) {
}
/**
- * Delete an existing face from a face list (given by a persisitedFaceId and a
+ * Delete an existing face from a face list (given by a persistedFaceId and a
* faceListId). Persisted image related to the face will also be deleted.
*
* @param {string} faceListId Id referencing a particular face list.
@@ -1233,8 +1301,36 @@ class FaceListOperations {
}
/**
- * Create an empty face list. Up to 64 face lists are allowed to exist in one
+ * Create an empty face list with user-specified faceListId, name, an optional
+ * userData and recognitionModel. Up to 64 face lists are allowed in one
* subscription.
+ *
Face list is a list of faces, up to 1,000 faces, and used by [Face -
+ * Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [FaceList - Add
+ * Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250)
+ * to import the faces. Faces are stored on server until [FaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
Please consider
+ * [LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * when the face number is large. It can support up to 1,000,000 faces.
+ * 'recognitionModel' should be specified to associate with this face list. The
+ * default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing face list will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a face list can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
@@ -1245,6 +1341,9 @@ class FaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1269,8 +1368,36 @@ class FaceListOperations {
}
/**
- * Create an empty face list. Up to 64 face lists are allowed to exist in one
+ * Create an empty face list with user-specified faceListId, name, an optional
+ * userData and recognitionModel. Up to 64 face lists are allowed in one
* subscription.
+ *
Face list is a list of faces, up to 1,000 faces, and used by [Face -
+ * Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [FaceList - Add
+ * Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250)
+ * to import the faces. Faces are stored on server until [FaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
Please consider
+ * [LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * when the face number is large. It can support up to 1,000,000 faces.
+ * 'recognitionModel' should be specified to associate with this face list. The
+ * default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing face list will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a face list can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
@@ -1281,6 +1408,9 @@ class FaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1326,12 +1456,17 @@ class FaceListOperations {
}
/**
- * Retrieve a face list's information.
+ * Retrieve a face list’s faceListId, name, userData, recognitionModel and
+ * faces in the face list.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1356,12 +1491,17 @@ class FaceListOperations {
}
/**
- * Retrieve a face list's information.
+ * Retrieve a face list’s faceListId, name, userData, recognitionModel and
+ * faces in the face list.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1582,11 +1722,16 @@ class FaceListOperations {
}
/**
- * Retrieve information about all existing face lists. Only faceListId, name
- * and userData will be returned.
+ * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c)
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1611,11 +1756,16 @@ class FaceListOperations {
}
/**
- * Retrieve information about all existing face lists. Only faceListId, name
- * and userData will be returned.
+ * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c)
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1661,7 +1811,7 @@ class FaceListOperations {
}
/**
- * Delete an existing face from a face list (given by a persisitedFaceId and a
+ * Delete an existing face from a face list (given by a persistedFaceId and a
* faceListId). Persisted image related to the face will also be deleted.
*
* @param {string} faceListId Id referencing a particular face list.
@@ -1695,7 +1845,7 @@ class FaceListOperations {
}
/**
- * Delete an existing face from a face list (given by a persisitedFaceId and a
+ * Delete an existing face from a face list (given by a persistedFaceId and a
* faceListId). Persisted image related to the face will also be deleted.
*
* @param {string} faceListId Id referencing a particular face list.
diff --git a/lib/services/cognitiveServicesFace/lib/operations/index.d.ts b/lib/services/cognitiveServicesFace/lib/operations/index.d.ts
index 2533bf0007..9cdc77c59a 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/index.d.ts
+++ b/lib/services/cognitiveServicesFace/lib/operations/index.d.ts
@@ -23,8 +23,31 @@ export interface Face {
/**
- * Given query face's faceId, find the similar-looking faces from a faceId
- * array, a face list or a large face list.
+ * Given query face's faceId, to search the similar-looking faces from a faceId
+ * array, a face list or a large face list. faceId array contains the faces
+ * created by [Face -
+ * Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
+ * which will expire 24 hours after creation. A "faceListId" is created by
+ * [FaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
+ * containing persistedFaceIds that will not expire. And a "largeFaceListId" is
+ * created by [LargeFaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * containing persistedFaceIds that will also not expire. Depending on the
+ * input the returned similar faces list contains faceIds or persistedFaceIds
+ * ranked by similarity.
+ *
Find similar has two working modes, "matchPerson" and "matchFace".
+ * "matchPerson" is the default mode that it tries to find faces of the same
+ * person as possible by using internal same-person thresholds. It is useful to
+ * find a known person's other photos. Note that an empty list will be returned
+ * if no faces pass the internal thresholds. "matchFace" mode ignores
+ * same-person thresholds and returns ranked similar faces anyway, even the
+ * similarity is low. It can be used in the cases like searching
+ * celebrity-looking faces.
+ *
The 'recognitionModel' associated with the query face's faceId should
+ * be the same as the 'recognitionModel' used by the target faceId array, face
+ * list or large face list.
+ *
*
* @param {uuid} faceId FaceId of the query face. User needs to call Face -
* Detect first to get a valid faceId. Note that this faceId is not persisted
@@ -36,7 +59,7 @@ export interface Face {
* 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.
*
* @param {string} [options.largeFaceListId] An existing user-specified unique
* candidate large face list, created in LargeFaceList - Create. Large face
@@ -69,8 +92,31 @@ export interface Face {
findSimilarWithHttpOperationResponse(faceId: string, options?: { faceListId? : string, largeFaceListId? : string, faceIds? : string[], maxNumOfCandidatesReturned? : number, mode? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Given query face's faceId, find the similar-looking faces from a faceId
- * array, a face list or a large face list.
+ * Given query face's faceId, to search the similar-looking faces from a faceId
+ * array, a face list or a large face list. faceId array contains the faces
+ * created by [Face -
+ * Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236),
+ * which will expire 24 hours after creation. A "faceListId" is created by
+ * [FaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b)
+ * containing persistedFaceIds that will not expire. And a "largeFaceListId" is
+ * created by [LargeFaceList -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * containing persistedFaceIds that will also not expire. Depending on the
+ * input the returned similar faces list contains faceIds or persistedFaceIds
+ * ranked by similarity.
+ *
Find similar has two working modes, "matchPerson" and "matchFace".
+ * "matchPerson" is the default mode that it tries to find faces of the same
+ * person as possible by using internal same-person thresholds. It is useful to
+ * find a known person's other photos. Note that an empty list will be returned
+ * if no faces pass the internal thresholds. "matchFace" mode ignores
+ * same-person thresholds and returns ranked similar faces anyway, even the
+ * similarity is low. It can be used in the cases like searching
+ * celebrity-looking faces.
+ *
The 'recognitionModel' associated with the query face's faceId should
+ * be the same as the 'recognitionModel' used by the target faceId array, face
+ * list or large face list.
+ *
*
* @param {uuid} faceId FaceId of the query face. User needs to call Face -
* Detect first to get a valid faceId. Note that this faceId is not persisted
@@ -82,7 +128,7 @@ export interface Face {
* 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.
*
* @param {string} [options.largeFaceListId] An existing user-specified unique
* candidate large face list, created in LargeFaceList - Create. Large face
@@ -133,7 +179,22 @@ export interface Face {
/**
- * Divide candidate faces into groups based on face similarity.
+ * Divide candidate faces into groups based on face similarity.
+ * * The output is one or more disjointed face groups and a messyGroup. A face
+ * group contains faces that have similar looking, often of the same person.
+ * Face groups are ranked by group size, i.e. number of faces. Notice that
+ * faces belonging to a same person might be split into several groups in the
+ * result.
+ * * MessyGroup is a special face group containing faces that cannot find any
+ * similar counterpart face from original faces. The messyGroup will not appear
+ * in the result if all faces found their counterparts.
+ * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to
+ * try [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a)
+ * when you only have 2 candidate faces.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same.
+ *
*
* @param {array} faceIds Array of candidate faceId created by Face - Detect.
* The maximum is 1000 faces
@@ -152,7 +213,22 @@ export interface Face {
groupWithHttpOperationResponse(faceIds: string[], options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Divide candidate faces into groups based on face similarity.
+ * Divide candidate faces into groups based on face similarity.
+ * * The output is one or more disjointed face groups and a messyGroup. A face
+ * group contains faces that have similar looking, often of the same person.
+ * Face groups are ranked by group size, i.e. number of faces. Notice that
+ * faces belonging to a same person might be split into several groups in the
+ * result.
+ * * MessyGroup is a special face group containing faces that cannot find any
+ * similar counterpart face from original faces. The messyGroup will not appear
+ * in the result if all faces found their counterparts.
+ * * Group API needs at least 2 candidate faces and 1000 at most. We suggest to
+ * try [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a)
+ * when you only have 2 candidate faces.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same.
+ *
*
* @param {array} faceIds Array of candidate faceId created by Face - Detect.
* The maximum is 1000 faces
@@ -192,6 +268,36 @@ export interface Face {
/**
* 1-to-many identification to find the closest matches of the specific query
* person face from a person group or large person group.
+ *
For each face in the faceIds array, Face Identify will compute
+ * similarities between the query face and all the faces in the person group
+ * (given by personGroupId) or large person group (given by
+ * largePersonGroupId), and return candidate person(s) for that face ranked by
+ * similarity confidence. The person group/large person group should be trained
+ * to make it ready for identification. See more in [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * and [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4).
+ *
+ *
+ * Remarks:
+ * * The algorithm allows more than one face to be identified independently at
+ * the same request, but no more than 10 faces.
+ * * Each person in the person group/large person group could have more than
+ * one face, but no more than 248 faces.
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * Number of candidates returned is restricted by maxNumOfCandidatesReturned
+ * and confidenceThreshold. If no person is identified, the returned candidates
+ * will be an empty array.
+ * * Try [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237)
+ * when you need to find similar faces from a face list/large face list instead
+ * of a person group/large person group.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target person group or large
+ * person group.
+ *
*
* @param {array} faceIds Array of query faces faceIds, created by the Face -
* Detect. Each of the faces are identified independently. The valid number of
@@ -229,6 +335,36 @@ export interface Face {
/**
* 1-to-many identification to find the closest matches of the specific query
* person face from a person group or large person group.
+ *
For each face in the faceIds array, Face Identify will compute
+ * similarities between the query face and all the faces in the person group
+ * (given by personGroupId) or large person group (given by
+ * largePersonGroupId), and return candidate person(s) for that face ranked by
+ * similarity confidence. The person group/large person group should be trained
+ * to make it ready for identification. See more in [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * and [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4).
+ *
+ *
+ * Remarks:
+ * * The algorithm allows more than one face to be identified independently at
+ * the same request, but no more than 10 faces.
+ * * Each person in the person group/large person group could have more than
+ * one face, but no more than 248 faces.
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * Number of candidates returned is restricted by maxNumOfCandidatesReturned
+ * and confidenceThreshold. If no person is identified, the returned candidates
+ * will be an empty array.
+ * * Try [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237)
+ * when you need to find similar faces from a face list/large face list instead
+ * of a person group/large person group.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target person group or large
+ * person group.
+ *
*
* @param {array} faceIds Array of query faces faceIds, created by the Face -
* Detect. Each of the faces are identified independently. The valid number of
@@ -284,6 +420,17 @@ export interface Face {
/**
* Verify whether two faces belong to a same person or whether one face belongs
* to a person.
+ *
+ * Remarks:
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * For the scenarios that are sensitive to accuracy please make your own
+ * judgment.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target face, person group or
+ * large person group.
+ *
*
* @param {uuid} faceId1 FaceId of the first face, comes from Face - Detect
*
@@ -305,6 +452,17 @@ export interface Face {
/**
* Verify whether two faces belong to a same person or whether one face belongs
* to a person.
+ *
+ * Remarks:
+ * * Higher face image quality means better identification precision. Please
+ * consider high-quality faces: frontal, clear, and face size is 200x200 pixels
+ * (100 pixels between eyes) or bigger.
+ * * For the scenarios that are sensitive to accuracy please make your own
+ * judgment.
+ * * The 'recognitionModel' associated with the query faces' faceIds should be
+ * the same as the 'recognitionModel' used by the target face, person group or
+ * large person group.
+ *
*
* @param {uuid} faceId1 FaceId of the first face, comes from Face - Detect
*
@@ -343,8 +501,45 @@ export interface Face {
/**
- * Detect human faces in an image and returns face locations, and optionally
- * with faceIds, landmarks, and attributes.
+ * Detect human faces in an image, return face rectangles, and optionally with
+ * faceIds, landmarks, and attributes.
+ * * Optional parameters including faceId, landmarks, and attributes.
+ * Attributes include age, gender, headPose, smile, facialHair, glasses,
+ * emotion, hair, makeup, occlusion, accessories, blur, exposure and noise.
+ * * The extracted face feature, instead of the actual image, will be stored on
+ * server. The faceId is an identifier of the face feature and will be used in
+ * [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
+ * [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
+ * and [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * It will expire 24 hours after the detection call.
+ * * Higher face image quality means better detection and recognition
+ * precision. Please consider high-quality faces: frontal, clear, and face size
+ * is 200x200 pixels (100 pixels between eyes) or bigger.
+ * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
+ * allowed image file size is from 1KB to 6MB.
+ * * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If need
+ * to detect very small but clear faces, please try to enlarge the input image.
+ * * Up to 64 faces can be returned for an image. Faces are ranked by face
+ * rectangle size from large to small.
+ * * Face detector prefer frontal and near-frontal faces. There are cases that
+ * faces may not be detected, e.g. exceptionally large face angles (head-pose)
+ * or being occluded, or wrong image orientation.
+ * * Attributes (age, gender, headPose, smile, facialHair, glasses, emotion,
+ * hair, makeup, occlusion, accessories, blur, exposure and noise) may not be
+ * perfectly accurate. HeadPose's pitch value is a reserved field and will
+ * always return 0.
+ * * Different 'recognitionModel' values are provided. If follow-up operations
+ * like Verify, Identify, Find Similar are needed, please specify the
+ * recognition model with 'recognitionModel' parameter. The default value for
+ * 'recognitionModel' is 'recognition_01', if latest model needed, please
+ * explicitly specify the model you need in this parameter. Once specified, the
+ * detected faceIds will be associated with the specified recognition model.
+ * More details, please refer to [How to specify a recognition
+ * model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
+ *
*
* @param {string} url Publicly reachable URL of an image
*
@@ -362,6 +557,17 @@ export interface Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -371,11 +577,48 @@ export interface Face {
*
* @reject {Error|ServiceError} - The error object.
*/
- detectWithUrlWithHttpOperationResponse(url: string, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>;
+ detectWithUrlWithHttpOperationResponse(url: string, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], recognitionModel? : string, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Detect human faces in an image and returns face locations, and optionally
- * with faceIds, landmarks, and attributes.
+ * Detect human faces in an image, return face rectangles, and optionally with
+ * faceIds, landmarks, and attributes.
+ * * Optional parameters including faceId, landmarks, and attributes.
+ * Attributes include age, gender, headPose, smile, facialHair, glasses,
+ * emotion, hair, makeup, occlusion, accessories, blur, exposure and noise.
+ * * The extracted face feature, instead of the actual image, will be stored on
+ * server. The faceId is an identifier of the face feature and will be used in
+ * [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239),
+ * [Face -
+ * Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a),
+ * and [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * It will expire 24 hours after the detection call.
+ * * Higher face image quality means better detection and recognition
+ * precision. Please consider high-quality faces: frontal, clear, and face size
+ * is 200x200 pixels (100 pixels between eyes) or bigger.
+ * * JPEG, PNG, GIF (the first frame), and BMP format are supported. The
+ * allowed image file size is from 1KB to 6MB.
+ * * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If need
+ * to detect very small but clear faces, please try to enlarge the input image.
+ * * Up to 64 faces can be returned for an image. Faces are ranked by face
+ * rectangle size from large to small.
+ * * Face detector prefer frontal and near-frontal faces. There are cases that
+ * faces may not be detected, e.g. exceptionally large face angles (head-pose)
+ * or being occluded, or wrong image orientation.
+ * * Attributes (age, gender, headPose, smile, facialHair, glasses, emotion,
+ * hair, makeup, occlusion, accessories, blur, exposure and noise) may not be
+ * perfectly accurate. HeadPose's pitch value is a reserved field and will
+ * always return 0.
+ * * Different 'recognitionModel' values are provided. If follow-up operations
+ * like Verify, Identify, Find Similar are needed, please specify the
+ * recognition model with 'recognitionModel' parameter. The default value for
+ * 'recognitionModel' is 'recognition_01', if latest model needed, please
+ * explicitly specify the model you need in this parameter. Once specified, the
+ * detected faceIds will be associated with the specified recognition model.
+ * More details, please refer to [How to specify a recognition
+ * model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model)
+ *
*
* @param {string} url Publicly reachable URL of an image
*
@@ -393,6 +636,17 @@ export interface Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -417,9 +671,9 @@ export interface Face {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- detectWithUrl(url: string, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], customHeaders? : { [headerName: string]: string; } }): Promise;
+ detectWithUrl(url: string, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], recognitionModel? : string, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
detectWithUrl(url: string, callback: ServiceCallback): void;
- detectWithUrl(url: string, options: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ detectWithUrl(url: string, options: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], recognitionModel? : string, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -529,6 +783,17 @@ export interface Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -538,7 +803,7 @@ export interface Face {
*
* @reject {Error|ServiceError} - The error object.
*/
- detectWithStreamWithHttpOperationResponse(image: stream.Readable, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>;
+ detectWithStreamWithHttpOperationResponse(image: stream.Readable, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], recognitionModel? : string, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
* Detect human faces in an image and returns face locations, and optionally
@@ -560,6 +825,17 @@ export interface Face {
* gender, headPose, smile, facialHair, glasses and emotion. Note that each
* face attribute analysis has additional computational and time cost.
*
+ * @param {string} [options.recognitionModel] Name of recognition model.
+ * Recognition model is used when the face features are extracted and
+ * associated with detected faceIds, (Large)FaceList or (Large)PersonGroup. A
+ * recognition model name can be provided when performing Face - Detect or
+ * (Large)FaceList - Create or (Large)PersonGroup - Create. The default value
+ * is 'recognition_01', if latest model needed, please explicitly specify the
+ * model you need. Possible values include: 'recognition_01', 'recognition_02'
+ *
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -584,9 +860,9 @@ export interface Face {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- detectWithStream(image: stream.Readable, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], customHeaders? : { [headerName: string]: string; } }): Promise;
+ detectWithStream(image: stream.Readable, options?: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], recognitionModel? : string, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
detectWithStream(image: stream.Readable, callback: ServiceCallback): void;
- detectWithStream(image: stream.Readable, options: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ detectWithStream(image: stream.Readable, options: { returnFaceId? : boolean, returnFaceLandmarks? : boolean, returnFaceAttributes? : string[], recognitionModel? : string, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
}
/**
@@ -1305,8 +1581,38 @@ export interface PersonGroupOperations {
/**
- * Create a new person group with specified personGroupId, name and
- * user-provided userData.
+ * Create a new person group with specified personGroupId, name, user-provided
+ * userData and recognitionModel.
+ *
A person group is the container of the uploaded person data,
+ * including face images and face recognition features.
+ *
After creation, use [PersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c)
+ * to add persons into the group, and then call [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person's face, image, and userData will be stored on server until
+ * [PersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d)
+ * or [PersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000
+ * persons.
+ * * S0-tier subscription quota: 1,000,000 person groups. Each holds up to
+ * 10,000 persons.
+ * * to handle larger scale face identification problem, please consider using
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
+ *
+ * 'recognitionModel' should be specified to associate with this person group.
+ * The default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing person group will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a person group can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} personGroupId Id referencing a particular person group.
*
@@ -1317,6 +1623,9 @@ export interface PersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1326,11 +1635,41 @@ export interface PersonGroupOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- createWithHttpOperationResponse(personGroupId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+ createWithHttpOperationResponse(personGroupId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Create a new person group with specified personGroupId, name and
- * user-provided userData.
+ * Create a new person group with specified personGroupId, name, user-provided
+ * userData and recognitionModel.
+ *
A person group is the container of the uploaded person data,
+ * including face images and face recognition features.
+ *
After creation, use [PersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c)
+ * to add persons into the group, and then call [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person's face, image, and userData will be stored on server until
+ * [PersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d)
+ * or [PersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000
+ * persons.
+ * * S0-tier subscription quota: 1,000,000 person groups. Each holds up to
+ * 10,000 persons.
+ * * to handle larger scale face identification problem, please consider using
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
+ *
+ * 'recognitionModel' should be specified to associate with this person group.
+ * The default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing person group will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a person group can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} personGroupId Id referencing a particular person group.
*
@@ -1341,6 +1680,9 @@ export interface PersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1365,9 +1707,9 @@ export interface PersonGroupOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- create(personGroupId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ create(personGroupId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
create(personGroupId: string, callback: ServiceCallback): void;
- create(personGroupId: string, options: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ create(personGroupId: string, options: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -1427,12 +1769,17 @@ export interface PersonGroupOperations {
/**
- * Retrieve the information of a person group, including its name and userData.
+ * Retrieve person group name, userData and recognitionModel. To get person
+ * information under this personGroup, use [PersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241).
*
* @param {string} personGroupId Id referencing a particular person group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1442,15 +1789,20 @@ export interface PersonGroupOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- getWithHttpOperationResponse(personGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+ getWithHttpOperationResponse(personGroupId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Retrieve the information of a person group, including its name and userData.
+ * Retrieve person group name, userData and recognitionModel. To get person
+ * information under this personGroup, use [PersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241).
*
* @param {string} personGroupId Id referencing a particular person group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1476,9 +1828,9 @@ export interface PersonGroupOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- get(personGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ get(personGroupId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
get(personGroupId: string, callback: ServiceCallback): void;
- get(personGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ get(personGroupId: string, options: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -1603,7 +1955,21 @@ export interface PersonGroupOperations {
/**
- * List person groups and their information.
+ * List person groups’ personGroupId, name, userData and recognitionModel.
+ * * Person groups are stored in alphabetical order of personGroupId.
+ * * "start" parameter (string, optional) is a user-provided personGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -1612,6 +1978,9 @@ export interface PersonGroupOperations {
*
* @param {number} [options.top] The number of person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1621,10 +1990,24 @@ export interface PersonGroupOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- listWithHttpOperationResponse(options?: { start? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>;
+ listWithHttpOperationResponse(options?: { start? : string, top? : number, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * List person groups and their information.
+ * List person groups’ personGroupId, name, userData and recognitionModel.
+ * * Person groups are stored in alphabetical order of personGroupId.
+ * * "start" parameter (string, optional) is a user-provided personGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -1633,6 +2016,9 @@ export interface PersonGroupOperations {
*
* @param {number} [options.top] The number of person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1657,9 +2043,9 @@ export interface PersonGroupOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- list(options?: { start? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise;
+ list(options?: { start? : string, top? : number, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
list(callback: ServiceCallback): void;
- list(options: { start? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ list(options: { start? : string, top? : number, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -1728,8 +2114,36 @@ export interface FaceListOperations {
/**
- * Create an empty face list. Up to 64 face lists are allowed to exist in one
+ * Create an empty face list with user-specified faceListId, name, an optional
+ * userData and recognitionModel. Up to 64 face lists are allowed in one
* subscription.
+ *
Face list is a list of faces, up to 1,000 faces, and used by [Face -
+ * Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [FaceList - Add
+ * Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250)
+ * to import the faces. Faces are stored on server until [FaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
Please consider
+ * [LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * when the face number is large. It can support up to 1,000,000 faces.
+ * 'recognitionModel' should be specified to associate with this face list. The
+ * default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing face list will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a face list can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
@@ -1740,6 +2154,9 @@ export interface FaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1749,11 +2166,39 @@ export interface FaceListOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- createWithHttpOperationResponse(faceListId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+ createWithHttpOperationResponse(faceListId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Create an empty face list. Up to 64 face lists are allowed to exist in one
+ * Create an empty face list with user-specified faceListId, name, an optional
+ * userData and recognitionModel. Up to 64 face lists are allowed in one
* subscription.
+ *
Face list is a list of faces, up to 1,000 faces, and used by [Face -
+ * Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [FaceList - Add
+ * Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250)
+ * to import the faces. Faces are stored on server until [FaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
Please consider
+ * [LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
+ * when the face number is large. It can support up to 1,000,000 faces.
+ * 'recognitionModel' should be specified to associate with this face list. The
+ * default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing face list will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a face list can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
@@ -1764,6 +2209,9 @@ export interface FaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1788,18 +2236,23 @@ export interface FaceListOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- create(faceListId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ create(faceListId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
create(faceListId: string, callback: ServiceCallback): void;
- create(faceListId: string, options: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ create(faceListId: string, options: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
- * Retrieve a face list's information.
+ * Retrieve a face list’s faceListId, name, userData, recognitionModel and
+ * faces in the face list.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1809,15 +2262,20 @@ export interface FaceListOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- getWithHttpOperationResponse(faceListId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+ getWithHttpOperationResponse(faceListId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Retrieve a face list's information.
+ * Retrieve a face list’s faceListId, name, userData, recognitionModel and
+ * faces in the face list.
+ *
*
* @param {string} faceListId Id referencing a particular face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1843,9 +2301,9 @@ export interface FaceListOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- get(faceListId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ get(faceListId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
get(faceListId: string, callback: ServiceCallback): void;
- get(faceListId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ get(faceListId: string, options: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -1969,11 +2427,16 @@ export interface FaceListOperations {
/**
- * Retrieve information about all existing face lists. Only faceListId, name
- * and userData will be returned.
+ * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c)
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1983,14 +2446,19 @@ export interface FaceListOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+ listWithHttpOperationResponse(options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Retrieve information about all existing face lists. Only faceListId, name
- * and userData will be returned.
+ * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c)
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2015,13 +2483,13 @@ export interface FaceListOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ list(options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
list(callback: ServiceCallback): void;
- list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ list(options: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
- * Delete an existing face from a face list (given by a persisitedFaceId and a
+ * Delete an existing face from a face list (given by a persistedFaceId and a
* faceListId). Persisted image related to the face will also be deleted.
*
* @param {string} faceListId Id referencing a particular face list.
@@ -2043,7 +2511,7 @@ export interface FaceListOperations {
deleteFaceWithHttpOperationResponse(faceListId: string, persistedFaceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Delete an existing face from a face list (given by a persisitedFaceId and a
+ * Delete an existing face from a face list (given by a persistedFaceId and a
* faceListId). Persisted image related to the face will also be deleted.
*
* @param {string} faceListId Id referencing a particular face list.
@@ -2984,8 +3452,35 @@ export interface LargePersonGroupOperations {
/**
- * Create a new large person group with specified largePersonGroupId, name and
- * user-provided userData.
+ * Create a new large person group with user-specified largePersonGroupId,
+ * name, an optional userData and recognitionModel.
+ *
A large person group is the container of the uploaded person data,
+ * including face images and face recognition feature, and up to 1,000,000
+ * people.
+ *
After creation, use [LargePersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
+ * to add person into the group, and call [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person face, image, and userData will be stored on server until
+ * [LargePersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
+ * or [LargePersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 large person groups.
+ * * S0-tier subscription quota: 1,000,000 large person groups.
+ *
+ * 'recognitionModel' should be specified to associate with this large person
+ * group. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large person group will
+ * use the recognition model that's already associated with the collection.
+ * Existing face features in a large person group can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
@@ -2997,6 +3492,9 @@ export interface LargePersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3006,11 +3504,38 @@ export interface LargePersonGroupOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- createWithHttpOperationResponse(largePersonGroupId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+ createWithHttpOperationResponse(largePersonGroupId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Create a new large person group with specified largePersonGroupId, name and
- * user-provided userData.
+ * Create a new large person group with user-specified largePersonGroupId,
+ * name, an optional userData and recognitionModel.
+ *
A large person group is the container of the uploaded person data,
+ * including face images and face recognition feature, and up to 1,000,000
+ * people.
+ *
After creation, use [LargePersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
+ * to add person into the group, and call [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person face, image, and userData will be stored on server until
+ * [LargePersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
+ * or [LargePersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 large person groups.
+ * * S0-tier subscription quota: 1,000,000 large person groups.
+ *
+ * 'recognitionModel' should be specified to associate with this large person
+ * group. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large person group will
+ * use the recognition model that's already associated with the collection.
+ * Existing face features in a large person group can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
@@ -3022,6 +3547,9 @@ export interface LargePersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3046,9 +3574,9 @@ export interface LargePersonGroupOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- create(largePersonGroupId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ create(largePersonGroupId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
create(largePersonGroupId: string, callback: ServiceCallback): void;
- create(largePersonGroupId: string, options: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ create(largePersonGroupId: string, options: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -3110,14 +3638,21 @@ export interface LargePersonGroupOperations {
/**
- * Retrieve the information of a large person group, including its name and
- * userData.
+ * Retrieve the information of a large person group, including its name,
+ * userData and recognitionModel. This API returns large person group
+ * information only, use [LargePersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
+ * instead to retrieve person information under the large person group.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3127,17 +3662,24 @@ export interface LargePersonGroupOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- getWithHttpOperationResponse(largePersonGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+ getWithHttpOperationResponse(largePersonGroupId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Retrieve the information of a large person group, including its name and
- * userData.
+ * Retrieve the information of a large person group, including its name,
+ * userData and recognitionModel. This API returns large person group
+ * information only, use [LargePersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
+ * instead to retrieve person information under the large person group.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3163,9 +3705,9 @@ export interface LargePersonGroupOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- get(largePersonGroupId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ get(largePersonGroupId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
get(largePersonGroupId: string, callback: ServiceCallback): void;
- get(largePersonGroupId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ get(largePersonGroupId: string, options: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -3294,7 +3836,22 @@ export interface LargePersonGroupOperations {
/**
- * List large person groups and their information.
+ * List all existing large person groups’ largePersonGroupId, name, userData
+ * and recognitionModel.
+ * * Large person groups are stored in alphabetical order of
+ * largePersonGroupId.
+ * * "start" parameter (string, optional) is a user-provided largePersonGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -3303,6 +3860,9 @@ export interface LargePersonGroupOperations {
*
* @param {number} [options.top] The number of large person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3312,10 +3872,25 @@ export interface LargePersonGroupOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- listWithHttpOperationResponse(options?: { start? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>;
+ listWithHttpOperationResponse(options?: { start? : string, top? : number, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * List large person groups and their information.
+ * List all existing large person groups’ largePersonGroupId, name, userData
+ * and recognitionModel.
+ * * Large person groups are stored in alphabetical order of
+ * largePersonGroupId.
+ * * "start" parameter (string, optional) is a user-provided largePersonGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -3324,6 +3899,9 @@ export interface LargePersonGroupOperations {
*
* @param {number} [options.top] The number of large person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3348,9 +3926,9 @@ export interface LargePersonGroupOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- list(options?: { start? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise;
+ list(options?: { start? : string, top? : number, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
list(callback: ServiceCallback): void;
- list(options: { start? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ list(options: { start? : string, top? : number, returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -3421,8 +3999,40 @@ export interface LargeFaceListOperations {
/**
- * Create an empty large face list. Up to 64 large face lists are allowed to
- * exist in one subscription.
+ * Create an empty large face list with user-specified largeFaceListId, name,
+ * an optional userData and recognitionModel.
+ *
Large face list is a list of faces, up to 1,000,000 faces, and used
+ * by [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [LargeFaceList Face -
+ * Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3)
+ * to import the faces and [LargeFaceList -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1)
+ * to make it ready for [Face -
+ * FindSimilar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * Faces are stored on server until [LargeFaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
+ * * Free-tier subscription quota: 64 large face lists.
+ * * S0-tier subscription quota: 1,000,000 large face lists.
+ *
+ * 'recognitionModel' should be specified to associate with this large face
+ * list. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large face list will use
+ * the recognition model that's already associated with the collection.
+ * Existing face features in a large face list can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
@@ -3433,6 +4043,9 @@ export interface LargeFaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3442,11 +4055,43 @@ export interface LargeFaceListOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- createWithHttpOperationResponse(largeFaceListId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+ createWithHttpOperationResponse(largeFaceListId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Create an empty large face list. Up to 64 large face lists are allowed to
- * exist in one subscription.
+ * Create an empty large face list with user-specified largeFaceListId, name,
+ * an optional userData and recognitionModel.
+ *
Large face list is a list of faces, up to 1,000,000 faces, and used
+ * by [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [LargeFaceList Face -
+ * Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3)
+ * to import the faces and [LargeFaceList -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1)
+ * to make it ready for [Face -
+ * FindSimilar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * Faces are stored on server until [LargeFaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
+ * * Free-tier subscription quota: 64 large face lists.
+ * * S0-tier subscription quota: 1,000,000 large face lists.
+ *
+ * 'recognitionModel' should be specified to associate with this large face
+ * list. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large face list will use
+ * the recognition model that's already associated with the collection.
+ * Existing face features in a large face list can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
@@ -3457,6 +4102,9 @@ export interface LargeFaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3481,18 +4129,22 @@ export interface LargeFaceListOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- create(largeFaceListId: string, options?: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ create(largeFaceListId: string, options?: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
create(largeFaceListId: string, callback: ServiceCallback): void;
- create(largeFaceListId: string, options: { name? : string, userData? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ create(largeFaceListId: string, options: { name? : string, userData? : string, recognitionModel? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
- * Retrieve a large face list's information.
+ * Retrieve a large face list’s largeFaceListId, name, userData and
+ * recognitionModel.
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3502,15 +4154,19 @@ export interface LargeFaceListOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- getWithHttpOperationResponse(largeFaceListId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+ getWithHttpOperationResponse(largeFaceListId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Retrieve a large face list's information.
+ * Retrieve a large face list’s largeFaceListId, name, userData and
+ * recognitionModel.
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3536,9 +4192,9 @@ export interface LargeFaceListOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- get(largeFaceListId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ get(largeFaceListId: string, options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
get(largeFaceListId: string, callback: ServiceCallback): void;
- get(largeFaceListId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ get(largeFaceListId: string, options: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -3717,11 +4373,30 @@ export interface LargeFaceListOperations {
/**
- * Retrieve information about all existing large face lists. Only
- * largeFaceListId, name and userData will be returned.
+ * List large face lists’ information of largeFaceListId, name, userData and
+ * recognitionModel.
+ * To get face information inside largeFaceList use [LargeFaceList Face -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)
+ * * Large face lists are stored in alphabetical order of largeFaceListId.
+ * * "start" parameter (string, optional) is a user-provided largeFaceListId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person lists: "list1", ..., "list5".
+ *
"start=&top=" will return all 5 lists.
+ *
"start=&top=2" will return "list1", "list2".
+ *
"start=list2&top=3" will return "list3", "list4", "list5".
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3731,14 +4406,33 @@ export interface LargeFaceListOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
- listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+ listWithHttpOperationResponse(options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Retrieve information about all existing large face lists. Only
- * largeFaceListId, name and userData will be returned.
+ * List large face lists’ information of largeFaceListId, name, userData and
+ * recognitionModel.
+ * To get face information inside largeFaceList use [LargeFaceList Face -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)
+ * * Large face lists are stored in alphabetical order of largeFaceListId.
+ * * "start" parameter (string, optional) is a user-provided largeFaceListId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person lists: "list1", ..., "list5".
+ *
"start=&top=" will return all 5 lists.
+ *
"start=&top=2" will return "list1", "list2".
+ *
"start=list2&top=3" will return "list3", "list4", "list5".
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -3763,9 +4457,9 @@ export interface LargeFaceListOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
- list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ list(options?: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise;
list(callback: ServiceCallback): void;
- list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+ list(options: { returnRecognitionModel? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
/**
@@ -3825,7 +4519,7 @@ export interface LargeFaceListOperations {
/**
- * Delete an existing face from a large face list (given by a persisitedFaceId
+ * Delete an existing face from a large face list (given by a persistedFaceId
* and a largeFaceListId). Persisted image related to the face will also be
* deleted.
*
@@ -3848,7 +4542,7 @@ export interface LargeFaceListOperations {
deleteFaceWithHttpOperationResponse(largeFaceListId: string, persistedFaceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
/**
- * Delete an existing face from a large face list (given by a persisitedFaceId
+ * Delete an existing face from a large face list (given by a persistedFaceId
* and a largeFaceListId). Persisted image related to the face will also be
* deleted.
*
@@ -4250,3 +4944,624 @@ export interface LargeFaceListOperations {
addFaceFromStream(largeFaceListId: string, image: stream.Readable, callback: ServiceCallback): void;
addFaceFromStream(largeFaceListId: string, image: stream.Readable, options: { userData? : string, targetFace? : number[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
}
+
+/**
+ * @class
+ * SnapshotOperations
+ * __NOTE__: An instance of this class is automatically created for an
+ * instance of the FaceClient.
+ */
+export interface SnapshotOperations {
+
+
+ /**
+ * Submit an operation to take a snapshot of face list, large face list, person
+ * group or large person group, with user-specified snapshot type, source
+ * object id, apply scope and an optional user data.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Taking snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of creating the snapshot.
+ * The snapshot id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the
+ * source object. It could be in seconds, or up to several hours for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. User can delete the snapshot using Snapshot -
+ * Delete by themselves any time before expiration.
+ * Taking snapshot for a certain object will not block any other operations
+ * against the object. All read-only operations (Get/List and
+ * Identify/FindSimilar/Verify) can be conducted as usual. For all writable
+ * operations, including Add/Update/Delete the source object or its
+ * persons/faces and Train, they are not blocked but not recommended because
+ * writable updates may not be reflected on the snapshot during its taking.
+ * After snapshot taking is completed, all readable and writable operations can
+ * work as normal. Snapshot will also include the training results of the
+ * source object, which means target subscription the snapshot applied to does
+ * not need re-train the target object before calling Identify/FindSimilar.
+ * * Free-tier subscription quota: 100 take operations per month.
+ * * S0-tier subscription quota: 100 take operations per day.
+ *
+ * @param {string} type User specified type for the source object to take
+ * snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {string} objectId User specified source object id to take snapshot
+ * from.
+ *
+ * @param {array} applyScope User specified array of target Face subscription
+ * ids for the snapshot. For each snapshot, only subscriptions included in the
+ * applyScope of Snapshot - Take can apply it.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ takeWithHttpOperationResponse(type: string, objectId: string, applyScope: string[], options?: { userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * Submit an operation to take a snapshot of face list, large face list, person
+ * group or large person group, with user-specified snapshot type, source
+ * object id, apply scope and an optional user data.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Taking snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of creating the snapshot.
+ * The snapshot id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the
+ * source object. It could be in seconds, or up to several hours for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. User can delete the snapshot using Snapshot -
+ * Delete by themselves any time before expiration.
+ * Taking snapshot for a certain object will not block any other operations
+ * against the object. All read-only operations (Get/List and
+ * Identify/FindSimilar/Verify) can be conducted as usual. For all writable
+ * operations, including Add/Update/Delete the source object or its
+ * persons/faces and Train, they are not blocked but not recommended because
+ * writable updates may not be reflected on the snapshot during its taking.
+ * After snapshot taking is completed, all readable and writable operations can
+ * work as normal. Snapshot will also include the training results of the
+ * source object, which means target subscription the snapshot applied to does
+ * not need re-train the target object before calling Identify/FindSimilar.
+ * * Free-tier subscription quota: 100 take operations per month.
+ * * S0-tier subscription quota: 100 take operations per day.
+ *
+ * @param {string} type User specified type for the source object to take
+ * snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {string} objectId User specified source object id to take snapshot
+ * from.
+ *
+ * @param {array} applyScope User specified array of target Face subscription
+ * ids for the snapshot. For each snapshot, only subscriptions included in the
+ * applyScope of Snapshot - Take can apply it.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ take(type: string, objectId: string, applyScope: string[], options?: { userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ take(type: string, objectId: string, applyScope: string[], callback: ServiceCallback): void;
+ take(type: string, objectId: string, applyScope: string[], options: { userData? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+
+
+ /**
+ * List all accessible snapshots with related information, including snapshots
+ * that were taken by the user, or snapshots to be applied to the user
+ * (subscription id was included in the applyScope in Snapshot - Take).
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.type] User specified object type as a search
+ * filter. Possible values include: 'FaceList', 'LargeFaceList',
+ * 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {array} [options.applyScope] User specified snapshot apply scopes as
+ * a search filter. ApplyScope is an array of the target Azure subscription ids
+ * for the snapshot, specified by the user who created the snapshot by Snapshot
+ * - Take.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ listWithHttpOperationResponse(options?: { type? : string, applyScope? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * List all accessible snapshots with related information, including snapshots
+ * that were taken by the user, or snapshots to be applied to the user
+ * (subscription id was included in the applyScope in Snapshot - Take).
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.type] User specified object type as a search
+ * filter. Possible values include: 'FaceList', 'LargeFaceList',
+ * 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {array} [options.applyScope] User specified snapshot apply scopes as
+ * a search filter. ApplyScope is an array of the target Azure subscription ids
+ * for the snapshot, specified by the user who created the snapshot by Snapshot
+ * - Take.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {Array} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {Array} [result] - The deserialized result object if an error did not occur.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ list(options?: { type? : string, applyScope? : string[], customHeaders? : { [headerName: string]: string; } }): Promise;
+ list(callback: ServiceCallback): void;
+ list(options: { type? : string, applyScope? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+
+
+ /**
+ * Retrieve information about a snapshot. Snapshot is only accessible to the
+ * source subscription who took it, and target subscriptions included in the
+ * applyScope in Snapshot - Take.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ getWithHttpOperationResponse(snapshotId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * Retrieve information about a snapshot. Snapshot is only accessible to the
+ * source subscription who took it, and target subscriptions included in the
+ * applyScope in Snapshot - Take.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {Snapshot} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {Snapshot} [result] - The deserialized result object if an error did not occur.
+ * See {@link Snapshot} for more information.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ get(snapshotId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ get(snapshotId: string, callback: ServiceCallback): void;
+ get(snapshotId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+
+
+ /**
+ * Update the information of a snapshot. Only the source subscription who took
+ * the snapshot can update the snapshot.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {array} [options.applyScope] Array of the target Face subscription
+ * ids for the snapshot, specified by the user who created the snapshot when
+ * calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ updateWithHttpOperationResponse(snapshotId: string, options?: { applyScope? : string[], userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * Update the information of a snapshot. Only the source subscription who took
+ * the snapshot can update the snapshot.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {array} [options.applyScope] Array of the target Face subscription
+ * ids for the snapshot, specified by the user who created the snapshot when
+ * calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ update(snapshotId: string, options?: { applyScope? : string[], userData? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ update(snapshotId: string, callback: ServiceCallback): void;
+ update(snapshotId: string, options: { applyScope? : string[], userData? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+
+
+ /**
+ * Delete an existing snapshot according to the snapshotId. All object data and
+ * information in the snapshot will also be deleted. Only the source
+ * subscription who took the snapshot can delete the snapshot. If the user does
+ * not delete a snapshot with this API, the snapshot will still be
+ * automatically deleted in 48 hours after creation.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ deleteMethodWithHttpOperationResponse(snapshotId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * Delete an existing snapshot according to the snapshotId. All object data and
+ * information in the snapshot will also be deleted. Only the source
+ * subscription who took the snapshot can delete the snapshot. If the user does
+ * not delete a snapshot with this API, the snapshot will still be
+ * automatically deleted in 48 hours after creation.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ deleteMethod(snapshotId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ deleteMethod(snapshotId: string, callback: ServiceCallback): void;
+ deleteMethod(snapshotId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+
+
+ /**
+ * Submit an operation to apply a snapshot to current subscription. For each
+ * snapshot, only subscriptions included in the applyScope of Snapshot - Take
+ * can apply it.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Applying snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of applying the snapshot.
+ * The target object id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in
+ * the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. So the target subscription is required to apply
+ * the snapshot in 48 hours since its creation.
+ * Applying a snapshot will not block any other operations against the target
+ * object, however it is not recommended because the correctness cannot be
+ * guaranteed during snapshot applying. After snapshot applying is completed,
+ * all operations towards the target object can work as normal. Snapshot also
+ * includes the training results of the source object, which means target
+ * subscription the snapshot applied to does not need re-train the target
+ * object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only
+ * CreateNew apply mode 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.
+ * * Free-tier subscription quota: 100 apply operations per month.
+ * * S0-tier subscription quota: 100 apply operations per day.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {string} objectId User specified target object id to be created from
+ * the snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.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'
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ applyWithHttpOperationResponse(snapshotId: string, objectId: string, options?: { mode? : string, customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * Submit an operation to apply a snapshot to current subscription. For each
+ * snapshot, only subscriptions included in the applyScope of Snapshot - Take
+ * can apply it.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Applying snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of applying the snapshot.
+ * The target object id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in
+ * the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. So the target subscription is required to apply
+ * the snapshot in 48 hours since its creation.
+ * Applying a snapshot will not block any other operations against the target
+ * object, however it is not recommended because the correctness cannot be
+ * guaranteed during snapshot applying. After snapshot applying is completed,
+ * all operations towards the target object can work as normal. Snapshot also
+ * includes the training results of the source object, which means target
+ * subscription the snapshot applied to does not need re-train the target
+ * object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only
+ * CreateNew apply mode 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.
+ * * Free-tier subscription quota: 100 apply operations per month.
+ * * S0-tier subscription quota: 100 apply operations per day.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {string} objectId User specified target object id to be created from
+ * the snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.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'
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ apply(snapshotId: string, objectId: string, options?: { mode? : string, customHeaders? : { [headerName: string]: string; } }): Promise;
+ apply(snapshotId: string, objectId: string, callback: ServiceCallback): void;
+ apply(snapshotId: string, objectId: string, options: { mode? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+
+
+ /**
+ * Retrieve the status of a take/apply snapshot operation.
+ *
+ * @param {uuid} operationId Id referencing a particular take/apply snapshot
+ * operation.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ */
+ getOperationStatusWithHttpOperationResponse(operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>;
+
+ /**
+ * Retrieve the status of a take/apply snapshot operation.
+ *
+ * @param {uuid} operationId Id referencing a particular take/apply snapshot
+ * operation.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {ServiceCallback} [optionalCallback] - The optional callback.
+ *
+ * @returns {ServiceCallback|Promise} If a callback was passed as the last
+ * parameter then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned.
+ *
+ * @resolve {OperationStatus} - The deserialized result object.
+ *
+ * @reject {Error|ServiceError} - The error object.
+ *
+ * {ServiceCallback} optionalCallback(err, result, request, response)
+ *
+ * {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
+ *
+ * {OperationStatus} [result] - The deserialized result object if an error did not occur.
+ * See {@link OperationStatus} for more information.
+ *
+ * {WebResource} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
+ */
+ getOperationStatus(operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise;
+ getOperationStatus(operationId: string, callback: ServiceCallback): void;
+ getOperationStatus(operationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void;
+}
diff --git a/lib/services/cognitiveServicesFace/lib/operations/index.js b/lib/services/cognitiveServicesFace/lib/operations/index.js
index afc063bbab..02881c0832 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/index.js
+++ b/lib/services/cognitiveServicesFace/lib/operations/index.js
@@ -21,3 +21,4 @@ exports.FaceListOperations = require('./faceListOperations');
exports.LargePersonGroupPerson = require('./largePersonGroupPerson');
exports.LargePersonGroupOperations = require('./largePersonGroupOperations');
exports.LargeFaceListOperations = require('./largeFaceListOperations');
+exports.SnapshotOperations = require('./snapshotOperations');
diff --git a/lib/services/cognitiveServicesFace/lib/operations/largeFaceListOperations.js b/lib/services/cognitiveServicesFace/lib/operations/largeFaceListOperations.js
index f263e3e763..558bb5479d 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/largeFaceListOperations.js
+++ b/lib/services/cognitiveServicesFace/lib/operations/largeFaceListOperations.js
@@ -14,8 +14,40 @@ const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
- * Create an empty large face list. Up to 64 large face lists are allowed to
- * exist in one subscription.
+ * Create an empty large face list with user-specified largeFaceListId, name,
+ * an optional userData and recognitionModel.
+ *
Large face list is a list of faces, up to 1,000,000 faces, and used
+ * by [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [LargeFaceList Face -
+ * Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3)
+ * to import the faces and [LargeFaceList -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1)
+ * to make it ready for [Face -
+ * FindSimilar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * Faces are stored on server until [LargeFaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
+ * * Free-tier subscription quota: 64 large face lists.
+ * * S0-tier subscription quota: 1,000,000 large face lists.
+ *
+ * 'recognitionModel' should be specified to associate with this large face
+ * list. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large face list will use
+ * the recognition model that's already associated with the collection.
+ * Existing face features in a large face list can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
@@ -26,6 +58,9 @@ const WebResource = msRest.WebResource;
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -53,6 +88,7 @@ function _create(largeFaceListId, options, callback) {
}
let name = (options && options.name !== undefined) ? options.name : undefined;
let userData = (options && options.userData !== undefined) ? options.userData : undefined;
+ let recognitionModel = (options && options.recognitionModel !== undefined) ? options.recognitionModel : 'recognition_01';
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -89,14 +125,18 @@ function _create(largeFaceListId, options, callback) {
throw new Error('"userData" should satisfy the constraint - "MaxLength": 16384');
}
}
+ if (recognitionModel !== null && recognitionModel !== undefined && typeof recognitionModel.valueOf() !== 'string') {
+ throw new Error('recognitionModel must be of type string.');
+ }
} catch (error) {
return callback(error);
}
let body;
- if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined)) {
- body = new client.models['NameAndUserDataContract']();
+ if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined) || (recognitionModel !== null && recognitionModel !== undefined)) {
+ body = new client.models['MetaDataContract']();
body.name = name;
body.userData = userData;
+ body.recognitionModel = recognitionModel;
}
// Construct URL
@@ -124,7 +164,7 @@ function _create(largeFaceListId, options, callback) {
let requestModel = null;
try {
if (body !== null && body !== undefined) {
- let requestModelMapper = new client.models['NameAndUserDataContract']().mapper();
+ let requestModelMapper = new client.models['MetaDataContract']().mapper();
requestModel = client.serialize(requestModelMapper, body, 'body');
requestContent = JSON.stringify(requestModel);
}
@@ -175,12 +215,16 @@ function _create(largeFaceListId, options, callback) {
}
/**
- * Retrieve a large face list's information.
+ * Retrieve a large face list’s largeFaceListId, name, userData and
+ * recognitionModel.
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -207,6 +251,7 @@ function _get(largeFaceListId, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -225,6 +270,9 @@ function _get(largeFaceListId, options, callback) {
throw new Error('"largeFaceListId" should satisfy the constraint - "Pattern": /^[a-z0-9-_]+$/');
}
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -234,6 +282,13 @@ function _get(largeFaceListId, options, callback) {
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'largefacelists/{largeFaceListId}';
requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
requestUrl = requestUrl.replace('{largeFaceListId}', encodeURIComponent(largeFaceListId));
+ let queryParameters = [];
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
// Create HTTP transport objects
let httpRequest = new WebResource();
@@ -717,11 +772,30 @@ function _getTrainingStatus(largeFaceListId, options, callback) {
}
/**
- * Retrieve information about all existing large face lists. Only
- * largeFaceListId, name and userData will be returned.
+ * List large face lists’ information of largeFaceListId, name, userData and
+ * recognitionModel.
+ * To get face information inside largeFaceList use [LargeFaceList Face -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)
+ * * Large face lists are stored in alphabetical order of largeFaceListId.
+ * * "start" parameter (string, optional) is a user-provided largeFaceListId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person lists: "list1", ..., "list5".
+ *
"start=&top=" will return all 5 lists.
+ *
"start=&top=2" will return "list1", "list2".
+ *
"start=list2&top=3" will return "list3", "list4", "list5".
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -747,11 +821,15 @@ function _list(options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -760,6 +838,13 @@ function _list(options, callback) {
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'largefacelists';
requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ let queryParameters = [];
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
// Create HTTP transport objects
let httpRequest = new WebResource();
@@ -964,7 +1049,7 @@ function _train(largeFaceListId, options, callback) {
}
/**
- * Delete an existing face from a large face list (given by a persisitedFaceId
+ * Delete an existing face from a large face list (given by a persistedFaceId
* and a largeFaceListId). Persisted image related to the face will also be
* deleted.
*
@@ -1964,8 +2049,40 @@ class LargeFaceListOperations {
}
/**
- * Create an empty large face list. Up to 64 large face lists are allowed to
- * exist in one subscription.
+ * Create an empty large face list with user-specified largeFaceListId, name,
+ * an optional userData and recognitionModel.
+ *
Large face list is a list of faces, up to 1,000,000 faces, and used
+ * by [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [LargeFaceList Face -
+ * Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3)
+ * to import the faces and [LargeFaceList -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1)
+ * to make it ready for [Face -
+ * FindSimilar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * Faces are stored on server until [LargeFaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
+ * * Free-tier subscription quota: 64 large face lists.
+ * * S0-tier subscription quota: 1,000,000 large face lists.
+ *
+ * 'recognitionModel' should be specified to associate with this large face
+ * list. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large face list will use
+ * the recognition model that's already associated with the collection.
+ * Existing face features in a large face list can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
@@ -1976,6 +2093,9 @@ class LargeFaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2000,8 +2120,40 @@ class LargeFaceListOperations {
}
/**
- * Create an empty large face list. Up to 64 large face lists are allowed to
- * exist in one subscription.
+ * Create an empty large face list with user-specified largeFaceListId, name,
+ * an optional userData and recognitionModel.
+ *
Large face list is a list of faces, up to 1,000,000 faces, and used
+ * by [Face - Find
+ * Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ *
After creation, user should use [LargeFaceList Face -
+ * Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3)
+ * to import the faces and [LargeFaceList -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1)
+ * to make it ready for [Face -
+ * FindSimilar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
+ * Faces are stored on server until [LargeFaceList -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd)
+ * is called.
+ *
Find Similar is used for scenario like finding celebrity-like faces,
+ * similar face filtering, or as a light way face identification. But if the
+ * actual use is to identify person, please use
+ * [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
+ * /
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
+ * and [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
+ * * Free-tier subscription quota: 64 large face lists.
+ * * S0-tier subscription quota: 1,000,000 large face lists.
+ *
+ * 'recognitionModel' should be specified to associate with this large face
+ * list. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large face list will use
+ * the recognition model that's already associated with the collection.
+ * Existing face features in a large face list can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
@@ -2012,6 +2164,9 @@ class LargeFaceListOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2057,12 +2212,16 @@ class LargeFaceListOperations {
}
/**
- * Retrieve a large face list's information.
+ * Retrieve a large face list’s largeFaceListId, name, userData and
+ * recognitionModel.
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2087,12 +2246,16 @@ class LargeFaceListOperations {
}
/**
- * Retrieve a large face list's information.
+ * Retrieve a large face list’s largeFaceListId, name, userData and
+ * recognitionModel.
*
* @param {string} largeFaceListId Id referencing a particular large face list.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2395,11 +2558,30 @@ class LargeFaceListOperations {
}
/**
- * Retrieve information about all existing large face lists. Only
- * largeFaceListId, name and userData will be returned.
+ * List large face lists’ information of largeFaceListId, name, userData and
+ * recognitionModel.
+ * To get face information inside largeFaceList use [LargeFaceList Face -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)
+ * * Large face lists are stored in alphabetical order of largeFaceListId.
+ * * "start" parameter (string, optional) is a user-provided largeFaceListId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person lists: "list1", ..., "list5".
+ *
"start=&top=" will return all 5 lists.
+ *
"start=&top=2" will return "list1", "list2".
+ *
"start=list2&top=3" will return "list3", "list4", "list5".
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2424,11 +2606,30 @@ class LargeFaceListOperations {
}
/**
- * Retrieve information about all existing large face lists. Only
- * largeFaceListId, name and userData will be returned.
+ * List large face lists’ information of largeFaceListId, name, userData and
+ * recognitionModel.
+ * To get face information inside largeFaceList use [LargeFaceList Face -
+ * Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)
+ * * Large face lists are stored in alphabetical order of largeFaceListId.
+ * * "start" parameter (string, optional) is a user-provided largeFaceListId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person lists: "list1", ..., "list5".
+ *
"start=&top=" will return all 5 lists.
+ *
"start=&top=2" will return "list1", "list2".
+ *
"start=list2&top=3" will return "list3", "list4", "list5".
+ *
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -2557,7 +2758,7 @@ class LargeFaceListOperations {
}
/**
- * Delete an existing face from a large face list (given by a persisitedFaceId
+ * Delete an existing face from a large face list (given by a persistedFaceId
* and a largeFaceListId). Persisted image related to the face will also be
* deleted.
*
@@ -2592,7 +2793,7 @@ class LargeFaceListOperations {
}
/**
- * Delete an existing face from a large face list (given by a persisitedFaceId
+ * Delete an existing face from a large face list (given by a persistedFaceId
* and a largeFaceListId). Persisted image related to the face will also be
* deleted.
*
diff --git a/lib/services/cognitiveServicesFace/lib/operations/largePersonGroupOperations.js b/lib/services/cognitiveServicesFace/lib/operations/largePersonGroupOperations.js
index 9d3ce8f6f0..27c75c87e0 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/largePersonGroupOperations.js
+++ b/lib/services/cognitiveServicesFace/lib/operations/largePersonGroupOperations.js
@@ -14,8 +14,35 @@ const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
- * Create a new large person group with specified largePersonGroupId, name and
- * user-provided userData.
+ * Create a new large person group with user-specified largePersonGroupId,
+ * name, an optional userData and recognitionModel.
+ *
A large person group is the container of the uploaded person data,
+ * including face images and face recognition feature, and up to 1,000,000
+ * people.
+ *
After creation, use [LargePersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
+ * to add person into the group, and call [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person face, image, and userData will be stored on server until
+ * [LargePersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
+ * or [LargePersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 large person groups.
+ * * S0-tier subscription quota: 1,000,000 large person groups.
+ *
+ * 'recognitionModel' should be specified to associate with this large person
+ * group. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large person group will
+ * use the recognition model that's already associated with the collection.
+ * Existing face features in a large person group can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
@@ -27,6 +54,9 @@ const WebResource = msRest.WebResource;
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -54,6 +84,7 @@ function _create(largePersonGroupId, options, callback) {
}
let name = (options && options.name !== undefined) ? options.name : undefined;
let userData = (options && options.userData !== undefined) ? options.userData : undefined;
+ let recognitionModel = (options && options.recognitionModel !== undefined) ? options.recognitionModel : 'recognition_01';
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -90,14 +121,18 @@ function _create(largePersonGroupId, options, callback) {
throw new Error('"userData" should satisfy the constraint - "MaxLength": 16384');
}
}
+ if (recognitionModel !== null && recognitionModel !== undefined && typeof recognitionModel.valueOf() !== 'string') {
+ throw new Error('recognitionModel must be of type string.');
+ }
} catch (error) {
return callback(error);
}
let body;
- if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined)) {
- body = new client.models['NameAndUserDataContract']();
+ if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined) || (recognitionModel !== null && recognitionModel !== undefined)) {
+ body = new client.models['MetaDataContract']();
body.name = name;
body.userData = userData;
+ body.recognitionModel = recognitionModel;
}
// Construct URL
@@ -125,7 +160,7 @@ function _create(largePersonGroupId, options, callback) {
let requestModel = null;
try {
if (body !== null && body !== undefined) {
- let requestModelMapper = new client.models['NameAndUserDataContract']().mapper();
+ let requestModelMapper = new client.models['MetaDataContract']().mapper();
requestModel = client.serialize(requestModelMapper, body, 'body');
requestContent = JSON.stringify(requestModel);
}
@@ -293,14 +328,21 @@ function _deleteMethod(largePersonGroupId, options, callback) {
}
/**
- * Retrieve the information of a large person group, including its name and
- * userData.
+ * Retrieve the information of a large person group, including its name,
+ * userData and recognitionModel. This API returns large person group
+ * information only, use [LargePersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
+ * instead to retrieve person information under the large person group.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -327,6 +369,7 @@ function _get(largePersonGroupId, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -345,6 +388,9 @@ function _get(largePersonGroupId, options, callback) {
throw new Error('"largePersonGroupId" should satisfy the constraint - "Pattern": /^[a-z0-9-_]+$/');
}
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -354,6 +400,13 @@ function _get(largePersonGroupId, options, callback) {
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'largepersongroups/{largePersonGroupId}';
requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
requestUrl = requestUrl.replace('{largePersonGroupId}', encodeURIComponent(largePersonGroupId));
+ let queryParameters = [];
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
// Create HTTP transport objects
let httpRequest = new WebResource();
@@ -724,7 +777,22 @@ function _getTrainingStatus(largePersonGroupId, options, callback) {
}
/**
- * List large person groups and their information.
+ * List all existing large person groups’ largePersonGroupId, name, userData
+ * and recognitionModel.
+ * * Large person groups are stored in alphabetical order of
+ * largePersonGroupId.
+ * * "start" parameter (string, optional) is a user-provided largePersonGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -733,6 +801,9 @@ function _getTrainingStatus(largePersonGroupId, options, callback) {
*
* @param {number} [options.top] The number of large person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -760,6 +831,7 @@ function _list(options, callback) {
}
let start = (options && options.start !== undefined) ? options.start : undefined;
let top = (options && options.top !== undefined) ? options.top : 1000;
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -787,6 +859,9 @@ function _list(options, callback) {
throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1');
}
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -802,6 +877,9 @@ function _list(options, callback) {
if (top !== null && top !== undefined) {
queryParameters.push('top=' + encodeURIComponent(top.toString()));
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
@@ -1027,8 +1105,35 @@ class LargePersonGroupOperations {
}
/**
- * Create a new large person group with specified largePersonGroupId, name and
- * user-provided userData.
+ * Create a new large person group with user-specified largePersonGroupId,
+ * name, an optional userData and recognitionModel.
+ *
A large person group is the container of the uploaded person data,
+ * including face images and face recognition feature, and up to 1,000,000
+ * people.
+ *
After creation, use [LargePersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
+ * to add person into the group, and call [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person face, image, and userData will be stored on server until
+ * [LargePersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
+ * or [LargePersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 large person groups.
+ * * S0-tier subscription quota: 1,000,000 large person groups.
+ *
+ * 'recognitionModel' should be specified to associate with this large person
+ * group. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large person group will
+ * use the recognition model that's already associated with the collection.
+ * Existing face features in a large person group can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
@@ -1040,6 +1145,9 @@ class LargePersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1064,8 +1172,35 @@ class LargePersonGroupOperations {
}
/**
- * Create a new large person group with specified largePersonGroupId, name and
- * user-provided userData.
+ * Create a new large person group with user-specified largePersonGroupId,
+ * name, an optional userData and recognitionModel.
+ *
A large person group is the container of the uploaded person data,
+ * including face images and face recognition feature, and up to 1,000,000
+ * people.
+ *
After creation, use [LargePersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
+ * to add person into the group, and call [LargePersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person face, image, and userData will be stored on server until
+ * [LargePersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
+ * or [LargePersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 large person groups.
+ * * S0-tier subscription quota: 1,000,000 large person groups.
+ *
+ * 'recognitionModel' should be specified to associate with this large person
+ * group. The default value for 'recognitionModel' is 'recognition_01', if the
+ * latest model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing large person group will
+ * use the recognition model that's already associated with the collection.
+ * Existing face features in a large person group can't be updated to features
+ * extracted by another version of recognition model.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
@@ -1077,6 +1212,9 @@ class LargePersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1207,14 +1345,21 @@ class LargePersonGroupOperations {
}
/**
- * Retrieve the information of a large person group, including its name and
- * userData.
+ * Retrieve the information of a large person group, including its name,
+ * userData and recognitionModel. This API returns large person group
+ * information only, use [LargePersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
+ * instead to retrieve person information under the large person group.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1239,14 +1384,21 @@ class LargePersonGroupOperations {
}
/**
- * Retrieve the information of a large person group, including its name and
- * userData.
+ * Retrieve the information of a large person group, including its name,
+ * userData and recognitionModel. This API returns large person group
+ * information only, use [LargePersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
+ * instead to retrieve person information under the large person group.
+ *
*
* @param {string} largePersonGroupId Id referencing a particular large person
* group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1472,7 +1624,22 @@ class LargePersonGroupOperations {
}
/**
- * List large person groups and their information.
+ * List all existing large person groups’ largePersonGroupId, name, userData
+ * and recognitionModel.
+ * * Large person groups are stored in alphabetical order of
+ * largePersonGroupId.
+ * * "start" parameter (string, optional) is a user-provided largePersonGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -1481,6 +1648,9 @@ class LargePersonGroupOperations {
*
* @param {number} [options.top] The number of large person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1505,7 +1675,22 @@ class LargePersonGroupOperations {
}
/**
- * List large person groups and their information.
+ * List all existing large person groups’ largePersonGroupId, name, userData
+ * and recognitionModel.
+ * * Large person groups are stored in alphabetical order of
+ * largePersonGroupId.
+ * * "start" parameter (string, optional) is a user-provided largePersonGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 large person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -1514,6 +1699,9 @@ class LargePersonGroupOperations {
*
* @param {number} [options.top] The number of large person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
diff --git a/lib/services/cognitiveServicesFace/lib/operations/personGroupOperations.js b/lib/services/cognitiveServicesFace/lib/operations/personGroupOperations.js
index f71b0b8eba..070840e578 100644
--- a/lib/services/cognitiveServicesFace/lib/operations/personGroupOperations.js
+++ b/lib/services/cognitiveServicesFace/lib/operations/personGroupOperations.js
@@ -14,8 +14,38 @@ const msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
- * Create a new person group with specified personGroupId, name and
- * user-provided userData.
+ * Create a new person group with specified personGroupId, name, user-provided
+ * userData and recognitionModel.
+ *
A person group is the container of the uploaded person data,
+ * including face images and face recognition features.
+ *
After creation, use [PersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c)
+ * to add persons into the group, and then call [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person's face, image, and userData will be stored on server until
+ * [PersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d)
+ * or [PersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000
+ * persons.
+ * * S0-tier subscription quota: 1,000,000 person groups. Each holds up to
+ * 10,000 persons.
+ * * to handle larger scale face identification problem, please consider using
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
+ *
+ * 'recognitionModel' should be specified to associate with this person group.
+ * The default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing person group will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a person group can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} personGroupId Id referencing a particular person group.
*
@@ -26,6 +56,9 @@ const WebResource = msRest.WebResource;
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -53,6 +86,7 @@ function _create(personGroupId, options, callback) {
}
let name = (options && options.name !== undefined) ? options.name : undefined;
let userData = (options && options.userData !== undefined) ? options.userData : undefined;
+ let recognitionModel = (options && options.recognitionModel !== undefined) ? options.recognitionModel : 'recognition_01';
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -89,14 +123,18 @@ function _create(personGroupId, options, callback) {
throw new Error('"userData" should satisfy the constraint - "MaxLength": 16384');
}
}
+ if (recognitionModel !== null && recognitionModel !== undefined && typeof recognitionModel.valueOf() !== 'string') {
+ throw new Error('recognitionModel must be of type string.');
+ }
} catch (error) {
return callback(error);
}
let body;
- if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined)) {
- body = new client.models['NameAndUserDataContract']();
+ if ((name !== null && name !== undefined) || (userData !== null && userData !== undefined) || (recognitionModel !== null && recognitionModel !== undefined)) {
+ body = new client.models['MetaDataContract']();
body.name = name;
body.userData = userData;
+ body.recognitionModel = recognitionModel;
}
// Construct URL
@@ -124,7 +162,7 @@ function _create(personGroupId, options, callback) {
let requestModel = null;
try {
if (body !== null && body !== undefined) {
- let requestModelMapper = new client.models['NameAndUserDataContract']().mapper();
+ let requestModelMapper = new client.models['MetaDataContract']().mapper();
requestModel = client.serialize(requestModelMapper, body, 'body');
requestContent = JSON.stringify(requestModel);
}
@@ -291,12 +329,17 @@ function _deleteMethod(personGroupId, options, callback) {
}
/**
- * Retrieve the information of a person group, including its name and userData.
+ * Retrieve person group name, userData and recognitionModel. To get person
+ * information under this personGroup, use [PersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241).
*
* @param {string} personGroupId Id referencing a particular person group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -323,6 +366,7 @@ function _get(personGroupId, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -341,6 +385,9 @@ function _get(personGroupId, options, callback) {
throw new Error('"personGroupId" should satisfy the constraint - "Pattern": /^[a-z0-9-_]+$/');
}
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -350,6 +397,13 @@ function _get(personGroupId, options, callback) {
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'persongroups/{personGroupId}';
requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
requestUrl = requestUrl.replace('{personGroupId}', encodeURIComponent(personGroupId));
+ let queryParameters = [];
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
// Create HTTP transport objects
let httpRequest = new WebResource();
@@ -718,7 +772,21 @@ function _getTrainingStatus(personGroupId, options, callback) {
}
/**
- * List person groups and their information.
+ * List person groups’ personGroupId, name, userData and recognitionModel.
+ * * Person groups are stored in alphabetical order of personGroupId.
+ * * "start" parameter (string, optional) is a user-provided personGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -727,6 +795,9 @@ function _getTrainingStatus(personGroupId, options, callback) {
*
* @param {number} [options.top] The number of person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -754,6 +825,7 @@ function _list(options, callback) {
}
let start = (options && options.start !== undefined) ? options.start : undefined;
let top = (options && options.top !== undefined) ? options.top : 1000;
+ let returnRecognitionModel = (options && options.returnRecognitionModel !== undefined) ? options.returnRecognitionModel : false;
// Validate
try {
if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
@@ -781,6 +853,9 @@ function _list(options, callback) {
throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1');
}
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined && typeof returnRecognitionModel !== 'boolean') {
+ throw new Error('returnRecognitionModel must be of type boolean.');
+ }
} catch (error) {
return callback(error);
}
@@ -796,6 +871,9 @@ function _list(options, callback) {
if (top !== null && top !== undefined) {
queryParameters.push('top=' + encodeURIComponent(top.toString()));
}
+ if (returnRecognitionModel !== null && returnRecognitionModel !== undefined) {
+ queryParameters.push('returnRecognitionModel=' + encodeURIComponent(returnRecognitionModel.toString()));
+ }
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
@@ -1020,8 +1098,38 @@ class PersonGroupOperations {
}
/**
- * Create a new person group with specified personGroupId, name and
- * user-provided userData.
+ * Create a new person group with specified personGroupId, name, user-provided
+ * userData and recognitionModel.
+ *
A person group is the container of the uploaded person data,
+ * including face images and face recognition features.
+ *
After creation, use [PersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c)
+ * to add persons into the group, and then call [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person's face, image, and userData will be stored on server until
+ * [PersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d)
+ * or [PersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000
+ * persons.
+ * * S0-tier subscription quota: 1,000,000 person groups. Each holds up to
+ * 10,000 persons.
+ * * to handle larger scale face identification problem, please consider using
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
+ *
+ * 'recognitionModel' should be specified to associate with this person group.
+ * The default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing person group will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a person group can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} personGroupId Id referencing a particular person group.
*
@@ -1032,6 +1140,9 @@ class PersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1056,8 +1167,38 @@ class PersonGroupOperations {
}
/**
- * Create a new person group with specified personGroupId, name and
- * user-provided userData.
+ * Create a new person group with specified personGroupId, name, user-provided
+ * userData and recognitionModel.
+ *
A person group is the container of the uploaded person data,
+ * including face images and face recognition features.
+ *
After creation, use [PersonGroup Person -
+ * Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c)
+ * to add persons into the group, and then call [PersonGroup -
+ * Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249)
+ * to get this group ready for [Face -
+ * Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
+ *
The person's face, image, and userData will be stored on server until
+ * [PersonGroup Person -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d)
+ * or [PersonGroup -
+ * Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245)
+ * is called.
+ *
+ * * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000
+ * persons.
+ * * S0-tier subscription quota: 1,000,000 person groups. Each holds up to
+ * 10,000 persons.
+ * * to handle larger scale face identification problem, please consider using
+ * [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d).
+ *
+ * 'recognitionModel' should be specified to associate with this person group.
+ * The default value for 'recognitionModel' is 'recognition_01', if the latest
+ * model needed, please explicitly specify the model you need in this
+ * parameter. New faces that are added to an existing person group will use the
+ * recognition model that's already associated with the collection. Existing
+ * face features in a person group can't be updated to features extracted by
+ * another version of recognition model.
+ *
*
* @param {string} personGroupId Id referencing a particular person group.
*
@@ -1068,6 +1209,9 @@ class PersonGroupOperations {
* @param {string} [options.userData] User specified data. Length should not
* exceed 16KB.
*
+ * @param {string} [options.recognitionModel] Possible values include:
+ * 'recognition_01', 'recognition_02'
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1196,12 +1340,17 @@ class PersonGroupOperations {
}
/**
- * Retrieve the information of a person group, including its name and userData.
+ * Retrieve person group name, userData and recognitionModel. To get person
+ * information under this personGroup, use [PersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241).
*
* @param {string} personGroupId Id referencing a particular person group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1226,12 +1375,17 @@ class PersonGroupOperations {
}
/**
- * Retrieve the information of a person group, including its name and userData.
+ * Retrieve person group name, userData and recognitionModel. To get person
+ * information under this personGroup, use [PersonGroup Person -
+ * List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241).
*
* @param {string} personGroupId Id referencing a particular person group.
*
* @param {object} [options] Optional Parameters.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1453,7 +1607,21 @@ class PersonGroupOperations {
}
/**
- * List person groups and their information.
+ * List person groups’ personGroupId, name, userData and recognitionModel.
+ * * Person groups are stored in alphabetical order of personGroupId.
+ * * "start" parameter (string, optional) is a user-provided personGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -1462,6 +1630,9 @@ class PersonGroupOperations {
*
* @param {number} [options.top] The number of person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@@ -1486,7 +1657,21 @@ class PersonGroupOperations {
}
/**
- * List person groups and their information.
+ * List person groups’ personGroupId, name, userData and recognitionModel.
+ * * Person groups are stored in alphabetical order of personGroupId.
+ * * "start" parameter (string, optional) is a user-provided personGroupId
+ * value that returned entries have larger ids by string comparison. "start"
+ * set to empty to indicate return from the first item.
+ * * "top" parameter (int, optional) specifies the number of entries to return.
+ * A maximal of 1000 entries can be returned in one call. To fetch more, you
+ * can specify "start" with the last returned entry’s Id of the current call.
+ *
+ * For example, total 5 person groups: "group1", ..., "group5".
+ *
"start=&top=" will return all 5 groups.
+ *
"start=&top=2" will return "group1", "group2".
+ *
"start=group2&top=3" will return "group3", "group4", "group5".
+ *
*
* @param {object} [options] Optional Parameters.
*
@@ -1495,6 +1680,9 @@ class PersonGroupOperations {
*
* @param {number} [options.top] The number of person groups to list.
*
+ * @param {boolean} [options.returnRecognitionModel] A value indicating whether
+ * the operation should return 'recognitionModel' in response.
+ *
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
diff --git a/lib/services/cognitiveServicesFace/lib/operations/snapshotOperations.js b/lib/services/cognitiveServicesFace/lib/operations/snapshotOperations.js
new file mode 100644
index 0000000000..a117c6bbdc
--- /dev/null
+++ b/lib/services/cognitiveServicesFace/lib/operations/snapshotOperations.js
@@ -0,0 +1,1910 @@
+/*
+ * 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';
+
+const msRest = require('ms-rest');
+const WebResource = msRest.WebResource;
+
+/**
+ * Submit an operation to take a snapshot of face list, large face list, person
+ * group or large person group, with user-specified snapshot type, source
+ * object id, apply scope and an optional user data.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Taking snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of creating the snapshot.
+ * The snapshot id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the
+ * source object. It could be in seconds, or up to several hours for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. User can delete the snapshot using Snapshot -
+ * Delete by themselves any time before expiration.
+ * Taking snapshot for a certain object will not block any other operations
+ * against the object. All read-only operations (Get/List and
+ * Identify/FindSimilar/Verify) can be conducted as usual. For all writable
+ * operations, including Add/Update/Delete the source object or its
+ * persons/faces and Train, they are not blocked but not recommended because
+ * writable updates may not be reflected on the snapshot during its taking.
+ * After snapshot taking is completed, all readable and writable operations can
+ * work as normal. Snapshot will also include the training results of the
+ * source object, which means target subscription the snapshot applied to does
+ * not need re-train the target object before calling Identify/FindSimilar.
+ * * Free-tier subscription quota: 100 take operations per month.
+ * * S0-tier subscription quota: 100 take operations per day.
+ *
+ * @param {string} type User specified type for the source object to take
+ * snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {string} objectId User specified source object id to take snapshot
+ * from.
+ *
+ * @param {array} applyScope User specified array of target Face subscription
+ * ids for the snapshot. For each snapshot, only subscriptions included in the
+ * applyScope of Snapshot - Take can apply it.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _take(type, objectId, applyScope, options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ let userData = (options && options.userData !== undefined) ? options.userData : undefined;
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (type) {
+ let allowedValues = [ 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' ];
+ if (!allowedValues.some( function(item) { return item === type; })) {
+ throw new Error(type + ' is not a valid value. The valid values are: ' + allowedValues);
+ }
+ } else {
+ throw new Error('type cannot be null or undefined.');
+ }
+ if (objectId === null || objectId === undefined || typeof objectId.valueOf() !== 'string') {
+ throw new Error('objectId cannot be null or undefined and it must be of type string.');
+ }
+ if (objectId !== null && objectId !== undefined) {
+ if (objectId.length > 64)
+ {
+ throw new Error('"objectId" should satisfy the constraint - "MaxLength": 64');
+ }
+ if (objectId.match(/^[a-z0-9-_]+$/) === null)
+ {
+ throw new Error('"objectId" should satisfy the constraint - "Pattern": /^[a-z0-9-_]+$/');
+ }
+ }
+ if (!Array.isArray(applyScope)) {
+ throw new Error('applyScope cannot be null or undefined and it must be of type array.');
+ }
+ for (let i = 0; i < applyScope.length; i++) {
+ if (applyScope[i] !== null && applyScope[i] !== undefined && !(typeof applyScope[i].valueOf() === 'string' && msRest.isValidUuid(applyScope[i]))) {
+ throw new Error('applyScope[i] must be of type string and must be a valid uuid.');
+ }
+ }
+ if (userData !== null && userData !== undefined && typeof userData.valueOf() !== 'string') {
+ throw new Error('userData must be of type string.');
+ }
+ if (userData !== null && userData !== undefined) {
+ if (userData.length > 16384)
+ {
+ throw new Error('"userData" should satisfy the constraint - "MaxLength": 16384');
+ }
+ }
+ } catch (error) {
+ return callback(error);
+ }
+ let body;
+ if ((type !== null && type !== undefined) || (objectId !== null && objectId !== undefined) || (applyScope !== null && applyScope !== undefined) || (userData !== null && userData !== undefined)) {
+ body = new client.models['TakeSnapshotRequest']();
+ body.type = type;
+ body.objectId = objectId;
+ body.applyScope = applyScope;
+ body.userData = userData;
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'snapshots';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'POST';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ // Serialize Request
+ let requestContent = null;
+ let requestModel = null;
+ try {
+ if (body !== null && body !== undefined) {
+ let requestModelMapper = new client.models['TakeSnapshotRequest']().mapper();
+ requestModel = client.serialize(requestModelMapper, body, 'body');
+ requestContent = JSON.stringify(requestModel);
+ }
+ } catch (error) {
+ let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
+ `payload - ${JSON.stringify(body, null, 2)}.`);
+ return callback(serializationError);
+ }
+ httpRequest.body = requestContent;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 202) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/**
+ * List all accessible snapshots with related information, including snapshots
+ * that were taken by the user, or snapshots to be applied to the user
+ * (subscription id was included in the applyScope in Snapshot - Take).
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.type] User specified object type as a search
+ * filter. Possible values include: 'FaceList', 'LargeFaceList',
+ * 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {array} [options.applyScope] User specified snapshot apply scopes as
+ * a search filter. ApplyScope is an array of the target Azure subscription ids
+ * for the snapshot, specified by the user who created the snapshot by Snapshot
+ * - Take.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {array} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _list(options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ let type = (options && options.type !== undefined) ? options.type : undefined;
+ let applyScope = (options && options.applyScope !== undefined) ? options.applyScope : undefined;
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (type) {
+ let allowedValues = [ 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' ];
+ if (!allowedValues.some( function(item) { return item === type; })) {
+ throw new Error(type + ' is not a valid value. The valid values are: ' + allowedValues);
+ }
+ }
+ if (Array.isArray(applyScope)) {
+ for (let i = 0; i < applyScope.length; i++) {
+ if (applyScope[i] !== null && applyScope[i] !== undefined && !(typeof applyScope[i].valueOf() === 'string' && msRest.isValidUuid(applyScope[i]))) {
+ throw new Error('applyScope[i] must be of type string and must be a valid uuid.');
+ }
+ }
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'snapshots';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ let queryParameters = [];
+ if (type !== null && type !== undefined) {
+ queryParameters.push('type=' + encodeURIComponent(type));
+ }
+ if (applyScope !== null && applyScope !== undefined) {
+ queryParameters.push('applyScope=' + encodeURIComponent(applyScope.join(',')));
+ }
+ if (queryParameters.length > 0) {
+ requestUrl += '?' + queryParameters.join('&');
+ }
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'GET';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.body = null;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+ // Deserialize Response
+ if (statusCode === 200) {
+ let parsedResponse = null;
+ try {
+ parsedResponse = JSON.parse(responseBody);
+ result = JSON.parse(responseBody);
+ if (parsedResponse !== null && parsedResponse !== undefined) {
+ let resultMapper = {
+ required: false,
+ serializedName: 'parsedResponse',
+ type: {
+ name: 'Sequence',
+ element: {
+ required: false,
+ serializedName: 'SnapshotElementType',
+ type: {
+ name: 'Composite',
+ className: 'Snapshot'
+ }
+ }
+ }
+ };
+ result = client.deserialize(resultMapper, parsedResponse, 'result');
+ }
+ } catch (error) {
+ let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
+ deserializationError.request = msRest.stripRequest(httpRequest);
+ deserializationError.response = msRest.stripResponse(response);
+ return callback(deserializationError);
+ }
+ }
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/**
+ * Retrieve information about a snapshot. Snapshot is only accessible to the
+ * source subscription who took it, and target subscriptions included in the
+ * applyScope in Snapshot - Take.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {object} [result] - The deserialized result object if an error did not occur.
+ * See {@link Snapshot} for more information.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _get(snapshotId, options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (snapshotId === null || snapshotId === undefined || typeof snapshotId.valueOf() !== 'string' || !msRest.isValidUuid(snapshotId)) {
+ throw new Error('snapshotId cannot be null or undefined and it must be of type string and must be a valid uuid.');
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'snapshots/{snapshotId}';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ requestUrl = requestUrl.replace('{snapshotId}', encodeURIComponent(snapshotId.toString()));
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'GET';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.body = null;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+ // Deserialize Response
+ if (statusCode === 200) {
+ let parsedResponse = null;
+ try {
+ parsedResponse = JSON.parse(responseBody);
+ result = JSON.parse(responseBody);
+ if (parsedResponse !== null && parsedResponse !== undefined) {
+ let resultMapper = new client.models['Snapshot']().mapper();
+ result = client.deserialize(resultMapper, parsedResponse, 'result');
+ }
+ } catch (error) {
+ let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
+ deserializationError.request = msRest.stripRequest(httpRequest);
+ deserializationError.response = msRest.stripResponse(response);
+ return callback(deserializationError);
+ }
+ }
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/**
+ * Update the information of a snapshot. Only the source subscription who took
+ * the snapshot can update the snapshot.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {array} [options.applyScope] Array of the target Face subscription
+ * ids for the snapshot, specified by the user who created the snapshot when
+ * calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _update(snapshotId, options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ let applyScope = (options && options.applyScope !== undefined) ? options.applyScope : undefined;
+ let userData = (options && options.userData !== undefined) ? options.userData : undefined;
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (snapshotId === null || snapshotId === undefined || typeof snapshotId.valueOf() !== 'string' || !msRest.isValidUuid(snapshotId)) {
+ throw new Error('snapshotId cannot be null or undefined and it must be of type string and must be a valid uuid.');
+ }
+ if (Array.isArray(applyScope)) {
+ for (let i = 0; i < applyScope.length; i++) {
+ if (applyScope[i] !== null && applyScope[i] !== undefined && !(typeof applyScope[i].valueOf() === 'string' && msRest.isValidUuid(applyScope[i]))) {
+ throw new Error('applyScope[i] must be of type string and must be a valid uuid.');
+ }
+ }
+ }
+ if (userData !== null && userData !== undefined && typeof userData.valueOf() !== 'string') {
+ throw new Error('userData must be of type string.');
+ }
+ if (userData !== null && userData !== undefined) {
+ if (userData.length > 16384)
+ {
+ throw new Error('"userData" should satisfy the constraint - "MaxLength": 16384');
+ }
+ }
+ } catch (error) {
+ return callback(error);
+ }
+ let body;
+ if ((applyScope !== null && applyScope !== undefined) || (userData !== null && userData !== undefined)) {
+ body = new client.models['UpdateSnapshotRequest']();
+ body.applyScope = applyScope;
+ body.userData = userData;
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'snapshots/{snapshotId}';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ requestUrl = requestUrl.replace('{snapshotId}', encodeURIComponent(snapshotId.toString()));
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'PATCH';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ // Serialize Request
+ let requestContent = null;
+ let requestModel = null;
+ try {
+ if (body !== null && body !== undefined) {
+ let requestModelMapper = new client.models['UpdateSnapshotRequest']().mapper();
+ requestModel = client.serialize(requestModelMapper, body, 'body');
+ requestContent = JSON.stringify(requestModel);
+ }
+ } catch (error) {
+ let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
+ `payload - ${JSON.stringify(body, null, 2)}.`);
+ return callback(serializationError);
+ }
+ httpRequest.body = requestContent;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/**
+ * Delete an existing snapshot according to the snapshotId. All object data and
+ * information in the snapshot will also be deleted. Only the source
+ * subscription who took the snapshot can delete the snapshot. If the user does
+ * not delete a snapshot with this API, the snapshot will still be
+ * automatically deleted in 48 hours after creation.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _deleteMethod(snapshotId, options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (snapshotId === null || snapshotId === undefined || typeof snapshotId.valueOf() !== 'string' || !msRest.isValidUuid(snapshotId)) {
+ throw new Error('snapshotId cannot be null or undefined and it must be of type string and must be a valid uuid.');
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'snapshots/{snapshotId}';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ requestUrl = requestUrl.replace('{snapshotId}', encodeURIComponent(snapshotId.toString()));
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'DELETE';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.body = null;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/**
+ * Submit an operation to apply a snapshot to current subscription. For each
+ * snapshot, only subscriptions included in the applyScope of Snapshot - Take
+ * can apply it.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Applying snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of applying the snapshot.
+ * The target object id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in
+ * the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. So the target subscription is required to apply
+ * the snapshot in 48 hours since its creation.
+ * Applying a snapshot will not block any other operations against the target
+ * object, however it is not recommended because the correctness cannot be
+ * guaranteed during snapshot applying. After snapshot applying is completed,
+ * all operations towards the target object can work as normal. Snapshot also
+ * includes the training results of the source object, which means target
+ * subscription the snapshot applied to does not need re-train the target
+ * object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only
+ * CreateNew apply mode 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.
+ * * Free-tier subscription quota: 100 apply operations per month.
+ * * S0-tier subscription quota: 100 apply operations per day.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {string} objectId User specified target object id to be created from
+ * the snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.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'
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _apply(snapshotId, objectId, options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ let mode = (options && options.mode !== undefined) ? options.mode : 'CreateNew';
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (snapshotId === null || snapshotId === undefined || typeof snapshotId.valueOf() !== 'string' || !msRest.isValidUuid(snapshotId)) {
+ throw new Error('snapshotId cannot be null or undefined and it must be of type string and must be a valid uuid.');
+ }
+ if (objectId === null || objectId === undefined || typeof objectId.valueOf() !== 'string') {
+ throw new Error('objectId cannot be null or undefined and it must be of type string.');
+ }
+ if (objectId !== null && objectId !== undefined) {
+ if (objectId.length > 64)
+ {
+ throw new Error('"objectId" should satisfy the constraint - "MaxLength": 64');
+ }
+ if (objectId.match(/^[a-z0-9-_]+$/) === null)
+ {
+ throw new Error('"objectId" should satisfy the constraint - "Pattern": /^[a-z0-9-_]+$/');
+ }
+ }
+ if (mode) {
+ let allowedValues = [ 'CreateNew' ];
+ if (!allowedValues.some( function(item) { return item === mode; })) {
+ throw new Error(mode + ' is not a valid value. The valid values are: ' + allowedValues);
+ }
+ }
+ } catch (error) {
+ return callback(error);
+ }
+ let body;
+ if ((objectId !== null && objectId !== undefined) || (mode !== null && mode !== undefined)) {
+ body = new client.models['ApplySnapshotRequest']();
+ body.objectId = objectId;
+ body.mode = mode;
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'snapshots/{snapshotId}/apply';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ requestUrl = requestUrl.replace('{snapshotId}', encodeURIComponent(snapshotId.toString()));
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'POST';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ // Serialize Request
+ let requestContent = null;
+ let requestModel = null;
+ try {
+ if (body !== null && body !== undefined) {
+ let requestModelMapper = new client.models['ApplySnapshotRequest']().mapper();
+ requestModel = client.serialize(requestModelMapper, body, 'body');
+ requestContent = JSON.stringify(requestModel);
+ }
+ } catch (error) {
+ let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` +
+ `payload - ${JSON.stringify(body, null, 2)}.`);
+ return callback(serializationError);
+ }
+ httpRequest.body = requestContent;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 202) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/**
+ * Retrieve the status of a take/apply snapshot operation.
+ *
+ * @param {uuid} operationId Id referencing a particular take/apply snapshot
+ * operation.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} callback - The callback.
+ *
+ * @returns {function} callback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {object} [result] - The deserialized result object if an error did not occur.
+ * See {@link OperationStatus} for more information.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+function _getOperationStatus(operationId, options, callback) {
+ /* jshint validthis: true */
+ let client = this.client;
+ if(!callback && typeof options === 'function') {
+ callback = options;
+ options = null;
+ }
+ if (!callback) {
+ throw new Error('callback cannot be null.');
+ }
+ // Validate
+ try {
+ if (this.client.endpoint === null || this.client.endpoint === undefined || typeof this.client.endpoint.valueOf() !== 'string') {
+ throw new Error('this.client.endpoint cannot be null or undefined and it must be of type string.');
+ }
+ if (operationId === null || operationId === undefined || typeof operationId.valueOf() !== 'string' || !msRest.isValidUuid(operationId)) {
+ throw new Error('operationId cannot be null or undefined and it must be of type string and must be a valid uuid.');
+ }
+ } catch (error) {
+ return callback(error);
+ }
+
+ // Construct URL
+ let baseUrl = this.client.baseUri;
+ let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'operations/{operationId}';
+ requestUrl = requestUrl.replace('{Endpoint}', this.client.endpoint);
+ requestUrl = requestUrl.replace('{operationId}', encodeURIComponent(operationId.toString()));
+
+ // Create HTTP transport objects
+ let httpRequest = new WebResource();
+ httpRequest.method = 'GET';
+ httpRequest.url = requestUrl;
+ httpRequest.headers = {};
+ // Set Headers
+ httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
+ if(options) {
+ for(let headerName in options['customHeaders']) {
+ if (options['customHeaders'].hasOwnProperty(headerName)) {
+ httpRequest.headers[headerName] = options['customHeaders'][headerName];
+ }
+ }
+ }
+ httpRequest.body = null;
+ // Send Request
+ return client.pipeline(httpRequest, (err, response, responseBody) => {
+ if (err) {
+ return callback(err);
+ }
+ let statusCode = response.statusCode;
+ if (statusCode !== 200) {
+ let error = new Error(responseBody);
+ error.statusCode = response.statusCode;
+ error.request = msRest.stripRequest(httpRequest);
+ error.response = msRest.stripResponse(response);
+ if (responseBody === '') responseBody = null;
+ let parsedErrorResponse;
+ try {
+ parsedErrorResponse = JSON.parse(responseBody);
+ if (parsedErrorResponse) {
+ let internalError = null;
+ if (parsedErrorResponse.error) internalError = parsedErrorResponse.error;
+ error.code = internalError ? internalError.code : parsedErrorResponse.code;
+ error.message = internalError ? internalError.message : parsedErrorResponse.message;
+ }
+ if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) {
+ let resultMapper = new client.models['APIError']().mapper();
+ error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body');
+ }
+ } catch (defaultError) {
+ error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` +
+ `- "${responseBody}" for the default response.`;
+ return callback(error);
+ }
+ return callback(error);
+ }
+ // Create Result
+ let result = null;
+ if (responseBody === '') responseBody = null;
+ // Deserialize Response
+ if (statusCode === 200) {
+ let parsedResponse = null;
+ try {
+ parsedResponse = JSON.parse(responseBody);
+ result = JSON.parse(responseBody);
+ if (parsedResponse !== null && parsedResponse !== undefined) {
+ let resultMapper = new client.models['OperationStatus']().mapper();
+ result = client.deserialize(resultMapper, parsedResponse, 'result');
+ }
+ } catch (error) {
+ let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
+ deserializationError.request = msRest.stripRequest(httpRequest);
+ deserializationError.response = msRest.stripResponse(response);
+ return callback(deserializationError);
+ }
+ }
+
+ return callback(null, result, httpRequest, response);
+ });
+}
+
+/** Class representing a SnapshotOperations. */
+class SnapshotOperations {
+ /**
+ * Create a SnapshotOperations.
+ * @param {FaceClient} client Reference to the service client.
+ */
+ constructor(client) {
+ this.client = client;
+ this._take = _take;
+ this._list = _list;
+ this._get = _get;
+ this._update = _update;
+ this._deleteMethod = _deleteMethod;
+ this._apply = _apply;
+ this._getOperationStatus = _getOperationStatus;
+ }
+
+ /**
+ * Submit an operation to take a snapshot of face list, large face list, person
+ * group or large person group, with user-specified snapshot type, source
+ * object id, apply scope and an optional user data.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Taking snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of creating the snapshot.
+ * The snapshot id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the
+ * source object. It could be in seconds, or up to several hours for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. User can delete the snapshot using Snapshot -
+ * Delete by themselves any time before expiration.
+ * Taking snapshot for a certain object will not block any other operations
+ * against the object. All read-only operations (Get/List and
+ * Identify/FindSimilar/Verify) can be conducted as usual. For all writable
+ * operations, including Add/Update/Delete the source object or its
+ * persons/faces and Train, they are not blocked but not recommended because
+ * writable updates may not be reflected on the snapshot during its taking.
+ * After snapshot taking is completed, all readable and writable operations can
+ * work as normal. Snapshot will also include the training results of the
+ * source object, which means target subscription the snapshot applied to does
+ * not need re-train the target object before calling Identify/FindSimilar.
+ * * Free-tier subscription quota: 100 take operations per month.
+ * * S0-tier subscription quota: 100 take operations per day.
+ *
+ * @param {string} type User specified type for the source object to take
+ * snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {string} objectId User specified source object id to take snapshot
+ * from.
+ *
+ * @param {array} applyScope User specified array of target Face subscription
+ * ids for the snapshot. For each snapshot, only subscriptions included in the
+ * applyScope of Snapshot - Take can apply it.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ takeWithHttpOperationResponse(type, objectId, applyScope, options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._take(type, objectId, applyScope, options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * Submit an operation to take a snapshot of face list, large face list, person
+ * group or large person group, with user-specified snapshot type, source
+ * object id, apply scope and an optional user data.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Taking snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of creating the snapshot.
+ * The snapshot id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot taking time depends on the number of person and face entries in the
+ * source object. It could be in seconds, or up to several hours for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. User can delete the snapshot using Snapshot -
+ * Delete by themselves any time before expiration.
+ * Taking snapshot for a certain object will not block any other operations
+ * against the object. All read-only operations (Get/List and
+ * Identify/FindSimilar/Verify) can be conducted as usual. For all writable
+ * operations, including Add/Update/Delete the source object or its
+ * persons/faces and Train, they are not blocked but not recommended because
+ * writable updates may not be reflected on the snapshot during its taking.
+ * After snapshot taking is completed, all readable and writable operations can
+ * work as normal. Snapshot will also include the training results of the
+ * source object, which means target subscription the snapshot applied to does
+ * not need re-train the target object before calling Identify/FindSimilar.
+ * * Free-tier subscription quota: 100 take operations per month.
+ * * S0-tier subscription quota: 100 take operations per day.
+ *
+ * @param {string} type User specified type for the source object to take
+ * snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
+ * LargePersonGroup are supported. Possible values include: 'FaceList',
+ * 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {string} objectId User specified source object id to take snapshot
+ * from.
+ *
+ * @param {array} applyScope User specified array of target Face subscription
+ * ids for the snapshot. For each snapshot, only subscriptions included in the
+ * applyScope of Snapshot - Take can apply it.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ take(type, objectId, applyScope, options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._take(type, objectId, applyScope, options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._take(type, objectId, applyScope, options, optionalCallback);
+ }
+ }
+
+ /**
+ * List all accessible snapshots with related information, including snapshots
+ * that were taken by the user, or snapshots to be applied to the user
+ * (subscription id was included in the applyScope in Snapshot - Take).
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.type] User specified object type as a search
+ * filter. Possible values include: 'FaceList', 'LargeFaceList',
+ * 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {array} [options.applyScope] User specified snapshot apply scopes as
+ * a search filter. ApplyScope is an array of the target Azure subscription ids
+ * for the snapshot, specified by the user who created the snapshot by Snapshot
+ * - Take.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ listWithHttpOperationResponse(options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._list(options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * List all accessible snapshots with related information, including snapshots
+ * that were taken by the user, or snapshots to be applied to the user
+ * (subscription id was included in the applyScope in Snapshot - Take).
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.type] User specified object type as a search
+ * filter. Possible values include: 'FaceList', 'LargeFaceList',
+ * 'LargePersonGroup', 'PersonGroup'
+ *
+ * @param {array} [options.applyScope] User specified snapshot apply scopes as
+ * a search filter. ApplyScope is an array of the target Azure subscription ids
+ * for the snapshot, specified by the user who created the snapshot by Snapshot
+ * - Take.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {Array} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {array} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ list(options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._list(options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._list(options, optionalCallback);
+ }
+ }
+
+ /**
+ * Retrieve information about a snapshot. Snapshot is only accessible to the
+ * source subscription who took it, and target subscriptions included in the
+ * applyScope in Snapshot - Take.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ getWithHttpOperationResponse(snapshotId, options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._get(snapshotId, options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * Retrieve information about a snapshot. Snapshot is only accessible to the
+ * source subscription who took it, and target subscriptions included in the
+ * applyScope in Snapshot - Take.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {Snapshot} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {object} [result] - The deserialized result object if an error did not occur.
+ * See {@link Snapshot} for more information.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ get(snapshotId, options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._get(snapshotId, options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._get(snapshotId, options, optionalCallback);
+ }
+ }
+
+ /**
+ * Update the information of a snapshot. Only the source subscription who took
+ * the snapshot can update the snapshot.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {array} [options.applyScope] Array of the target Face subscription
+ * ids for the snapshot, specified by the user who created the snapshot when
+ * calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ updateWithHttpOperationResponse(snapshotId, options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._update(snapshotId, options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * Update the information of a snapshot. Only the source subscription who took
+ * the snapshot can update the snapshot.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {array} [options.applyScope] Array of the target Face subscription
+ * ids for the snapshot, specified by the user who created the snapshot when
+ * calling Snapshot - Take. For each snapshot, only subscriptions included in
+ * the applyScope of Snapshot - Take can apply it.
+ *
+ * @param {string} [options.userData] User specified data about the snapshot
+ * for any purpose. Length should not exceed 16KB.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ update(snapshotId, options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._update(snapshotId, options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._update(snapshotId, options, optionalCallback);
+ }
+ }
+
+ /**
+ * Delete an existing snapshot according to the snapshotId. All object data and
+ * information in the snapshot will also be deleted. Only the source
+ * subscription who took the snapshot can delete the snapshot. If the user does
+ * not delete a snapshot with this API, the snapshot will still be
+ * automatically deleted in 48 hours after creation.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ deleteMethodWithHttpOperationResponse(snapshotId, options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._deleteMethod(snapshotId, options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * Delete an existing snapshot according to the snapshotId. All object data and
+ * information in the snapshot will also be deleted. Only the source
+ * subscription who took the snapshot can delete the snapshot. If the user does
+ * not delete a snapshot with this API, the snapshot will still be
+ * automatically deleted in 48 hours after creation.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ deleteMethod(snapshotId, options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._deleteMethod(snapshotId, options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._deleteMethod(snapshotId, options, optionalCallback);
+ }
+ }
+
+ /**
+ * Submit an operation to apply a snapshot to current subscription. For each
+ * snapshot, only subscriptions included in the applyScope of Snapshot - Take
+ * can apply it.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Applying snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of applying the snapshot.
+ * The target object id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in
+ * the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. So the target subscription is required to apply
+ * the snapshot in 48 hours since its creation.
+ * Applying a snapshot will not block any other operations against the target
+ * object, however it is not recommended because the correctness cannot be
+ * guaranteed during snapshot applying. After snapshot applying is completed,
+ * all operations towards the target object can work as normal. Snapshot also
+ * includes the training results of the source object, which means target
+ * subscription the snapshot applied to does not need re-train the target
+ * object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only
+ * CreateNew apply mode 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.
+ * * Free-tier subscription quota: 100 apply operations per month.
+ * * S0-tier subscription quota: 100 apply operations per day.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {string} objectId User specified target object id to be created from
+ * the snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.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'
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ applyWithHttpOperationResponse(snapshotId, objectId, options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._apply(snapshotId, objectId, options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * Submit an operation to apply a snapshot to current subscription. For each
+ * snapshot, only subscriptions included in the applyScope of Snapshot - Take
+ * can apply it.
+ * The snapshot interfaces are for users to backup and restore their face data
+ * from one face subscription to another, inside same region or across regions.
+ * The workflow contains two phases, user first calls Snapshot - Take to create
+ * a copy of the source object and store it as a snapshot, then calls Snapshot
+ * - Apply to paste the snapshot to target subscription. The snapshots are
+ * stored in a centralized location (per Azure instance), so that they can be
+ * applied cross accounts and regions.
+ * Applying snapshot is an asynchronous operation. An operation id can be
+ * obtained from the "Operation-Location" field in response header, to be used
+ * in OperationStatus - Get for tracking the progress of applying the snapshot.
+ * The target object id will be included in the "resourceLocation" field in
+ * OperationStatus - Get response when the operation status is "succeeded".
+ * Snapshot applying time depends on the number of person and face entries in
+ * the snapshot object. It could be in seconds, or up to 1 hour for 1,000,000
+ * persons with multiple faces.
+ * Snapshots will be automatically expired and cleaned in 48 hours after it is
+ * created by Snapshot - Take. So the target subscription is required to apply
+ * the snapshot in 48 hours since its creation.
+ * Applying a snapshot will not block any other operations against the target
+ * object, however it is not recommended because the correctness cannot be
+ * guaranteed during snapshot applying. After snapshot applying is completed,
+ * all operations towards the target object can work as normal. Snapshot also
+ * includes the training results of the source object, which means target
+ * subscription the snapshot applied to does not need re-train the target
+ * object before calling Identify/FindSimilar.
+ * One snapshot can be applied multiple times in parallel, while currently only
+ * CreateNew apply mode 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.
+ * * Free-tier subscription quota: 100 apply operations per month.
+ * * S0-tier subscription quota: 100 apply operations per day.
+ *
+ * @param {uuid} snapshotId Id referencing a particular snapshot.
+ *
+ * @param {string} objectId User specified target object id to be created from
+ * the snapshot.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {string} [options.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'
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {null} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {null} [result] - The deserialized result object if an error did not occur.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ apply(snapshotId, objectId, options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._apply(snapshotId, objectId, options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._apply(snapshotId, objectId, options, optionalCallback);
+ }
+ }
+
+ /**
+ * Retrieve the status of a take/apply snapshot operation.
+ *
+ * @param {uuid} operationId Id referencing a particular take/apply snapshot
+ * operation.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @returns {Promise} A promise is returned
+ *
+ * @resolve {HttpOperationResponse} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ */
+ getOperationStatusWithHttpOperationResponse(operationId, options) {
+ let client = this.client;
+ let self = this;
+ return new Promise((resolve, reject) => {
+ self._getOperationStatus(operationId, options, (err, result, request, response) => {
+ let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
+ httpOperationResponse.body = result;
+ if (err) { reject(err); }
+ else { resolve(httpOperationResponse); }
+ return;
+ });
+ });
+ }
+
+ /**
+ * Retrieve the status of a take/apply snapshot operation.
+ *
+ * @param {uuid} operationId Id referencing a particular take/apply snapshot
+ * operation.
+ *
+ * @param {object} [options] Optional Parameters.
+ *
+ * @param {object} [options.customHeaders] Headers that will be added to the
+ * request
+ *
+ * @param {function} [optionalCallback] - The optional callback.
+ *
+ * @returns {function|Promise} If a callback was passed as the last parameter
+ * then it returns the callback else returns a Promise.
+ *
+ * {Promise} A promise is returned
+ *
+ * @resolve {OperationStatus} - The deserialized result object.
+ *
+ * @reject {Error} - The error object.
+ *
+ * {function} optionalCallback(err, result, request, response)
+ *
+ * {Error} err - The Error object if an error occurred, null otherwise.
+ *
+ * {object} [result] - The deserialized result object if an error did not occur.
+ * See {@link OperationStatus} for more information.
+ *
+ * {object} [request] - The HTTP Request object if an error did not occur.
+ *
+ * {stream} [response] - The HTTP Response stream if an error did not occur.
+ */
+ getOperationStatus(operationId, options, optionalCallback) {
+ let client = this.client;
+ let self = this;
+ if (!optionalCallback && typeof options === 'function') {
+ optionalCallback = options;
+ options = null;
+ }
+ if (!optionalCallback) {
+ return new Promise((resolve, reject) => {
+ self._getOperationStatus(operationId, options, (err, result, request, response) => {
+ if (err) { reject(err); }
+ else { resolve(result); }
+ return;
+ });
+ });
+ } else {
+ return self._getOperationStatus(operationId, options, optionalCallback);
+ }
+ }
+
+}
+
+module.exports = SnapshotOperations;
diff --git a/lib/services/cognitiveServicesFace/package.json b/lib/services/cognitiveServicesFace/package.json
index 2912fbfc61..4ba6535f6a 100644
--- a/lib/services/cognitiveServicesFace/package.json
+++ b/lib/services/cognitiveServicesFace/package.json
@@ -2,9 +2,9 @@
"name": "azure-cognitiveservices-face",
"author": "Microsoft Corporation",
"description": "FaceClient Library with typescript type definitions for node",
- "version": "2.2.0-preview",
+ "version": "3.0.0",
"dependencies": {
- "ms-rest": "^2.3.3"
+ "ms-rest": "^2.5.0"
},
"keywords": [
"node",
@@ -20,5 +20,8 @@
},
"bugs": {
"url": "https://github.com/azure/azure-sdk-for-node/issues"
+ },
+ "scripts": {
+ "postinstall": "node .scripts/postinstall.js"
}
}