diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/faceClient.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/faceClient.ts new file mode 100644 index 000000000000..2946bdab6e36 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/faceClient.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { FaceClientContext } from "./faceClientContext"; + +class FaceClient extends FaceClientContext { + // Operation groups + face: operations.Face; + personGroupPerson: operations.PersonGroupPerson; + personGroup: operations.PersonGroupOperations; + faceList: operations.FaceListOperations; + largePersonGroupPerson: operations.LargePersonGroupPerson; + largePersonGroup: operations.LargePersonGroupOperations; + largeFaceList: operations.LargeFaceListOperations; + snapshot: operations.SnapshotOperations; + + /** + * Initializes a new instance of the FaceClient class. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param [options] The parameter options + */ + constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: Models.FaceClientOptions) { + super(endpoint, credentials, options); + this.face = new operations.Face(this); + this.personGroupPerson = new operations.PersonGroupPerson(this); + this.personGroup = new operations.PersonGroupOperations(this); + this.faceList = new operations.FaceListOperations(this); + this.largePersonGroupPerson = new operations.LargePersonGroupPerson(this); + this.largePersonGroup = new operations.LargePersonGroupOperations(this); + this.largeFaceList = new operations.LargeFaceListOperations(this); + this.snapshot = new operations.SnapshotOperations(this); + } +} + +// Operation Specifications + +export { + FaceClient, + FaceClientContext, + Models as FaceModels, + Mappers as FaceMappers +}; +export * from "./operations"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/faceClientContext.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/faceClientContext.ts new file mode 100644 index 000000000000..0a1a28ff161c --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/faceClientContext.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; + +const packageName = "@azure/cognitiveservices-face"; +const packageVersion = "3.0.0"; + +export class FaceClientContext extends msRest.ServiceClient { + endpoint: string; + credentials: msRest.ServiceClientCredentials; + + /** + * Initializes a new instance of the FaceClientContext class. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param [options] The parameter options + */ + constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: Models.FaceClientOptions) { + if (endpoint === null || endpoint === undefined) { + throw new Error('\'endpoint\' cannot be null.'); + } + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRest.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.baseUri = options.baseUri || this.baseUri || "http://localhost"; + this.requestContentType = "application/json; charset=utf-8"; + this.endpoint = endpoint; + this.credentials = credentials; + + } +} diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/faceListOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/faceListOperationsMappers.ts new file mode 100644 index 000000000000..d952bcf47a51 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/faceListOperationsMappers.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export { + MetaDataContract, + NameAndUserDataContract, + APIError, + ErrorModel, + FaceList, + PersistedFace, + ImageUrl, + PersonGroup, + Person, + LargeFaceList, + LargePersonGroup +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/faceMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/faceMappers.ts new file mode 100644 index 000000000000..bc4da11454c0 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/faceMappers.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + FindSimilarRequest, + SimilarFace, + APIError, + ErrorModel, + GroupRequest, + GroupResult, + IdentifyRequest, + IdentifyResult, + IdentifyCandidate, + VerifyFaceToFaceRequest, + VerifyResult, + ImageUrl, + DetectedFace, + FaceRectangle, + FaceLandmarks, + Coordinate, + FaceAttributes, + FacialHair, + HeadPose, + Emotion, + Hair, + HairColor, + Makeup, + Occlusion, + Accessory, + Blur, + Exposure, + Noise, + VerifyFaceToPersonRequest +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/index.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/index.ts new file mode 100644 index 000000000000..d8f7072f28b5 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/index.ts @@ -0,0 +1,3102 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientOptions } from "@azure/ms-rest-js"; +import * as msRest from "@azure/ms-rest-js"; + + +/** + * @interface + * An interface representing ErrorModel. + * Error body. + * + */ +export interface ErrorModel { + /** + * @member {string} [code] + */ + code?: string; + /** + * @member {string} [message] + */ + message?: string; +} + +/** + * @interface + * An interface representing APIError. + * Error information returned by the API + * + */ +export interface APIError { + /** + * @member {ErrorModel} [error] + */ + error?: ErrorModel; +} + +/** + * @interface + * An interface representing FaceRectangle. + * A rectangle within which a face can be found + * + */ +export interface FaceRectangle { + /** + * @member {number} width The width of the rectangle, in pixels. + */ + width: number; + /** + * @member {number} height The height of the rectangle, in pixels. + */ + height: number; + /** + * @member {number} left The distance from the left edge if the image to the + * left edge of the rectangle, in pixels. + */ + left: number; + /** + * @member {number} top The distance from the top edge if the image to the + * top edge of the rectangle, in pixels. + */ + top: number; +} + +/** + * @interface + * An interface representing Coordinate. + * Coordinates within an image + * + */ +export interface Coordinate { + /** + * @member {number} x The horizontal component, in pixels. + */ + x: number; + /** + * @member {number} y The vertical component, in pixels. + */ + y: number; +} + +/** + * @interface + * An interface representing FaceLandmarks. + * A collection of 27-point face landmarks pointing to the important positions + * of face components. + * + */ +export interface FaceLandmarks { + /** + * @member {Coordinate} [pupilLeft] + */ + pupilLeft?: Coordinate; + /** + * @member {Coordinate} [pupilRight] + */ + pupilRight?: Coordinate; + /** + * @member {Coordinate} [noseTip] + */ + noseTip?: Coordinate; + /** + * @member {Coordinate} [mouthLeft] + */ + mouthLeft?: Coordinate; + /** + * @member {Coordinate} [mouthRight] + */ + mouthRight?: Coordinate; + /** + * @member {Coordinate} [eyebrowLeftOuter] + */ + eyebrowLeftOuter?: Coordinate; + /** + * @member {Coordinate} [eyebrowLeftInner] + */ + eyebrowLeftInner?: Coordinate; + /** + * @member {Coordinate} [eyeLeftOuter] + */ + eyeLeftOuter?: Coordinate; + /** + * @member {Coordinate} [eyeLeftTop] + */ + eyeLeftTop?: Coordinate; + /** + * @member {Coordinate} [eyeLeftBottom] + */ + eyeLeftBottom?: Coordinate; + /** + * @member {Coordinate} [eyeLeftInner] + */ + eyeLeftInner?: Coordinate; + /** + * @member {Coordinate} [eyebrowRightInner] + */ + eyebrowRightInner?: Coordinate; + /** + * @member {Coordinate} [eyebrowRightOuter] + */ + eyebrowRightOuter?: Coordinate; + /** + * @member {Coordinate} [eyeRightInner] + */ + eyeRightInner?: Coordinate; + /** + * @member {Coordinate} [eyeRightTop] + */ + eyeRightTop?: Coordinate; + /** + * @member {Coordinate} [eyeRightBottom] + */ + eyeRightBottom?: Coordinate; + /** + * @member {Coordinate} [eyeRightOuter] + */ + eyeRightOuter?: Coordinate; + /** + * @member {Coordinate} [noseRootLeft] + */ + noseRootLeft?: Coordinate; + /** + * @member {Coordinate} [noseRootRight] + */ + noseRootRight?: Coordinate; + /** + * @member {Coordinate} [noseLeftAlarTop] + */ + noseLeftAlarTop?: Coordinate; + /** + * @member {Coordinate} [noseRightAlarTop] + */ + noseRightAlarTop?: Coordinate; + /** + * @member {Coordinate} [noseLeftAlarOutTip] + */ + noseLeftAlarOutTip?: Coordinate; + /** + * @member {Coordinate} [noseRightAlarOutTip] + */ + noseRightAlarOutTip?: Coordinate; + /** + * @member {Coordinate} [upperLipTop] + */ + upperLipTop?: Coordinate; + /** + * @member {Coordinate} [upperLipBottom] + */ + upperLipBottom?: Coordinate; + /** + * @member {Coordinate} [underLipTop] + */ + underLipTop?: Coordinate; + /** + * @member {Coordinate} [underLipBottom] + */ + underLipBottom?: Coordinate; +} + +/** + * @interface + * An interface representing FacialHair. + * Properties describing facial hair attributes. + * + */ +export interface FacialHair { + /** + * @member {number} [moustache] + */ + moustache?: number; + /** + * @member {number} [beard] + */ + beard?: number; + /** + * @member {number} [sideburns] + */ + sideburns?: number; +} + +/** + * @interface + * An interface representing HeadPose. + * Properties indicating head pose of the face. + * + */ +export interface HeadPose { + /** + * @member {number} [roll] + */ + roll?: number; + /** + * @member {number} [yaw] + */ + yaw?: number; + /** + * @member {number} [pitch] + */ + pitch?: number; +} + +/** + * @interface + * An interface representing Emotion. + * Properties describing facial emotion in form of confidence ranging from 0 to + * 1. + * + */ +export interface Emotion { + /** + * @member {number} [anger] + */ + anger?: number; + /** + * @member {number} [contempt] + */ + contempt?: number; + /** + * @member {number} [disgust] + */ + disgust?: number; + /** + * @member {number} [fear] + */ + fear?: number; + /** + * @member {number} [happiness] + */ + happiness?: number; + /** + * @member {number} [neutral] + */ + neutral?: number; + /** + * @member {number} [sadness] + */ + sadness?: number; + /** + * @member {number} [surprise] + */ + surprise?: number; +} + +/** + * @interface + * An interface representing HairColor. + * Hair color and associated confidence + * + */ +export interface HairColor { + /** + * @member {HairColorType} [color] Name of the hair color. Possible values + * include: 'unknown', 'white', 'gray', 'blond', 'brown', 'red', 'black', + * 'other' + */ + color?: HairColorType; + /** + * @member {number} [confidence] Confidence level of the color + */ + confidence?: number; +} + +/** + * @interface + * An interface representing Hair. + * Properties describing hair attributes. + * + */ +export interface Hair { + /** + * @member {number} [bald] A number describing confidence level of whether + * the person is bald. + */ + bald?: number; + /** + * @member {boolean} [invisible] A boolean value describing whether the hair + * is visible in the image. + */ + invisible?: boolean; + /** + * @member {HairColor[]} [hairColor] An array of candidate colors and + * confidence level in the presence of each. + */ + hairColor?: HairColor[]; +} + +/** + * @interface + * An interface representing Makeup. + * Properties describing present makeups on a given face. + * + */ +export interface Makeup { + /** + * @member {boolean} [eyeMakeup] A boolean value describing whether eye + * makeup is present on a face. + */ + eyeMakeup?: boolean; + /** + * @member {boolean} [lipMakeup] A boolean value describing whether lip + * makeup is present on a face. + */ + lipMakeup?: boolean; +} + +/** + * @interface + * An interface representing Occlusion. + * Properties describing occlusions on a given face. + * + */ +export interface Occlusion { + /** + * @member {boolean} [foreheadOccluded] A boolean value indicating whether + * forehead is occluded. + */ + foreheadOccluded?: boolean; + /** + * @member {boolean} [eyeOccluded] A boolean value indicating whether eyes + * are occluded. + */ + eyeOccluded?: boolean; + /** + * @member {boolean} [mouthOccluded] A boolean value indicating whether the + * mouth is occluded. + */ + mouthOccluded?: boolean; +} + +/** + * @interface + * An interface representing Accessory. + * Accessory item and corresponding confidence level. + * + */ +export interface Accessory { + /** + * @member {AccessoryType} [type] Type of an accessory. Possible values + * include: 'headWear', 'glasses', 'mask' + */ + type?: AccessoryType; + /** + * @member {number} [confidence] Confidence level of an accessory + */ + confidence?: number; +} + +/** + * @interface + * An interface representing Blur. + * Properties describing any presence of blur within the image. + * + */ +export interface Blur { + /** + * @member {BlurLevel} [blurLevel] An enum value indicating level of + * blurriness. Possible values include: 'Low', 'Medium', 'High' + */ + blurLevel?: BlurLevel; + /** + * @member {number} [value] A number indicating level of blurriness ranging + * from 0 to 1. + */ + value?: number; +} + +/** + * @interface + * An interface representing Exposure. + * Properties describing exposure level of the image. + * + */ +export interface Exposure { + /** + * @member {ExposureLevel} [exposureLevel] An enum value indicating level of + * exposure. Possible values include: 'UnderExposure', 'GoodExposure', + * 'OverExposure' + */ + exposureLevel?: ExposureLevel; + /** + * @member {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. + */ + value?: number; +} + +/** + * @interface + * An interface representing Noise. + * Properties describing noise level of the image. + * + */ +export interface Noise { + /** + * @member {NoiseLevel} [noiseLevel] An enum value indicating level of noise. + * Possible values include: 'Low', 'Medium', 'High' + */ + noiseLevel?: NoiseLevel; + /** + * @member {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. + */ + value?: number; +} + +/** + * @interface + * An interface representing FaceAttributes. + * Face Attributes + * + */ +export interface FaceAttributes { + /** + * @member {number} [age] Age in years + */ + age?: number; + /** + * @member {Gender} [gender] Possible gender of the face. Possible values + * include: 'male', 'female' + */ + gender?: Gender; + /** + * @member {number} [smile] Smile intensity, a number between [0,1] + */ + smile?: number; + /** + * @member {FacialHair} [facialHair] Properties describing facial hair + * attributes. + */ + facialHair?: FacialHair; + /** + * @member {GlassesType} [glasses] Glasses type if any of the face. Possible + * values include: 'noGlasses', 'readingGlasses', 'sunglasses', + * 'swimmingGoggles' + */ + glasses?: GlassesType; + /** + * @member {HeadPose} [headPose] Properties indicating head pose of the face. + */ + headPose?: HeadPose; + /** + * @member {Emotion} [emotion] Properties describing facial emotion in form + * of confidence ranging from 0 to 1. + */ + emotion?: Emotion; + /** + * @member {Hair} [hair] Properties describing hair attributes. + */ + hair?: Hair; + /** + * @member {Makeup} [makeup] Properties describing present makeups on a given + * face. + */ + makeup?: Makeup; + /** + * @member {Occlusion} [occlusion] Properties describing occlusions on a + * given face. + */ + occlusion?: Occlusion; + /** + * @member {Accessory[]} [accessories] Properties describing any accessories + * on a given face. + */ + accessories?: Accessory[]; + /** + * @member {Blur} [blur] Properties describing any presence of blur within + * the image. + */ + blur?: Blur; + /** + * @member {Exposure} [exposure] Properties describing exposure level of the + * image. + */ + exposure?: Exposure; + /** + * @member {Noise} [noise] Properties describing noise level of the image. + */ + noise?: Noise; +} + +/** + * @interface + * An interface representing DetectedFace. + * Detected Face object. + * + */ +export interface DetectedFace { + /** + * @member {string} [faceId] + */ + faceId?: string; + /** + * @member {RecognitionModel} [recognitionModel] Possible values include: + * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; + /** + * @member {FaceRectangle} faceRectangle + */ + faceRectangle: FaceRectangle; + /** + * @member {FaceLandmarks} [faceLandmarks] + */ + faceLandmarks?: FaceLandmarks; + /** + * @member {FaceAttributes} [faceAttributes] + */ + faceAttributes?: FaceAttributes; +} + +/** + * @interface + * An interface representing FindSimilarRequest. + * Request body for find similar operation. + * + */ +export interface FindSimilarRequest { + /** + * @member {string} 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 + */ + faceId: string; + /** + * @member {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. + */ + faceListId?: string; + /** + * @member {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. + */ + largeFaceListId?: string; + /** + * @member {string[]} [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. + */ + faceIds?: string[]; + /** + * @member {number} [maxNumOfCandidatesReturned] The number of top similar + * faces returned. The valid range is [1, 1000]. Default value: 20 . + */ + maxNumOfCandidatesReturned?: number; + /** + * @member {FindSimilarMatchMode} [mode] Similar face searching mode. It can + * be "matchPerson" or "matchFace". Possible values include: 'matchPerson', + * 'matchFace'. Default value: 'matchPerson' . + */ + mode?: FindSimilarMatchMode; +} + +/** + * @interface + * An interface representing SimilarFace. + * Response body for find similar face operation. + * + */ +export interface SimilarFace { + /** + * @member {string} [faceId] 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; + /** + * @member {string} [persistedFaceId] 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; + /** + * @member {number} confidence Similarity confidence of the candidate face. + * The higher confidence, the more similar. Range between [0,1]. + */ + confidence: number; +} + +/** + * @interface + * An interface representing GroupRequest. + * Request body for group request. + * + */ +export interface GroupRequest { + /** + * @member {string[]} faceIds Array of candidate faceId created by Face - + * Detect. The maximum is 1000 faces + */ + faceIds: string[]; +} + +/** + * @interface + * An interface representing GroupResult. + * An array of face groups based on face similarity. + * + */ +export interface GroupResult { + /** + * @member {string[][]} groups A partition of the original faces based on + * face similarity. Groups are ranked by number of faces + */ + groups: string[][]; + /** + * @member {string[]} [messyGroup] Face ids array of faces that cannot find + * any similar faces from original faces. + */ + messyGroup?: string[]; +} + +/** + * @interface + * An interface representing IdentifyRequest. + * Request body for identify face operation. + * + */ +export interface IdentifyRequest { + /** + * @member {string[]} 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]. + */ + faceIds: string[]; + /** + * @member {string} [personGroupId] PersonGroupId of the target person group, + * created by PersonGroup - Create. Parameter personGroupId and + * largePersonGroupId should not be provided at the same time. + */ + personGroupId?: string; + /** + * @member {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. + */ + largePersonGroupId?: string; + /** + * @member {number} [maxNumOfCandidatesReturned] The range of + * maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default + * value: 1 . + */ + maxNumOfCandidatesReturned?: number; + /** + * @member {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). + */ + confidenceThreshold?: number; +} + +/** + * @interface + * An interface representing IdentifyCandidate. + * All possible faces that may qualify. + * + */ +export interface IdentifyCandidate { + /** + * @member {string} personId Id of candidate + */ + personId: string; + /** + * @member {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). + */ + confidence: number; +} + +/** + * @interface + * An interface representing IdentifyResult. + * Response body for identify face operation. + * + */ +export interface IdentifyResult { + /** + * @member {string} faceId FaceId of the query face + */ + faceId: string; + /** + * @member {IdentifyCandidate[]} 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. + */ + candidates: IdentifyCandidate[]; +} + +/** + * @interface + * An interface representing VerifyFaceToPersonRequest. + * Request body for face to person verification. + * + */ +export interface VerifyFaceToPersonRequest { + /** + * @member {string} faceId FaceId of the face, comes from Face - Detect + */ + faceId: string; + /** + * @member {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. + */ + personGroupId?: string; + /** + * @member {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. + */ + largePersonGroupId?: string; + /** + * @member {string} 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. + */ + personId: string; +} + +/** + * @interface + * An interface representing VerifyFaceToFaceRequest. + * Request body for face to face verification. + * + */ +export interface VerifyFaceToFaceRequest { + /** + * @member {string} faceId1 FaceId of the first face, comes from Face - + * Detect + */ + faceId1: string; + /** + * @member {string} faceId2 FaceId of the second face, comes from Face - + * Detect + */ + faceId2: string; +} + +/** + * @interface + * An interface representing VerifyResult. + * Result of the verify operation. + * + */ +export interface VerifyResult { + /** + * @member {boolean} isIdentical True if the two faces belong to the same + * person or the face belongs to the person, otherwise false. + */ + isIdentical: boolean; + /** + * @member {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. + */ + confidence: number; +} + +/** + * @interface + * An interface representing PersistedFace. + * PersonFace object. + * + */ +export interface PersistedFace { + /** + * @member {string} 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. + */ + persistedFaceId: string; + /** + * @member {string} [userData] User-provided data attached to the face. The + * size limit is 1KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing NameAndUserDataContract. + * A combination of user defined name and user specified data for the person, + * largePersonGroup/personGroup, and largeFaceList/faceList. + * + */ +export interface NameAndUserDataContract { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing MetaDataContract. + * A combination of user defined name and user specified data and recognition + * model name for largePersonGroup/personGroup, and largeFaceList/faceList. + * + * @extends NameAndUserDataContract + */ +export interface MetaDataContract extends NameAndUserDataContract { + /** + * @member {RecognitionModel} [recognitionModel] Possible values include: + * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; +} + +/** + * @interface + * An interface representing FaceList. + * Face list object. + * + * @extends MetaDataContract + */ +export interface FaceList extends MetaDataContract { + /** + * @member {string} faceListId FaceListId of the target face list. + */ + faceListId: string; + /** + * @member {PersistedFace[]} [persistedFaces] Persisted faces within the face + * list. + */ + persistedFaces?: PersistedFace[]; +} + +/** + * @interface + * An interface representing PersonGroup. + * Person group object. + * + * @extends MetaDataContract + */ +export interface PersonGroup extends MetaDataContract { + /** + * @member {string} personGroupId PersonGroupId of the target person group. + */ + personGroupId: string; +} + +/** + * @interface + * An interface representing Person. + * Person object. + * + * @extends NameAndUserDataContract + */ +export interface Person extends NameAndUserDataContract { + /** + * @member {string} personId PersonId of the target face list. + */ + personId: string; + /** + * @member {string[]} [persistedFaceIds] PersistedFaceIds of registered faces + * in the person. These persistedFaceIds are returned from Person - Add a + * Person Face, and will not expire. + */ + persistedFaceIds?: string[]; +} + +/** + * @interface + * An interface representing LargeFaceList. + * Large face list object. + * + * @extends MetaDataContract + */ +export interface LargeFaceList extends MetaDataContract { + /** + * @member {string} largeFaceListId LargeFaceListId of the target large face + * list. + */ + largeFaceListId: string; +} + +/** + * @interface + * An interface representing LargePersonGroup. + * Large person group object. + * + * @extends MetaDataContract + */ +export interface LargePersonGroup extends MetaDataContract { + /** + * @member {string} largePersonGroupId LargePersonGroupId of the target large + * person groups + */ + largePersonGroupId: string; +} + +/** + * @interface + * An interface representing UpdateFaceRequest. + * Request to update face data. + * + */ +export interface UpdateFaceRequest { + /** + * @member {string} [userData] User-provided data attached to the face. The + * size limit is 1KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing TrainingStatus. + * Training status object. + * + */ +export interface TrainingStatus { + /** + * @member {TrainingStatusType} 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' + */ + status: TrainingStatusType; + /** + * @member {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. + */ + created: Date; + /** + * @member {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. + */ + lastAction?: Date; + /** + * @member {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. + */ + lastSuccessfulTraining?: Date; + /** + * @member {string} [message] Show failure message when training failed + * (omitted when training succeed). + */ + message?: string; +} + +/** + * @interface + * An interface representing ApplySnapshotRequest. + * Request body for applying snapshot operation. + * + */ +export interface ApplySnapshotRequest { + /** + * @member {string} objectId User specified target object id to be created + * from the snapshot. + */ + objectId: string; + /** + * @member {SnapshotApplyMode} [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' . + */ + mode?: SnapshotApplyMode; +} + +/** + * @interface + * An interface representing Snapshot. + * Snapshot object. + * + */ +export interface Snapshot { + /** + * @member {string} id Snapshot id. + */ + id: string; + /** + * @member {string} account Azure Cognitive Service Face account id of the + * subscriber who created the snapshot by Snapshot - Take. + */ + account: string; + /** + * @member {SnapshotObjectType} 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' + */ + type: SnapshotObjectType; + /** + * @member {string[]} 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. + */ + applyScope: string[]; + /** + * @member {string} [userData] User specified data about the snapshot for any + * purpose. Length should not exceed 16KB. + */ + userData?: string; + /** + * @member {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. + */ + createdTime: Date; + /** + * @member {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. + */ + lastUpdateTime: Date; +} + +/** + * @interface + * An interface representing TakeSnapshotRequest. + * Request body for taking snapshot operation. + * + */ +export interface TakeSnapshotRequest { + /** + * @member {SnapshotObjectType} 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' + */ + type: SnapshotObjectType; + /** + * @member {string} objectId User specified source object id to take snapshot + * from. + */ + objectId: string; + /** + * @member {string[]} 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. + */ + applyScope: string[]; + /** + * @member {string} [userData] User specified data about the snapshot for any + * purpose. Length should not exceed 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing UpdateSnapshotRequest. + * Request body for updating a snapshot, with a combination of user defined + * apply scope and user specified data. + * + */ +export interface UpdateSnapshotRequest { + /** + * @member {string[]} [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. + */ + applyScope?: string[]; + /** + * @member {string} [userData] User specified data about the snapshot for any + * purpose. Length should not exceed 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing OperationStatus. + * Operation status object. Operation refers to the asynchronous backend task + * including taking a snapshot and applying a snapshot. + * + */ +export interface OperationStatus { + /** + * @member {OperationStatusType} 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' + */ + status: OperationStatusType; + /** + * @member {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. + */ + createdTime: Date; + /** + * @member {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. + */ + lastActionTime?: Date; + /** + * @member {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. + */ + resourceLocation?: string; + /** + * @member {string} [message] Show failure message when operation fails + * (omitted when operation succeeds). + */ + message?: string; +} + +/** + * @interface + * An interface representing ImageUrl. + */ +export interface ImageUrl { + /** + * @member {string} url Publicly reachable URL of an image + */ + url: string; +} + +/** + * @interface + * An interface representing FaceClientOptions. + * @extends ServiceClientOptions + */ +export interface FaceClientOptions extends ServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + +/** + * @interface + * An interface representing FaceFindSimilarOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceFindSimilarOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {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. + */ + faceListId?: string; + /** + * @member {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. + */ + largeFaceListId?: string; + /** + * @member {string[]} [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. + */ + faceIds?: string[]; + /** + * @member {number} [maxNumOfCandidatesReturned] The number of top similar + * faces returned. The valid range is [1, 1000]. Default value: 20 . + */ + maxNumOfCandidatesReturned?: number; + /** + * @member {FindSimilarMatchMode} [mode] Similar face searching mode. It can + * be "matchPerson" or "matchFace". Possible values include: 'matchPerson', + * 'matchFace'. Default value: 'matchPerson' . + */ + mode?: FindSimilarMatchMode; +} + +/** + * @interface + * An interface representing FaceIdentifyOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceIdentifyOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [personGroupId] PersonGroupId of the target person group, + * created by PersonGroup - Create. Parameter personGroupId and + * largePersonGroupId should not be provided at the same time. + */ + personGroupId?: string; + /** + * @member {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. + */ + largePersonGroupId?: string; + /** + * @member {number} [maxNumOfCandidatesReturned] The range of + * maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default + * value: 1 . + */ + maxNumOfCandidatesReturned?: number; + /** + * @member {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). + */ + confidenceThreshold?: number; +} + +/** + * @interface + * An interface representing FaceDetectWithUrlOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceDetectWithUrlOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnFaceId] A value indicating whether the operation + * should return faceIds of detected faces. Default value: true . + */ + returnFaceId?: boolean; + /** + * @member {boolean} [returnFaceLandmarks] A value indicating whether the + * operation should return landmarks of the detected faces. Default value: + * false . + */ + returnFaceLandmarks?: boolean; + /** + * @member {FaceAttributeType[]} [returnFaceAttributes] Analyze and return + * the one or more specified face attributes in the comma-separated string + * like "returnFaceAttributes=age,gender". Supported face attributes include + * age, gender, headPose, smile, facialHair, glasses and emotion. Note that + * each face attribute analysis has additional computational and time cost. + */ + returnFaceAttributes?: FaceAttributeType[]; + /** + * @member {RecognitionModel} [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'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing FaceVerifyFaceToPersonOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceVerifyFaceToPersonOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {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. + */ + personGroupId?: string; + /** + * @member {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. + */ + largePersonGroupId?: string; +} + +/** + * @interface + * An interface representing FaceDetectWithStreamOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceDetectWithStreamOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnFaceId] A value indicating whether the operation + * should return faceIds of detected faces. Default value: true . + */ + returnFaceId?: boolean; + /** + * @member {boolean} [returnFaceLandmarks] A value indicating whether the + * operation should return landmarks of the detected faces. Default value: + * false . + */ + returnFaceLandmarks?: boolean; + /** + * @member {FaceAttributeType[]} [returnFaceAttributes] Analyze and return + * the one or more specified face attributes in the comma-separated string + * like "returnFaceAttributes=age,gender". Supported face attributes include + * age, gender, headPose, smile, facialHair, glasses and emotion. Note that + * each face attribute analysis has additional computational and time cost. + */ + returnFaceAttributes?: FaceAttributeType[]; + /** + * @member {RecognitionModel} [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'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing PersonGroupPersonCreateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupPersonCreateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing PersonGroupPersonListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupPersonListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [start] Starting person id to return (used to list a + * range of persons). + */ + start?: string; + /** + * @member {number} [top] Number of persons to return starting with the + * person id indicated by the 'start' parameter. + */ + top?: number; +} + +/** + * @interface + * An interface representing PersonGroupPersonUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupPersonUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing PersonGroupPersonUpdateFaceOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupPersonUpdateFaceOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-provided data attached to the face. The + * size limit is 1KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing PersonGroupPersonAddFaceFromUrlOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupPersonAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing PersonGroupPersonAddFaceFromStreamOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupPersonAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing PersonGroupCreateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupCreateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; + /** + * @member {RecognitionModel} [recognitionModel] Possible values include: + * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; +} + +/** + * @interface + * An interface representing PersonGroupGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing PersonGroupUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing PersonGroupListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface PersonGroupListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [start] List person groups from the least personGroupId + * greater than the "start". + */ + start?: string; + /** + * @member {number} [top] The number of person groups to list. Default value: + * 1000 . + */ + top?: number; + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing FaceListCreateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceListCreateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; + /** + * @member {RecognitionModel} [recognitionModel] Possible values include: + * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; +} + +/** + * @interface + * An interface representing FaceListGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceListGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing FaceListUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceListUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing FaceListListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceListListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing FaceListAddFaceFromUrlOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceListAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing FaceListAddFaceFromStreamOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface FaceListAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing LargePersonGroupPersonCreateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupPersonCreateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing LargePersonGroupPersonListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupPersonListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [start] Starting person id to return (used to list a + * range of persons). + */ + start?: string; + /** + * @member {number} [top] Number of persons to return starting with the + * person id indicated by the 'start' parameter. + */ + top?: number; +} + +/** + * @interface + * An interface representing LargePersonGroupPersonUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupPersonUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing LargePersonGroupPersonUpdateFaceOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupPersonUpdateFaceOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-provided data attached to the face. The + * size limit is 1KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing LargePersonGroupPersonAddFaceFromUrlOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupPersonAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing LargePersonGroupPersonAddFaceFromStreamOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupPersonAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing LargePersonGroupCreateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupCreateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; + /** + * @member {RecognitionModel} [recognitionModel] Possible values include: + * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; +} + +/** + * @interface + * An interface representing LargePersonGroupGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing LargePersonGroupUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing LargePersonGroupListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargePersonGroupListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [start] List large person groups from the least + * largePersonGroupId greater than the "start". + */ + start?: string; + /** + * @member {number} [top] The number of large person groups to list. Default + * value: 1000 . + */ + top?: number; + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing LargeFaceListCreateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListCreateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; + /** + * @member {RecognitionModel} [recognitionModel] Possible values include: + * 'recognition_01', 'recognition_02'. Default value: 'recognition_01' . + */ + recognitionModel?: RecognitionModel; +} + +/** + * @interface + * An interface representing LargeFaceListGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing LargeFaceListUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [name] User defined name, maximum length is 128. + */ + name?: string; + /** + * @member {string} [userData] User specified data. Length should not exceed + * 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing LargeFaceListListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [returnRecognitionModel] A value indicating whether the + * operation should return 'recognitionModel' in response. Default value: + * false . + */ + returnRecognitionModel?: boolean; +} + +/** + * @interface + * An interface representing LargeFaceListUpdateFaceOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListUpdateFaceOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-provided data attached to the face. The + * size limit is 1KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing LargeFaceListAddFaceFromUrlOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListAddFaceFromUrlOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing LargeFaceListListFacesOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListListFacesOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [start] Starting face id to return (used to list a range + * of faces). + */ + start?: string; + /** + * @member {number} [top] Number of faces to return starting with the face id + * indicated by the 'start' parameter. + */ + top?: number; +} + +/** + * @interface + * An interface representing LargeFaceListAddFaceFromStreamOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface LargeFaceListAddFaceFromStreamOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User-specified data about the face for any + * purpose. The maximum length is 1KB. + */ + userData?: string; + /** + * @member {number[]} [targetFace] A face rectangle to specify the target + * face to be added to a person in the format of + * "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If + * there is more than one face in the image, targetFace is required to + * specify which face to add. No targetFace means there is only one face + * detected in the entire image. + */ + targetFace?: number[]; +} + +/** + * @interface + * An interface representing SnapshotTakeOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface SnapshotTakeOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [userData] User specified data about the snapshot for any + * purpose. Length should not exceed 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing SnapshotListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface SnapshotListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {SnapshotObjectType} [type] User specified object type as a search + * filter. Possible values include: 'FaceList', 'LargeFaceList', + * 'LargePersonGroup', 'PersonGroup' + */ + type?: SnapshotObjectType; + /** + * @member {string[]} [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. + */ + applyScope?: string[]; +} + +/** + * @interface + * An interface representing SnapshotUpdateOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface SnapshotUpdateOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string[]} [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. + */ + applyScope?: string[]; + /** + * @member {string} [userData] User specified data about the snapshot for any + * purpose. Length should not exceed 16KB. + */ + userData?: string; +} + +/** + * @interface + * An interface representing SnapshotApplyOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface SnapshotApplyOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {SnapshotApplyMode} [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' . + */ + mode?: SnapshotApplyMode; +} + +/** + * @interface + * An interface representing SnapshotTakeHeaders. + * Defines headers for Take operation. + * + */ +export interface SnapshotTakeHeaders { + /** + * @member {string} [operationLocation] Operation location with an operation + * id used to track the progress of taking snapshot. The returned id is the + * operation id, rather than snapshot id. Snapshot id can be obtained only + * when the operation status becomes "succeeded" in OperationStatus - Get. + */ + operationLocation: string; +} + +/** + * @interface + * An interface representing SnapshotApplyHeaders. + * Defines headers for Apply operation. + * + */ +export interface SnapshotApplyHeaders { + /** + * @member {string} [operationLocation] Operation location with an operation + * id used to track the progress of applying the snapshot by OperationStatus + * - Get. + */ + operationLocation: string; +} + +/** + * Defines values for RecognitionModel. + * Possible values include: 'recognition_01', 'recognition_02' + * @readonly + * @enum {string} + */ +export type RecognitionModel = 'recognition_01' | 'recognition_02'; + +/** + * Defines values for Gender. + * Possible values include: 'male', 'female' + * @readonly + * @enum {string} + */ +export type Gender = 'male' | 'female'; + +/** + * Defines values for GlassesType. + * Possible values include: 'noGlasses', 'readingGlasses', 'sunglasses', 'swimmingGoggles' + * @readonly + * @enum {string} + */ +export type GlassesType = 'noGlasses' | 'readingGlasses' | 'sunglasses' | 'swimmingGoggles'; + +/** + * Defines values for HairColorType. + * Possible values include: 'unknown', 'white', 'gray', 'blond', 'brown', 'red', 'black', 'other' + * @readonly + * @enum {string} + */ +export type HairColorType = 'unknown' | 'white' | 'gray' | 'blond' | 'brown' | 'red' | 'black' | 'other'; + +/** + * Defines values for AccessoryType. + * Possible values include: 'headWear', 'glasses', 'mask' + * @readonly + * @enum {string} + */ +export type AccessoryType = 'headWear' | 'glasses' | 'mask'; + +/** + * Defines values for BlurLevel. + * Possible values include: 'Low', 'Medium', 'High' + * @readonly + * @enum {string} + */ +export type BlurLevel = 'Low' | 'Medium' | 'High'; + +/** + * Defines values for ExposureLevel. + * Possible values include: 'UnderExposure', 'GoodExposure', 'OverExposure' + * @readonly + * @enum {string} + */ +export type ExposureLevel = 'UnderExposure' | 'GoodExposure' | 'OverExposure'; + +/** + * Defines values for NoiseLevel. + * Possible values include: 'Low', 'Medium', 'High' + * @readonly + * @enum {string} + */ +export type NoiseLevel = 'Low' | 'Medium' | 'High'; + +/** + * Defines values for FindSimilarMatchMode. + * Possible values include: 'matchPerson', 'matchFace' + * @readonly + * @enum {string} + */ +export type FindSimilarMatchMode = 'matchPerson' | 'matchFace'; + +/** + * Defines values for TrainingStatusType. + * Possible values include: 'nonstarted', 'running', 'succeeded', 'failed' + * @readonly + * @enum {string} + */ +export type TrainingStatusType = 'nonstarted' | 'running' | 'succeeded' | 'failed'; + +/** + * Defines values for SnapshotApplyMode. + * Possible values include: 'CreateNew' + * @readonly + * @enum {string} + */ +export type SnapshotApplyMode = 'CreateNew'; + +/** + * Defines values for SnapshotObjectType. + * Possible values include: 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' + * @readonly + * @enum {string} + */ +export type SnapshotObjectType = 'FaceList' | 'LargeFaceList' | 'LargePersonGroup' | 'PersonGroup'; + +/** + * Defines values for OperationStatusType. + * Possible values include: 'notstarted', 'running', 'succeeded', 'failed' + * @readonly + * @enum {string} + */ +export type OperationStatusType = 'notstarted' | 'running' | 'succeeded' | 'failed'; + +/** + * Defines values for FaceAttributeType. + * Possible values include: 'age', 'gender', 'headPose', 'smile', 'facialHair', 'glasses', + * 'emotion', 'hair', 'makeup', 'occlusion', 'accessories', 'blur', 'exposure', 'noise' + * @readonly + * @enum {string} + */ +export type FaceAttributeType = 'age' | 'gender' | 'headPose' | 'smile' | 'facialHair' | 'glasses' | 'emotion' | 'hair' | 'makeup' | 'occlusion' | 'accessories' | 'blur' | 'exposure' | 'noise'; + +/** + * Contains response data for the findSimilar operation. + */ +export type FaceFindSimilarResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: SimilarFace[]; + }; +}; + +/** + * Contains response data for the group operation. + */ +export type FaceGroupResponse = GroupResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: GroupResult; + }; +}; + +/** + * Contains response data for the identify operation. + */ +export type FaceIdentifyResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: IdentifyResult[]; + }; +}; + +/** + * Contains response data for the verifyFaceToFace operation. + */ +export type FaceVerifyFaceToFaceResponse = VerifyResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: VerifyResult; + }; +}; + +/** + * Contains response data for the detectWithUrl operation. + */ +export type FaceDetectWithUrlResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DetectedFace[]; + }; +}; + +/** + * Contains response data for the verifyFaceToPerson operation. + */ +export type FaceVerifyFaceToPersonResponse = VerifyResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: VerifyResult; + }; +}; + +/** + * Contains response data for the detectWithStream operation. + */ +export type FaceDetectWithStreamResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: DetectedFace[]; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type PersonGroupPersonCreateResponse = Person & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Person; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type PersonGroupPersonListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Person[]; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type PersonGroupPersonGetResponse = Person & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Person; + }; +}; + +/** + * Contains response data for the getFace operation. + */ +export type PersonGroupPersonGetFaceResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the addFaceFromUrl operation. + */ +export type PersonGroupPersonAddFaceFromUrlResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the addFaceFromStream operation. + */ +export type PersonGroupPersonAddFaceFromStreamResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type PersonGroupGetResponse = PersonGroup & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersonGroup; + }; +}; + +/** + * Contains response data for the getTrainingStatus operation. + */ +export type PersonGroupGetTrainingStatusResponse = TrainingStatus & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: TrainingStatus; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type PersonGroupListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersonGroup[]; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type FaceListGetResponse = FaceList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: FaceList; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type FaceListListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: FaceList[]; + }; +}; + +/** + * Contains response data for the addFaceFromUrl operation. + */ +export type FaceListAddFaceFromUrlResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the addFaceFromStream operation. + */ +export type FaceListAddFaceFromStreamResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type LargePersonGroupPersonCreateResponse = Person & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Person; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type LargePersonGroupPersonListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Person[]; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type LargePersonGroupPersonGetResponse = Person & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Person; + }; +}; + +/** + * Contains response data for the getFace operation. + */ +export type LargePersonGroupPersonGetFaceResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the addFaceFromUrl operation. + */ +export type LargePersonGroupPersonAddFaceFromUrlResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the addFaceFromStream operation. + */ +export type LargePersonGroupPersonAddFaceFromStreamResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type LargePersonGroupGetResponse = LargePersonGroup & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: LargePersonGroup; + }; +}; + +/** + * Contains response data for the getTrainingStatus operation. + */ +export type LargePersonGroupGetTrainingStatusResponse = TrainingStatus & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: TrainingStatus; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type LargePersonGroupListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: LargePersonGroup[]; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type LargeFaceListGetResponse = LargeFaceList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: LargeFaceList; + }; +}; + +/** + * Contains response data for the getTrainingStatus operation. + */ +export type LargeFaceListGetTrainingStatusResponse = TrainingStatus & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: TrainingStatus; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type LargeFaceListListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: LargeFaceList[]; + }; +}; + +/** + * Contains response data for the getFace operation. + */ +export type LargeFaceListGetFaceResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the addFaceFromUrl operation. + */ +export type LargeFaceListAddFaceFromUrlResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the listFaces operation. + */ +export type LargeFaceListListFacesResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace[]; + }; +}; + +/** + * Contains response data for the addFaceFromStream operation. + */ +export type LargeFaceListAddFaceFromStreamResponse = PersistedFace & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: PersistedFace; + }; +}; + +/** + * Contains response data for the take operation. + */ +export type SnapshotTakeResponse = SnapshotTakeHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: SnapshotTakeHeaders; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type SnapshotListResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Snapshot[]; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type SnapshotGetResponse = Snapshot & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Snapshot; + }; +}; + +/** + * Contains response data for the apply operation. + */ +export type SnapshotApplyResponse = SnapshotApplyHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: SnapshotApplyHeaders; + }; +}; + +/** + * Contains response data for the getOperationStatus operation. + */ +export type SnapshotGetOperationStatusResponse = OperationStatus & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: OperationStatus; + }; +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/largeFaceListOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/largeFaceListOperationsMappers.ts new file mode 100644 index 000000000000..8fba6986942f --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/largeFaceListOperationsMappers.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +export { + MetaDataContract, + NameAndUserDataContract, + APIError, + ErrorModel, + LargeFaceList, + TrainingStatus, + PersistedFace, + UpdateFaceRequest, + ImageUrl, + FaceList, + PersonGroup, + Person, + LargePersonGroup +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/largePersonGroupOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/largePersonGroupOperationsMappers.ts new file mode 100644 index 000000000000..0a63319ef107 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/largePersonGroupOperationsMappers.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export { + MetaDataContract, + NameAndUserDataContract, + APIError, + ErrorModel, + LargePersonGroup, + TrainingStatus, + FaceList, + PersistedFace, + PersonGroup, + Person, + LargeFaceList +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/largePersonGroupPersonMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/largePersonGroupPersonMappers.ts new file mode 100644 index 000000000000..6e4d194810cc --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/largePersonGroupPersonMappers.ts @@ -0,0 +1,25 @@ +/* + * 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. + */ + +export { + NameAndUserDataContract, + Person, + APIError, + ErrorModel, + PersistedFace, + UpdateFaceRequest, + ImageUrl, + MetaDataContract, + FaceList, + PersonGroup, + LargeFaceList, + LargePersonGroup +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/mappers.ts new file mode 100644 index 000000000000..c98bc63c10d2 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/mappers.ts @@ -0,0 +1,1775 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; + + +export const ErrorModel: msRest.CompositeMapper = { + serializedName: "Error", + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const APIError: msRest.CompositeMapper = { + serializedName: "APIError", + type: { + name: "Composite", + className: "APIError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + +export const FaceRectangle: msRest.CompositeMapper = { + serializedName: "FaceRectangle", + type: { + name: "Composite", + className: "FaceRectangle", + modelProperties: { + width: { + required: true, + serializedName: "width", + type: { + name: "Number" + } + }, + height: { + required: true, + serializedName: "height", + type: { + name: "Number" + } + }, + left: { + required: true, + serializedName: "left", + type: { + name: "Number" + } + }, + top: { + required: true, + serializedName: "top", + type: { + name: "Number" + } + } + } + } +}; + +export const Coordinate: msRest.CompositeMapper = { + serializedName: "Coordinate", + type: { + name: "Composite", + className: "Coordinate", + modelProperties: { + x: { + required: true, + serializedName: "x", + type: { + name: "Number" + } + }, + y: { + required: true, + serializedName: "y", + type: { + name: "Number" + } + } + } + } +}; + +export const FaceLandmarks: msRest.CompositeMapper = { + serializedName: "FaceLandmarks", + type: { + name: "Composite", + className: "FaceLandmarks", + modelProperties: { + pupilLeft: { + serializedName: "pupilLeft", + type: { + name: "Composite", + className: "Coordinate" + } + }, + pupilRight: { + serializedName: "pupilRight", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseTip: { + serializedName: "noseTip", + type: { + name: "Composite", + className: "Coordinate" + } + }, + mouthLeft: { + serializedName: "mouthLeft", + type: { + name: "Composite", + className: "Coordinate" + } + }, + mouthRight: { + serializedName: "mouthRight", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyebrowLeftOuter: { + serializedName: "eyebrowLeftOuter", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyebrowLeftInner: { + serializedName: "eyebrowLeftInner", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeLeftOuter: { + serializedName: "eyeLeftOuter", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeLeftTop: { + serializedName: "eyeLeftTop", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeLeftBottom: { + serializedName: "eyeLeftBottom", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeLeftInner: { + serializedName: "eyeLeftInner", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyebrowRightInner: { + serializedName: "eyebrowRightInner", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyebrowRightOuter: { + serializedName: "eyebrowRightOuter", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeRightInner: { + serializedName: "eyeRightInner", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeRightTop: { + serializedName: "eyeRightTop", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeRightBottom: { + serializedName: "eyeRightBottom", + type: { + name: "Composite", + className: "Coordinate" + } + }, + eyeRightOuter: { + serializedName: "eyeRightOuter", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseRootLeft: { + serializedName: "noseRootLeft", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseRootRight: { + serializedName: "noseRootRight", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseLeftAlarTop: { + serializedName: "noseLeftAlarTop", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseRightAlarTop: { + serializedName: "noseRightAlarTop", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseLeftAlarOutTip: { + serializedName: "noseLeftAlarOutTip", + type: { + name: "Composite", + className: "Coordinate" + } + }, + noseRightAlarOutTip: { + serializedName: "noseRightAlarOutTip", + type: { + name: "Composite", + className: "Coordinate" + } + }, + upperLipTop: { + serializedName: "upperLipTop", + type: { + name: "Composite", + className: "Coordinate" + } + }, + upperLipBottom: { + serializedName: "upperLipBottom", + type: { + name: "Composite", + className: "Coordinate" + } + }, + underLipTop: { + serializedName: "underLipTop", + type: { + name: "Composite", + className: "Coordinate" + } + }, + underLipBottom: { + serializedName: "underLipBottom", + type: { + name: "Composite", + className: "Coordinate" + } + } + } + } +}; + +export const FacialHair: msRest.CompositeMapper = { + serializedName: "FacialHair", + type: { + name: "Composite", + className: "FacialHair", + modelProperties: { + moustache: { + nullable: false, + serializedName: "moustache", + type: { + name: "Number" + } + }, + beard: { + nullable: false, + serializedName: "beard", + type: { + name: "Number" + } + }, + sideburns: { + nullable: false, + serializedName: "sideburns", + type: { + name: "Number" + } + } + } + } +}; + +export const HeadPose: msRest.CompositeMapper = { + serializedName: "HeadPose", + type: { + name: "Composite", + className: "HeadPose", + modelProperties: { + roll: { + nullable: false, + serializedName: "roll", + type: { + name: "Number" + } + }, + yaw: { + nullable: false, + serializedName: "yaw", + type: { + name: "Number" + } + }, + pitch: { + nullable: false, + serializedName: "pitch", + type: { + name: "Number" + } + } + } + } +}; + +export const Emotion: msRest.CompositeMapper = { + serializedName: "Emotion", + type: { + name: "Composite", + className: "Emotion", + modelProperties: { + anger: { + nullable: false, + serializedName: "anger", + type: { + name: "Number" + } + }, + contempt: { + nullable: false, + serializedName: "contempt", + type: { + name: "Number" + } + }, + disgust: { + nullable: false, + serializedName: "disgust", + type: { + name: "Number" + } + }, + fear: { + nullable: false, + serializedName: "fear", + type: { + name: "Number" + } + }, + happiness: { + nullable: false, + serializedName: "happiness", + type: { + name: "Number" + } + }, + neutral: { + nullable: false, + serializedName: "neutral", + type: { + name: "Number" + } + }, + sadness: { + nullable: false, + serializedName: "sadness", + type: { + name: "Number" + } + }, + surprise: { + nullable: false, + serializedName: "surprise", + type: { + name: "Number" + } + } + } + } +}; + +export const HairColor: msRest.CompositeMapper = { + serializedName: "HairColor", + type: { + name: "Composite", + className: "HairColor", + modelProperties: { + color: { + nullable: false, + serializedName: "color", + type: { + name: "Enum", + allowedValues: [ + "unknown", + "white", + "gray", + "blond", + "brown", + "red", + "black", + "other" + ] + } + }, + confidence: { + nullable: false, + serializedName: "confidence", + type: { + name: "Number" + } + } + } + } +}; + +export const Hair: msRest.CompositeMapper = { + serializedName: "Hair", + type: { + name: "Composite", + className: "Hair", + modelProperties: { + bald: { + nullable: false, + serializedName: "bald", + type: { + name: "Number" + } + }, + invisible: { + nullable: false, + serializedName: "invisible", + type: { + name: "Boolean" + } + }, + hairColor: { + serializedName: "hairColor", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "HairColor" + } + } + } + } + } + } +}; + +export const Makeup: msRest.CompositeMapper = { + serializedName: "Makeup", + type: { + name: "Composite", + className: "Makeup", + modelProperties: { + eyeMakeup: { + nullable: false, + serializedName: "eyeMakeup", + type: { + name: "Boolean" + } + }, + lipMakeup: { + nullable: false, + serializedName: "lipMakeup", + type: { + name: "Boolean" + } + } + } + } +}; + +export const Occlusion: msRest.CompositeMapper = { + serializedName: "Occlusion", + type: { + name: "Composite", + className: "Occlusion", + modelProperties: { + foreheadOccluded: { + nullable: false, + serializedName: "foreheadOccluded", + type: { + name: "Boolean" + } + }, + eyeOccluded: { + nullable: false, + serializedName: "eyeOccluded", + type: { + name: "Boolean" + } + }, + mouthOccluded: { + nullable: false, + serializedName: "mouthOccluded", + type: { + name: "Boolean" + } + } + } + } +}; + +export const Accessory: msRest.CompositeMapper = { + serializedName: "Accessory", + type: { + name: "Composite", + className: "Accessory", + modelProperties: { + type: { + nullable: false, + serializedName: "type", + type: { + name: "Enum", + allowedValues: [ + "headWear", + "glasses", + "mask" + ] + } + }, + confidence: { + nullable: false, + serializedName: "confidence", + type: { + name: "Number" + } + } + } + } +}; + +export const Blur: msRest.CompositeMapper = { + serializedName: "Blur", + type: { + name: "Composite", + className: "Blur", + modelProperties: { + blurLevel: { + nullable: false, + serializedName: "blurLevel", + type: { + name: "Enum", + allowedValues: [ + "Low", + "Medium", + "High" + ] + } + }, + value: { + nullable: false, + serializedName: "value", + type: { + name: "Number" + } + } + } + } +}; + +export const Exposure: msRest.CompositeMapper = { + serializedName: "Exposure", + type: { + name: "Composite", + className: "Exposure", + modelProperties: { + exposureLevel: { + nullable: false, + serializedName: "exposureLevel", + type: { + name: "Enum", + allowedValues: [ + "UnderExposure", + "GoodExposure", + "OverExposure" + ] + } + }, + value: { + nullable: false, + serializedName: "value", + type: { + name: "Number" + } + } + } + } +}; + +export const Noise: msRest.CompositeMapper = { + serializedName: "Noise", + type: { + name: "Composite", + className: "Noise", + modelProperties: { + noiseLevel: { + nullable: false, + serializedName: "noiseLevel", + type: { + name: "Enum", + allowedValues: [ + "Low", + "Medium", + "High" + ] + } + }, + value: { + nullable: false, + serializedName: "value", + type: { + name: "Number" + } + } + } + } +}; + +export const FaceAttributes: msRest.CompositeMapper = { + serializedName: "FaceAttributes", + type: { + name: "Composite", + className: "FaceAttributes", + modelProperties: { + age: { + serializedName: "age", + type: { + name: "Number" + } + }, + gender: { + serializedName: "gender", + type: { + name: "Enum", + allowedValues: [ + "male", + "female" + ] + } + }, + smile: { + serializedName: "smile", + type: { + name: "Number" + } + }, + facialHair: { + serializedName: "facialHair", + type: { + name: "Composite", + className: "FacialHair" + } + }, + glasses: { + serializedName: "glasses", + type: { + name: "Enum", + allowedValues: [ + "noGlasses", + "readingGlasses", + "sunglasses", + "swimmingGoggles" + ] + } + }, + headPose: { + serializedName: "headPose", + type: { + name: "Composite", + className: "HeadPose" + } + }, + emotion: { + serializedName: "emotion", + type: { + name: "Composite", + className: "Emotion" + } + }, + hair: { + serializedName: "hair", + type: { + name: "Composite", + className: "Hair" + } + }, + makeup: { + serializedName: "makeup", + type: { + name: "Composite", + className: "Makeup" + } + }, + occlusion: { + serializedName: "occlusion", + type: { + name: "Composite", + className: "Occlusion" + } + }, + accessories: { + serializedName: "accessories", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Accessory" + } + } + } + }, + blur: { + serializedName: "blur", + type: { + name: "Composite", + className: "Blur" + } + }, + exposure: { + serializedName: "exposure", + type: { + name: "Composite", + className: "Exposure" + } + }, + noise: { + serializedName: "noise", + type: { + name: "Composite", + className: "Noise" + } + } + } + } +}; + +export const DetectedFace: msRest.CompositeMapper = { + serializedName: "DetectedFace", + type: { + name: "Composite", + className: "DetectedFace", + modelProperties: { + faceId: { + serializedName: "faceId", + type: { + name: "Uuid" + } + }, + recognitionModel: { + nullable: false, + serializedName: "recognitionModel", + defaultValue: 'recognition_01', + type: { + name: "String" + } + }, + faceRectangle: { + required: true, + serializedName: "faceRectangle", + type: { + name: "Composite", + className: "FaceRectangle" + } + }, + faceLandmarks: { + serializedName: "faceLandmarks", + type: { + name: "Composite", + className: "FaceLandmarks" + } + }, + faceAttributes: { + serializedName: "faceAttributes", + type: { + name: "Composite", + className: "FaceAttributes" + } + } + } + } +}; + +export const FindSimilarRequest: msRest.CompositeMapper = { + serializedName: "FindSimilarRequest", + type: { + name: "Composite", + className: "FindSimilarRequest", + modelProperties: { + faceId: { + required: true, + serializedName: "faceId", + type: { + name: "Uuid" + } + }, + faceListId: { + serializedName: "faceListId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + largeFaceListId: { + serializedName: "largeFaceListId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + faceIds: { + serializedName: "faceIds", + constraints: { + MaxItems: 1000 + }, + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + }, + maxNumOfCandidatesReturned: { + serializedName: "maxNumOfCandidatesReturned", + defaultValue: 20, + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + }, + mode: { + nullable: false, + serializedName: "mode", + defaultValue: 'matchPerson', + type: { + name: "Enum", + allowedValues: [ + "matchPerson", + "matchFace" + ] + } + } + } + } +}; + +export const SimilarFace: msRest.CompositeMapper = { + serializedName: "SimilarFace", + type: { + name: "Composite", + className: "SimilarFace", + modelProperties: { + faceId: { + serializedName: "faceId", + type: { + name: "Uuid" + } + }, + persistedFaceId: { + serializedName: "persistedFaceId", + type: { + name: "Uuid" + } + }, + confidence: { + required: true, + serializedName: "confidence", + type: { + name: "Number" + } + } + } + } +}; + +export const GroupRequest: msRest.CompositeMapper = { + serializedName: "GroupRequest", + type: { + name: "Composite", + className: "GroupRequest", + modelProperties: { + faceIds: { + required: true, + serializedName: "faceIds", + constraints: { + MaxItems: 1000 + }, + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + } +}; + +export const GroupResult: msRest.CompositeMapper = { + serializedName: "GroupResult", + type: { + name: "Composite", + className: "GroupResult", + modelProperties: { + groups: { + required: true, + serializedName: "groups", + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + }, + messyGroup: { + serializedName: "messyGroup", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + } +}; + +export const IdentifyRequest: msRest.CompositeMapper = { + serializedName: "IdentifyRequest", + type: { + name: "Composite", + className: "IdentifyRequest", + modelProperties: { + faceIds: { + required: true, + serializedName: "faceIds", + constraints: { + MaxItems: 10 + }, + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + }, + personGroupId: { + serializedName: "personGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + largePersonGroupId: { + serializedName: "largePersonGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + maxNumOfCandidatesReturned: { + serializedName: "maxNumOfCandidatesReturned", + defaultValue: 1, + constraints: { + InclusiveMaximum: 5, + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + }, + confidenceThreshold: { + serializedName: "confidenceThreshold", + type: { + name: "Number" + } + } + } + } +}; + +export const IdentifyCandidate: msRest.CompositeMapper = { + serializedName: "IdentifyCandidate", + type: { + name: "Composite", + className: "IdentifyCandidate", + modelProperties: { + personId: { + required: true, + serializedName: "personId", + type: { + name: "Uuid" + } + }, + confidence: { + required: true, + serializedName: "confidence", + type: { + name: "Number" + } + } + } + } +}; + +export const IdentifyResult: msRest.CompositeMapper = { + serializedName: "IdentifyResult", + type: { + name: "Composite", + className: "IdentifyResult", + modelProperties: { + faceId: { + required: true, + serializedName: "faceId", + type: { + name: "Uuid" + } + }, + candidates: { + required: true, + serializedName: "candidates", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "IdentifyCandidate" + } + } + } + } + } + } +}; + +export const VerifyFaceToPersonRequest: msRest.CompositeMapper = { + serializedName: "VerifyFaceToPersonRequest", + type: { + name: "Composite", + className: "VerifyFaceToPersonRequest", + modelProperties: { + faceId: { + required: true, + serializedName: "faceId", + type: { + name: "Uuid" + } + }, + personGroupId: { + serializedName: "personGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + largePersonGroupId: { + serializedName: "largePersonGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + personId: { + required: true, + serializedName: "personId", + type: { + name: "Uuid" + } + } + } + } +}; + +export const VerifyFaceToFaceRequest: msRest.CompositeMapper = { + serializedName: "VerifyFaceToFaceRequest", + type: { + name: "Composite", + className: "VerifyFaceToFaceRequest", + modelProperties: { + faceId1: { + required: true, + serializedName: "faceId1", + type: { + name: "Uuid" + } + }, + faceId2: { + required: true, + serializedName: "faceId2", + type: { + name: "Uuid" + } + } + } + } +}; + +export const VerifyResult: msRest.CompositeMapper = { + serializedName: "VerifyResult", + type: { + name: "Composite", + className: "VerifyResult", + modelProperties: { + isIdentical: { + required: true, + serializedName: "isIdentical", + type: { + name: "Boolean" + } + }, + confidence: { + required: true, + serializedName: "confidence", + type: { + name: "Number" + } + } + } + } +}; + +export const PersistedFace: msRest.CompositeMapper = { + serializedName: "PersistedFace", + type: { + name: "Composite", + className: "PersistedFace", + modelProperties: { + persistedFaceId: { + required: true, + serializedName: "persistedFaceId", + type: { + name: "Uuid" + } + }, + userData: { + serializedName: "userData", + constraints: { + MaxLength: 1024 + }, + type: { + name: "String" + } + } + } + } +}; + +export const NameAndUserDataContract: msRest.CompositeMapper = { + serializedName: "NameAndUserDataContract", + type: { + name: "Composite", + className: "NameAndUserDataContract", + modelProperties: { + name: { + serializedName: "name", + constraints: { + MaxLength: 128 + }, + type: { + name: "String" + } + }, + userData: { + serializedName: "userData", + constraints: { + MaxLength: 16384 + }, + type: { + name: "String" + } + } + } + } +}; + +export const MetaDataContract: msRest.CompositeMapper = { + serializedName: "MetaDataContract", + type: { + name: "Composite", + className: "MetaDataContract", + modelProperties: { + ...NameAndUserDataContract.type.modelProperties, + recognitionModel: { + nullable: false, + serializedName: "recognitionModel", + defaultValue: 'recognition_01', + type: { + name: "String" + } + } + } + } +}; + +export const FaceList: msRest.CompositeMapper = { + serializedName: "FaceList", + type: { + name: "Composite", + className: "FaceList", + modelProperties: { + ...MetaDataContract.type.modelProperties, + faceListId: { + required: true, + serializedName: "faceListId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + persistedFaces: { + serializedName: "persistedFaces", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PersistedFace" + } + } + } + } + } + } +}; + +export const PersonGroup: msRest.CompositeMapper = { + serializedName: "PersonGroup", + type: { + name: "Composite", + className: "PersonGroup", + modelProperties: { + ...MetaDataContract.type.modelProperties, + personGroupId: { + required: true, + serializedName: "personGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } + } + } +}; + +export const Person: msRest.CompositeMapper = { + serializedName: "Person", + type: { + name: "Composite", + className: "Person", + modelProperties: { + ...NameAndUserDataContract.type.modelProperties, + personId: { + required: true, + serializedName: "personId", + type: { + name: "Uuid" + } + }, + persistedFaceIds: { + serializedName: "persistedFaceIds", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + } +}; + +export const LargeFaceList: msRest.CompositeMapper = { + serializedName: "LargeFaceList", + type: { + name: "Composite", + className: "LargeFaceList", + modelProperties: { + ...MetaDataContract.type.modelProperties, + largeFaceListId: { + required: true, + serializedName: "largeFaceListId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } + } + } +}; + +export const LargePersonGroup: msRest.CompositeMapper = { + serializedName: "LargePersonGroup", + type: { + name: "Composite", + className: "LargePersonGroup", + modelProperties: { + ...MetaDataContract.type.modelProperties, + largePersonGroupId: { + required: true, + serializedName: "largePersonGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } + } + } +}; + +export const UpdateFaceRequest: msRest.CompositeMapper = { + serializedName: "UpdateFaceRequest", + type: { + name: "Composite", + className: "UpdateFaceRequest", + modelProperties: { + userData: { + serializedName: "userData", + constraints: { + MaxLength: 1024 + }, + type: { + name: "String" + } + } + } + } +}; + +export const TrainingStatus: msRest.CompositeMapper = { + serializedName: "TrainingStatus", + type: { + name: "Composite", + className: "TrainingStatus", + modelProperties: { + status: { + required: true, + serializedName: "status", + type: { + name: "Enum", + allowedValues: [ + "nonstarted", + "running", + "succeeded", + "failed" + ] + } + }, + created: { + required: true, + serializedName: "createdDateTime", + type: { + name: "DateTime" + } + }, + lastAction: { + serializedName: "lastActionDateTime", + type: { + name: "DateTime" + } + }, + lastSuccessfulTraining: { + serializedName: "lastSuccessfulTrainingDateTime", + type: { + name: "DateTime" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ApplySnapshotRequest: msRest.CompositeMapper = { + serializedName: "ApplySnapshotRequest", + type: { + name: "Composite", + className: "ApplySnapshotRequest", + modelProperties: { + objectId: { + required: true, + serializedName: "objectId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + }, + mode: { + nullable: false, + serializedName: "mode", + defaultValue: 'CreateNew', + type: { + name: "Enum", + allowedValues: [ + "CreateNew" + ] + } + } + } + } +}; + +export const Snapshot: msRest.CompositeMapper = { + serializedName: "Snapshot", + type: { + name: "Composite", + className: "Snapshot", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "Uuid" + } + }, + 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: { + type: { + name: "Uuid" + } + } + } + }, + userData: { + serializedName: "userData", + constraints: { + MaxLength: 16384 + }, + type: { + name: "String" + } + }, + createdTime: { + required: true, + serializedName: "createdTime", + type: { + name: "DateTime" + } + }, + lastUpdateTime: { + required: true, + serializedName: "lastUpdateTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const TakeSnapshotRequest: msRest.CompositeMapper = { + 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: { + type: { + name: "Uuid" + } + } + } + }, + userData: { + serializedName: "userData", + constraints: { + MaxLength: 16384 + }, + type: { + name: "String" + } + } + } + } +}; + +export const UpdateSnapshotRequest: msRest.CompositeMapper = { + serializedName: "UpdateSnapshotRequest", + type: { + name: "Composite", + className: "UpdateSnapshotRequest", + modelProperties: { + applyScope: { + serializedName: "applyScope", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + }, + userData: { + serializedName: "userData", + constraints: { + MaxLength: 16384 + }, + type: { + name: "String" + } + } + } + } +}; + +export const OperationStatus: msRest.CompositeMapper = { + 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: { + serializedName: "lastActionTime", + type: { + name: "DateTime" + } + }, + resourceLocation: { + serializedName: "resourceLocation", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ImageUrl: msRest.CompositeMapper = { + serializedName: "ImageUrl", + type: { + name: "Composite", + className: "ImageUrl", + modelProperties: { + url: { + required: true, + serializedName: "url", + type: { + name: "String" + } + } + } + } +}; + +export const SnapshotTakeHeaders: msRest.CompositeMapper = { + serializedName: "snapshot-take-headers", + type: { + name: "Composite", + className: "SnapshotTakeHeaders", + modelProperties: { + operationLocation: { + serializedName: "operation-location", + type: { + name: "String" + } + } + } + } +}; + +export const SnapshotApplyHeaders: msRest.CompositeMapper = { + serializedName: "snapshot-apply-headers", + type: { + name: "Composite", + className: "SnapshotApplyHeaders", + modelProperties: { + operationLocation: { + serializedName: "operation-location", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/parameters.ts new file mode 100644 index 000000000000..46fe4d5c4622 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/parameters.ts @@ -0,0 +1,324 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; + +export const applyScope: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "applyScope" + ], + mapper: { + serializedName: "applyScope", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + }, + collectionFormat: msRest.QueryCollectionFormat.Csv +}; +export const faceListId: msRest.OperationURLParameter = { + parameterPath: "faceListId", + mapper: { + required: true, + serializedName: "faceListId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } +}; +export const largeFaceListId: msRest.OperationURLParameter = { + parameterPath: "largeFaceListId", + mapper: { + required: true, + serializedName: "largeFaceListId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } +}; +export const largePersonGroupId: msRest.OperationURLParameter = { + parameterPath: "largePersonGroupId", + mapper: { + required: true, + serializedName: "largePersonGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } +}; +export const operationId: msRest.OperationURLParameter = { + parameterPath: "operationId", + mapper: { + required: true, + serializedName: "operationId", + type: { + name: "Uuid" + } + } +}; +export const persistedFaceId: msRest.OperationURLParameter = { + parameterPath: "persistedFaceId", + mapper: { + required: true, + serializedName: "persistedFaceId", + type: { + name: "Uuid" + } + } +}; +export const personGroupId: msRest.OperationURLParameter = { + parameterPath: "personGroupId", + mapper: { + required: true, + serializedName: "personGroupId", + constraints: { + MaxLength: 64, + Pattern: /^[a-z0-9-_]+$/ + }, + type: { + name: "String" + } + } +}; +export const personId: msRest.OperationURLParameter = { + parameterPath: "personId", + mapper: { + required: true, + serializedName: "personId", + type: { + name: "Uuid" + } + } +}; +export const recognitionModel: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "recognitionModel" + ], + mapper: { + nullable: false, + serializedName: "recognitionModel", + defaultValue: 'recognition_01', + type: { + name: "String" + } + } +}; +export const returnFaceAttributes: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "returnFaceAttributes" + ], + mapper: { + serializedName: "returnFaceAttributes", + type: { + name: "Sequence", + element: { + type: { + name: "Enum", + allowedValues: [ + "age", + "gender", + "headPose", + "smile", + "facialHair", + "glasses", + "emotion", + "hair", + "makeup", + "occlusion", + "accessories", + "blur", + "exposure", + "noise" + ] + } + } + } + }, + collectionFormat: msRest.QueryCollectionFormat.Csv +}; +export const returnFaceId: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "returnFaceId" + ], + mapper: { + serializedName: "returnFaceId", + defaultValue: true, + type: { + name: "Boolean" + } + } +}; +export const returnFaceLandmarks: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "returnFaceLandmarks" + ], + mapper: { + serializedName: "returnFaceLandmarks", + defaultValue: false, + type: { + name: "Boolean" + } + } +}; +export const returnRecognitionModel: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "returnRecognitionModel" + ], + mapper: { + serializedName: "returnRecognitionModel", + defaultValue: false, + type: { + name: "Boolean" + } + } +}; +export const snapshotId: msRest.OperationURLParameter = { + parameterPath: "snapshotId", + mapper: { + required: true, + serializedName: "snapshotId", + type: { + name: "Uuid" + } + } +}; +export const start0: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "start" + ], + mapper: { + serializedName: "start", + type: { + name: "String" + } + } +}; +export const start1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "start" + ], + mapper: { + serializedName: "start", + constraints: { + MaxLength: 64 + }, + type: { + name: "String" + } + } +}; +export const targetFace: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "targetFace" + ], + mapper: { + serializedName: "targetFace", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + collectionFormat: msRest.QueryCollectionFormat.Csv +}; +export const top0: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "top" + ], + mapper: { + serializedName: "top", + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + } +}; +export const top1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "top" + ], + mapper: { + serializedName: "top", + defaultValue: 1000, + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + type: { + name: "Number" + } + } +}; +export const type: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "type" + ], + mapper: { + serializedName: "type", + type: { + name: "Enum", + allowedValues: [ + "FaceList", + "LargeFaceList", + "LargePersonGroup", + "PersonGroup" + ] + } + } +}; +export const userData: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "userData" + ], + mapper: { + serializedName: "userData", + constraints: { + MaxLength: 1024 + }, + type: { + name: "String" + } + } +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/personGroupOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/personGroupOperationsMappers.ts new file mode 100644 index 000000000000..9b0f1466efdd --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/personGroupOperationsMappers.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ + +export { + MetaDataContract, + NameAndUserDataContract, + APIError, + ErrorModel, + PersonGroup, + TrainingStatus, + FaceList, + PersistedFace, + Person, + LargeFaceList, + LargePersonGroup +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/personGroupPersonMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/personGroupPersonMappers.ts new file mode 100644 index 000000000000..6e4d194810cc --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/personGroupPersonMappers.ts @@ -0,0 +1,25 @@ +/* + * 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. + */ + +export { + NameAndUserDataContract, + Person, + APIError, + ErrorModel, + PersistedFace, + UpdateFaceRequest, + ImageUrl, + MetaDataContract, + FaceList, + PersonGroup, + LargeFaceList, + LargePersonGroup +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/models/snapshotOperationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/models/snapshotOperationsMappers.ts new file mode 100644 index 000000000000..7b6eabb1de82 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/models/snapshotOperationsMappers.ts @@ -0,0 +1,22 @@ +/* + * 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. + */ + +export { + TakeSnapshotRequest, + SnapshotTakeHeaders, + APIError, + ErrorModel, + Snapshot, + UpdateSnapshotRequest, + ApplySnapshotRequest, + SnapshotApplyHeaders, + OperationStatus +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/face.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/face.ts new file mode 100644 index 000000000000..a00f8c9cc551 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/face.ts @@ -0,0 +1,603 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/faceMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a Face. */ +export class Face { + private readonly client: FaceClientContext; + + /** + * Create a Face. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * 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 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 + * @param [options] The optional parameters + * @returns Promise + */ + findSimilar(faceId: string, options?: Models.FaceFindSimilarOptionalParams): Promise; + /** + * @param 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 + * @param callback The callback + */ + findSimilar(faceId: string, callback: msRest.ServiceCallback): void; + /** + * @param 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 + * @param options The optional parameters + * @param callback The callback + */ + findSimilar(faceId: string, options: Models.FaceFindSimilarOptionalParams, callback: msRest.ServiceCallback): void; + findSimilar(faceId: string, options?: Models.FaceFindSimilarOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceId, + options + }, + findSimilarOperationSpec, + callback) as Promise; + } + + /** + * 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 faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces + * @param [options] The optional parameters + * @returns Promise + */ + group(faceIds: string[], options?: msRest.RequestOptionsBase): Promise; + /** + * @param faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces + * @param callback The callback + */ + group(faceIds: string[], callback: msRest.ServiceCallback): void; + /** + * @param faceIds Array of candidate faceId created by Face - Detect. The maximum is 1000 faces + * @param options The optional parameters + * @param callback The callback + */ + group(faceIds: string[], options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + group(faceIds: string[], options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceIds, + options + }, + groupOperationSpec, + callback) as Promise; + } + + /** + * 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 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]. + * @param [options] The optional parameters + * @returns Promise + */ + identify(faceIds: string[], options?: Models.FaceIdentifyOptionalParams): Promise; + /** + * @param 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]. + * @param callback The callback + */ + identify(faceIds: string[], callback: msRest.ServiceCallback): void; + /** + * @param 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]. + * @param options The optional parameters + * @param callback The callback + */ + identify(faceIds: string[], options: Models.FaceIdentifyOptionalParams, callback: msRest.ServiceCallback): void; + identify(faceIds: string[], options?: Models.FaceIdentifyOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceIds, + options + }, + identifyOperationSpec, + callback) as Promise; + } + + /** + * 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 faceId1 FaceId of the first face, comes from Face - Detect + * @param faceId2 FaceId of the second face, comes from Face - Detect + * @param [options] The optional parameters + * @returns Promise + */ + verifyFaceToFace(faceId1: string, faceId2: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param faceId1 FaceId of the first face, comes from Face - Detect + * @param faceId2 FaceId of the second face, comes from Face - Detect + * @param callback The callback + */ + verifyFaceToFace(faceId1: string, faceId2: string, callback: msRest.ServiceCallback): void; + /** + * @param faceId1 FaceId of the first face, comes from Face - Detect + * @param faceId2 FaceId of the second face, comes from Face - Detect + * @param options The optional parameters + * @param callback The callback + */ + verifyFaceToFace(faceId1: string, faceId2: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + verifyFaceToFace(faceId1: string, faceId2: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceId1, + faceId2, + options + }, + verifyFaceToFaceOperationSpec, + callback) as Promise; + } + + /** + * 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 url Publicly reachable URL of an image + * @param [options] The optional parameters + * @returns Promise + */ + detectWithUrl(url: string, options?: Models.FaceDetectWithUrlOptionalParams): Promise; + /** + * @param url Publicly reachable URL of an image + * @param callback The callback + */ + detectWithUrl(url: string, callback: msRest.ServiceCallback): void; + /** + * @param url Publicly reachable URL of an image + * @param options The optional parameters + * @param callback The callback + */ + detectWithUrl(url: string, options: Models.FaceDetectWithUrlOptionalParams, callback: msRest.ServiceCallback): void; + detectWithUrl(url: string, options?: Models.FaceDetectWithUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + url, + options + }, + detectWithUrlOperationSpec, + callback) as Promise; + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id + * @param faceId FaceId of the face, comes from Face - Detect + * @param 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. + * @param [options] The optional parameters + * @returns Promise + */ + verifyFaceToPerson(faceId: string, personId: string, options?: Models.FaceVerifyFaceToPersonOptionalParams): Promise; + /** + * @param faceId FaceId of the face, comes from Face - Detect + * @param 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. + * @param callback The callback + */ + verifyFaceToPerson(faceId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param faceId FaceId of the face, comes from Face - Detect + * @param 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. + * @param options The optional parameters + * @param callback The callback + */ + verifyFaceToPerson(faceId: string, personId: string, options: Models.FaceVerifyFaceToPersonOptionalParams, callback: msRest.ServiceCallback): void; + verifyFaceToPerson(faceId: string, personId: string, options?: Models.FaceVerifyFaceToPersonOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceId, + personId, + options + }, + verifyFaceToPersonOperationSpec, + callback) as Promise; + } + + /** + * Detect human faces in an image and returns face locations, and optionally with faceIds, + * landmarks, and attributes. + * @param image An image stream. + * @param [options] The optional parameters + * @returns Promise + */ + detectWithStream(image: msRest.HttpRequestBody, options?: Models.FaceDetectWithStreamOptionalParams): Promise; + /** + * @param image An image stream. + * @param callback The callback + */ + detectWithStream(image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; + /** + * @param image An image stream. + * @param options The optional parameters + * @param callback The callback + */ + detectWithStream(image: msRest.HttpRequestBody, options: Models.FaceDetectWithStreamOptionalParams, callback: msRest.ServiceCallback): void; + detectWithStream(image: msRest.HttpRequestBody, options?: Models.FaceDetectWithStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + image, + options + }, + detectWithStreamOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const findSimilarOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "findsimilars", + requestBody: { + parameterPath: { + faceId: "faceId", + faceListId: [ + "options", + "faceListId" + ], + largeFaceListId: [ + "options", + "largeFaceListId" + ], + faceIds: [ + "options", + "faceIds" + ], + maxNumOfCandidatesReturned: [ + "options", + "maxNumOfCandidatesReturned" + ], + mode: [ + "options", + "mode" + ] + }, + mapper: { + ...Mappers.FindSimilarRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SimilarFace" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const groupOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "group", + requestBody: { + parameterPath: { + faceIds: "faceIds" + }, + mapper: { + ...Mappers.GroupRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.GroupResult + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const identifyOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "identify", + requestBody: { + parameterPath: { + faceIds: "faceIds", + personGroupId: [ + "options", + "personGroupId" + ], + largePersonGroupId: [ + "options", + "largePersonGroupId" + ], + maxNumOfCandidatesReturned: [ + "options", + "maxNumOfCandidatesReturned" + ], + confidenceThreshold: [ + "options", + "confidenceThreshold" + ] + }, + mapper: { + ...Mappers.IdentifyRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "IdentifyResult" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const verifyFaceToFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "verify", + requestBody: { + parameterPath: { + faceId1: "faceId1", + faceId2: "faceId2" + }, + mapper: { + ...Mappers.VerifyFaceToFaceRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.VerifyResult + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const detectWithUrlOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "detect", + queryParameters: [ + Parameters.returnFaceId, + Parameters.returnFaceLandmarks, + Parameters.returnFaceAttributes, + Parameters.recognitionModel, + Parameters.returnRecognitionModel + ], + requestBody: { + parameterPath: { + url: "url" + }, + mapper: { + ...Mappers.ImageUrl, + required: true + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DetectedFace" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const verifyFaceToPersonOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "verify", + requestBody: { + parameterPath: { + faceId: "faceId", + personGroupId: [ + "options", + "personGroupId" + ], + largePersonGroupId: [ + "options", + "largePersonGroupId" + ], + personId: "personId" + }, + mapper: { + ...Mappers.VerifyFaceToPersonRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.VerifyResult + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const detectWithStreamOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "detect", + queryParameters: [ + Parameters.returnFaceId, + Parameters.returnFaceLandmarks, + Parameters.returnFaceAttributes, + Parameters.recognitionModel, + Parameters.returnRecognitionModel + ], + requestBody: { + parameterPath: "image", + mapper: { + required: true, + serializedName: "Image", + type: { + name: "Stream" + } + } + }, + contentType: "application/octet-stream", + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DetectedFace" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/faceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/faceListOperations.ts new file mode 100644 index 000000000000..0631842720c0 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/faceListOperations.ts @@ -0,0 +1,497 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/faceListOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a FaceListOperations. */ +export class FaceListOperations { + private readonly client: FaceClientContext; + + /** + * Create a FaceListOperations. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * 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 faceListId Id referencing a particular face list. + * @param [options] The optional parameters + * @returns Promise + */ + create(faceListId: string, options?: Models.FaceListCreateOptionalParams): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param callback The callback + */ + create(faceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param options The optional parameters + * @param callback The callback + */ + create(faceListId: string, options: Models.FaceListCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(faceListId: string, options?: Models.FaceListCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + options + }, + createOperationSpec, + callback); + } + + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * @param faceListId Id referencing a particular face list. + * @param [options] The optional parameters + * @returns Promise + */ + get(faceListId: string, options?: Models.FaceListGetOptionalParams): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param callback The callback + */ + get(faceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param options The optional parameters + * @param callback The callback + */ + get(faceListId: string, options: Models.FaceListGetOptionalParams, callback: msRest.ServiceCallback): void; + get(faceListId: string, options?: Models.FaceListGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update information of a face list. + * @param faceListId Id referencing a particular face list. + * @param [options] The optional parameters + * @returns Promise + */ + update(faceListId: string, options?: Models.FaceListUpdateOptionalParams): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param callback The callback + */ + update(faceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param options The optional parameters + * @param callback The callback + */ + update(faceListId: string, options: Models.FaceListUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(faceListId: string, options?: Models.FaceListUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + options + }, + updateOperationSpec, + callback); + } + + /** + * Delete an existing face list according to faceListId. Persisted face images in the face list + * will also be deleted. + * @param faceListId Id referencing a particular face list. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(faceListId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param callback The callback + */ + deleteMethod(faceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(faceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(faceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * List face lists’ faceListId, name, userData and recognitionModel.
+ * To get face information inside faceList use [FaceList - + * Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c) + * @param [options] The optional parameters + * @returns Promise + */ + list(options?: Models.FaceListListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.FaceListListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.FaceListListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * 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 faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + deleteFace(faceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + deleteFace(faceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + deleteFace(faceListId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteFace(faceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + persistedFaceId, + options + }, + deleteFaceOperationSpec, + callback); + } + + /** + * Add a face to a face list. The input face is specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * @param faceListId Id referencing a particular face list. + * @param url Publicly reachable URL of an image + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromUrl(faceListId: string, url: string, options?: Models.FaceListAddFaceFromUrlOptionalParams): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param url Publicly reachable URL of an image + * @param callback The callback + */ + addFaceFromUrl(faceListId: string, url: string, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param url Publicly reachable URL of an image + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromUrl(faceListId: string, url: string, options: Models.FaceListAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromUrl(faceListId: string, url: string, options?: Models.FaceListAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + url, + options + }, + addFaceFromUrlOperationSpec, + callback) as Promise; + } + + /** + * Add a face to a face list. The input face is specified as an image with a targetFace rectangle. + * It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, options?: Models.FaceListAddFaceFromStreamOptionalParams): Promise; + /** + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param callback The callback + */ + addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; + /** + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, options: Models.FaceListAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromStream(faceListId: string, image: msRest.HttpRequestBody, options?: Models.FaceListAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + faceListId, + image, + options + }, + addFaceFromStreamOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "facelists/{faceListId}", + urlParameters: [ + Parameters.faceListId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ], + recognitionModel: [ + "options", + "recognitionModel" + ] + }, + mapper: { + ...Mappers.MetaDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "facelists/{faceListId}", + urlParameters: [ + Parameters.faceListId + ], + queryParameters: [ + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: Mappers.FaceList + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "facelists/{faceListId}", + urlParameters: [ + Parameters.faceListId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "facelists/{faceListId}", + urlParameters: [ + Parameters.faceListId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "facelists", + queryParameters: [ + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FaceList" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "facelists/{faceListId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.faceListId, + Parameters.persistedFaceId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromUrlOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "facelists/{faceListId}/persistedfaces", + urlParameters: [ + Parameters.faceListId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: { + url: "url" + }, + mapper: { + ...Mappers.ImageUrl, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromStreamOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "facelists/{faceListId}/persistedfaces", + urlParameters: [ + Parameters.faceListId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: "image", + mapper: { + required: true, + serializedName: "Image", + type: { + name: "Stream" + } + } + }, + contentType: "application/octet-stream", + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/index.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/index.ts new file mode 100644 index 000000000000..3a6f9ae466be --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/index.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export * from "./face"; +export * from "./personGroupPerson"; +export * from "./personGroupOperations"; +export * from "./faceListOperations"; +export * from "./largePersonGroupPerson"; +export * from "./largePersonGroupOperations"; +export * from "./largeFaceListOperations"; +export * from "./snapshotOperations"; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largeFaceListOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largeFaceListOperations.ts new file mode 100644 index 000000000000..bd6ebb8c3556 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largeFaceListOperations.ts @@ -0,0 +1,778 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/largeFaceListOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a LargeFaceListOperations. */ +export class LargeFaceListOperations { + private readonly client: FaceClientContext; + + /** + * Create a LargeFaceListOperations. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * 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 largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + create(largeFaceListId: string, options?: Models.LargeFaceListCreateOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + create(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + create(largeFaceListId: string, options: Models.LargeFaceListCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(largeFaceListId: string, options?: Models.LargeFaceListCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + createOperationSpec, + callback); + } + + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * @param largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + get(largeFaceListId: string, options?: Models.LargeFaceListGetOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + get(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + get(largeFaceListId: string, options: Models.LargeFaceListGetOptionalParams, callback: msRest.ServiceCallback): void; + get(largeFaceListId: string, options?: Models.LargeFaceListGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update information of a large face list. + * @param largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + update(largeFaceListId: string, options?: Models.LargeFaceListUpdateOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + update(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + update(largeFaceListId: string, options: Models.LargeFaceListUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(largeFaceListId: string, options?: Models.LargeFaceListUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + updateOperationSpec, + callback); + } + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large + * face list will also be deleted. + * @param largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(largeFaceListId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + deleteMethod(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(largeFaceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(largeFaceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * @param largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + getTrainingStatus(largeFaceListId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + getTrainingStatus(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + getTrainingStatus(largeFaceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getTrainingStatus(largeFaceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + getTrainingStatusOperationSpec, + callback) as Promise; + } + + /** + * 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 [options] The optional parameters + * @returns Promise + */ + list(options?: Models.LargeFaceListListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.LargeFaceListListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.LargeFaceListListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Queue a large face list training task, the training task may not be started immediately. + * @param largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + train(largeFaceListId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + train(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + train(largeFaceListId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + train(largeFaceListId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + trainOperationSpec, + callback); + } + + /** + * 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. + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + deleteFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + deleteFace(largeFaceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + deleteFace(largeFaceListId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + persistedFaceId, + options + }, + deleteFaceOperationSpec, + callback); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging + * largeFaceListId). + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + getFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + getFace(largeFaceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + getFace(largeFaceListId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getFace(largeFaceListId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + persistedFaceId, + options + }, + getFaceOperationSpec, + callback) as Promise; + } + + /** + * Update a persisted face's userData field. + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + updateFace(largeFaceListId: string, persistedFaceId: string, options?: Models.LargeFaceListUpdateFaceOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + updateFace(largeFaceListId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + updateFace(largeFaceListId: string, persistedFaceId: string, options: Models.LargeFaceListUpdateFaceOptionalParams, callback: msRest.ServiceCallback): void; + updateFace(largeFaceListId: string, persistedFaceId: string, options?: Models.LargeFaceListUpdateFaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + persistedFaceId, + options + }, + updateFaceOperationSpec, + callback); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace + * rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will + * not expire. + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromUrl(largeFaceListId: string, url: string, options?: Models.LargeFaceListAddFaceFromUrlOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param callback The callback + */ + addFaceFromUrl(largeFaceListId: string, url: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromUrl(largeFaceListId: string, url: string, options: Models.LargeFaceListAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromUrl(largeFaceListId: string, url: string, options?: Models.LargeFaceListAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + url, + options + }, + addFaceFromUrlOperationSpec, + callback) as Promise; + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and + * persistedFaceIds of registered faces of the face). + * @param largeFaceListId Id referencing a particular large face list. + * @param [options] The optional parameters + * @returns Promise + */ + listFaces(largeFaceListId: string, options?: Models.LargeFaceListListFacesOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param callback The callback + */ + listFaces(largeFaceListId: string, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param options The optional parameters + * @param callback The callback + */ + listFaces(largeFaceListId: string, options: Models.LargeFaceListListFacesOptionalParams, callback: msRest.ServiceCallback): void; + listFaces(largeFaceListId: string, options?: Models.LargeFaceListListFacesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + options + }, + listFacesOperationSpec, + callback) as Promise; + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace + * rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will + * not expire. + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, options?: Models.LargeFaceListAddFaceFromStreamOptionalParams): Promise; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param callback The callback + */ + addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; + /** + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, options: Models.LargeFaceListAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromStream(largeFaceListId: string, image: msRest.HttpRequestBody, options?: Models.LargeFaceListAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largeFaceListId, + image, + options + }, + addFaceFromStreamOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "largefacelists/{largeFaceListId}", + urlParameters: [ + Parameters.largeFaceListId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ], + recognitionModel: [ + "options", + "recognitionModel" + ] + }, + mapper: { + ...Mappers.MetaDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largefacelists/{largeFaceListId}", + urlParameters: [ + Parameters.largeFaceListId + ], + queryParameters: [ + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: Mappers.LargeFaceList + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "largefacelists/{largeFaceListId}", + urlParameters: [ + Parameters.largeFaceListId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "largefacelists/{largeFaceListId}", + urlParameters: [ + Parameters.largeFaceListId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getTrainingStatusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largefacelists/{largeFaceListId}/training", + urlParameters: [ + Parameters.largeFaceListId + ], + responses: { + 200: { + bodyMapper: Mappers.TrainingStatus + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largefacelists", + queryParameters: [ + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LargeFaceList" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const trainOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largefacelists/{largeFaceListId}/train", + urlParameters: [ + Parameters.largeFaceListId + ], + responses: { + 202: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.largeFaceListId, + Parameters.persistedFaceId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.largeFaceListId, + Parameters.persistedFaceId + ], + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.largeFaceListId, + Parameters.persistedFaceId + ], + requestBody: { + parameterPath: { + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.UpdateFaceRequest, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromUrlOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largefacelists/{largeFaceListId}/persistedfaces", + urlParameters: [ + Parameters.largeFaceListId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: { + url: "url" + }, + mapper: { + ...Mappers.ImageUrl, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listFacesOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largefacelists/{largeFaceListId}/persistedfaces", + urlParameters: [ + Parameters.largeFaceListId + ], + queryParameters: [ + Parameters.start0, + Parameters.top0 + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PersistedFace" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromStreamOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largefacelists/{largeFaceListId}/persistedfaces", + urlParameters: [ + Parameters.largeFaceListId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: "image", + mapper: { + required: true, + serializedName: "Image", + type: { + name: "Stream" + } + } + }, + contentType: "application/octet-stream", + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largePersonGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largePersonGroupOperations.ts new file mode 100644 index 000000000000..3159fd0339dd --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largePersonGroupOperations.ts @@ -0,0 +1,426 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/largePersonGroupOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a LargePersonGroupOperations. */ +export class LargePersonGroupOperations { + private readonly client: FaceClientContext; + + /** + * Create a LargePersonGroupOperations. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * 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 largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + create(largePersonGroupId: string, options?: Models.LargePersonGroupCreateOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + create(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + create(largePersonGroupId: string, options: Models.LargePersonGroupCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(largePersonGroupId: string, options?: Models.LargePersonGroupCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + createOperationSpec, + callback); + } + + /** + * Delete an existing large person group. Persisted face features of all people in the large person + * group will also be deleted. + * @param largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(largePersonGroupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + deleteMethod(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(largePersonGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(largePersonGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * 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 largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + get(largePersonGroupId: string, options?: Models.LargePersonGroupGetOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + get(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + get(largePersonGroupId: string, options: Models.LargePersonGroupGetOptionalParams, callback: msRest.ServiceCallback): void; + get(largePersonGroupId: string, options?: Models.LargePersonGroupGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update an existing large person group's display name and userData. The properties which does not + * appear in request body will not be updated. + * @param largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + update(largePersonGroupId: string, options?: Models.LargePersonGroupUpdateOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + update(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + update(largePersonGroupId: string, options: Models.LargePersonGroupUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(largePersonGroupId: string, options?: Models.LargePersonGroupUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + updateOperationSpec, + callback); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * @param largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + getTrainingStatus(largePersonGroupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + getTrainingStatus(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + getTrainingStatus(largePersonGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getTrainingStatus(largePersonGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + getTrainingStatusOperationSpec, + callback) as Promise; + } + + /** + * 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 [options] The optional parameters + * @returns Promise + */ + list(options?: Models.LargePersonGroupListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.LargePersonGroupListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.LargePersonGroupListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Queue a large person group training task, the training task may not be started immediately. + * @param largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + train(largePersonGroupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + train(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + train(largePersonGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + train(largePersonGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + trainOperationSpec, + callback); + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "largepersongroups/{largePersonGroupId}", + urlParameters: [ + Parameters.largePersonGroupId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ], + recognitionModel: [ + "options", + "recognitionModel" + ] + }, + mapper: { + ...Mappers.MetaDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "largepersongroups/{largePersonGroupId}", + urlParameters: [ + Parameters.largePersonGroupId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largepersongroups/{largePersonGroupId}", + urlParameters: [ + Parameters.largePersonGroupId + ], + queryParameters: [ + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: Mappers.LargePersonGroup + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "largepersongroups/{largePersonGroupId}", + urlParameters: [ + Parameters.largePersonGroupId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getTrainingStatusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largepersongroups/{largePersonGroupId}/training", + urlParameters: [ + Parameters.largePersonGroupId + ], + responses: { + 200: { + bodyMapper: Mappers.TrainingStatus + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largepersongroups", + queryParameters: [ + Parameters.start1, + Parameters.top1, + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LargePersonGroup" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const trainOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largepersongroups/{largePersonGroupId}/train", + urlParameters: [ + Parameters.largePersonGroupId + ], + responses: { + 202: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largePersonGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largePersonGroupPerson.ts new file mode 100644 index 000000000000..dd7eefc85bef --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/largePersonGroupPerson.ts @@ -0,0 +1,627 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/largePersonGroupPersonMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a LargePersonGroupPerson. */ +export class LargePersonGroupPerson { + private readonly client: FaceClientContext; + + /** + * Create a LargePersonGroupPerson. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * Create a new person in a specified large person group. + * @param largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + create(largePersonGroupId: string, options?: Models.LargePersonGroupPersonCreateOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + create(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + create(largePersonGroupId: string, options: Models.LargePersonGroupPersonCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(largePersonGroupId: string, options?: Models.LargePersonGroupPersonCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, + * name, userData and persistedFaceIds of registered faces of the person). + * @param largePersonGroupId Id referencing a particular large person group. + * @param [options] The optional parameters + * @returns Promise + */ + list(largePersonGroupId: string, options?: Models.LargePersonGroupPersonListOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param callback The callback + */ + list(largePersonGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param options The optional parameters + * @param callback The callback + */ + list(largePersonGroupId: string, options: Models.LargePersonGroupPersonListOptionalParams, callback: msRest.ServiceCallback): void; + list(largePersonGroupId: string, options?: Models.LargePersonGroupPersonListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Delete an existing person from a large person group. All stored person data, and face features + * in the person entry will be deleted. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param callback The callback + */ + deleteMethod(largePersonGroupId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(largePersonGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param [options] The optional parameters + * @returns Promise + */ + get(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param callback The callback + */ + get(largePersonGroupId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param options The optional parameters + * @param callback The callback + */ + get(largePersonGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(largePersonGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update name or userData of a person. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param [options] The optional parameters + * @returns Promise + */ + update(largePersonGroupId: string, personId: string, options?: Models.LargePersonGroupPersonUpdateOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param callback The callback + */ + update(largePersonGroupId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param options The optional parameters + * @param callback The callback + */ + update(largePersonGroupId: string, personId: string, options: Models.LargePersonGroupPersonUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(largePersonGroupId: string, personId: string, options?: Models.LargePersonGroupPersonUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + options + }, + updateOperationSpec, + callback); + } + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + persistedFaceId, + options + }, + deleteFaceOperationSpec, + callback); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its + * belonging largePersonGroupId). + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + persistedFaceId, + options + }, + getFaceOperationSpec, + callback) as Promise; + } + + /** + * Update a person persisted face's userData field. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: Models.LargePersonGroupPersonUpdateFaceOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options: Models.LargePersonGroupPersonUpdateFaceOptionalParams, callback: msRest.ServiceCallback): void; + updateFace(largePersonGroupId: string, personId: string, persistedFaceId: string, options?: Models.LargePersonGroupPersonUpdateFaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + persistedFaceId, + options + }, + updateFaceOperationSpec, + callback); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an + * image with a targetFace rectangle. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, options?: Models.LargePersonGroupPersonAddFaceFromUrlOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param callback The callback + */ + addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, options: Models.LargePersonGroupPersonAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromUrl(largePersonGroupId: string, personId: string, url: string, options?: Models.LargePersonGroupPersonAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + url, + options + }, + addFaceFromUrlOperationSpec, + callback) as Promise; + } + + /** + * Add a representative face to a person for identification. The input face is specified as an + * image with a targetFace rectangle. + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.LargePersonGroupPersonAddFaceFromStreamOptionalParams): Promise; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param callback The callback + */ + addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; + /** + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, options: Models.LargePersonGroupPersonAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromStream(largePersonGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.LargePersonGroupPersonAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + largePersonGroupId, + personId, + image, + options + }, + addFaceFromStreamOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largepersongroups/{largePersonGroupId}/persons", + urlParameters: [ + Parameters.largePersonGroupId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.Person + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largepersongroups/{largePersonGroupId}/persons", + urlParameters: [ + Parameters.largePersonGroupId + ], + queryParameters: [ + Parameters.start0, + Parameters.top0 + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Person" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId + ], + responses: { + 200: { + bodyMapper: Mappers.Person + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId, + Parameters.persistedFaceId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId, + Parameters.persistedFaceId + ], + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId, + Parameters.persistedFaceId + ], + requestBody: { + parameterPath: { + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.UpdateFaceRequest, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromUrlOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: { + url: "url" + }, + mapper: { + ...Mappers.ImageUrl, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromStreamOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces", + urlParameters: [ + Parameters.largePersonGroupId, + Parameters.personId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: "image", + mapper: { + required: true, + serializedName: "Image", + type: { + name: "Stream" + } + } + }, + contentType: "application/octet-stream", + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/personGroupOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/personGroupOperations.ts new file mode 100644 index 000000000000..c153c59adc7e --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/personGroupOperations.ts @@ -0,0 +1,426 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/personGroupOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a PersonGroupOperations. */ +export class PersonGroupOperations { + private readonly client: FaceClientContext; + + /** + * Create a PersonGroupOperations. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * 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 personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + create(personGroupId: string, options?: Models.PersonGroupCreateOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + create(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + create(personGroupId: string, options: Models.PersonGroupCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(personGroupId: string, options?: Models.PersonGroupCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + createOperationSpec, + callback); + } + + /** + * Delete an existing person group. Persisted face features of all people in the person group will + * also be deleted. + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(personGroupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + deleteMethod(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(personGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(personGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this + * personGroup, use [PersonGroup Person - + * List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241). + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + get(personGroupId: string, options?: Models.PersonGroupGetOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + get(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + get(personGroupId: string, options: Models.PersonGroupGetOptionalParams, callback: msRest.ServiceCallback): void; + get(personGroupId: string, options?: Models.PersonGroupGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update an existing person group's display name and userData. The properties which does not + * appear in request body will not be updated. + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + update(personGroupId: string, options?: Models.PersonGroupUpdateOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + update(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + update(personGroupId: string, options: Models.PersonGroupUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(personGroupId: string, options?: Models.PersonGroupUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + updateOperationSpec, + callback); + } + + /** + * Retrieve the training status of a person group (completed or ongoing). + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + getTrainingStatus(personGroupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + getTrainingStatus(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + getTrainingStatus(personGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getTrainingStatus(personGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + getTrainingStatusOperationSpec, + callback) as Promise; + } + + /** + * 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 [options] The optional parameters + * @returns Promise + */ + list(options?: Models.PersonGroupListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.PersonGroupListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.PersonGroupListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Queue a person group training task, the training task may not be started immediately. + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + train(personGroupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + train(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + train(personGroupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + train(personGroupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + trainOperationSpec, + callback); + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "persongroups/{personGroupId}", + urlParameters: [ + Parameters.personGroupId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ], + recognitionModel: [ + "options", + "recognitionModel" + ] + }, + mapper: { + ...Mappers.MetaDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "persongroups/{personGroupId}", + urlParameters: [ + Parameters.personGroupId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "persongroups/{personGroupId}", + urlParameters: [ + Parameters.personGroupId + ], + queryParameters: [ + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: Mappers.PersonGroup + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "persongroups/{personGroupId}", + urlParameters: [ + Parameters.personGroupId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getTrainingStatusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "persongroups/{personGroupId}/training", + urlParameters: [ + Parameters.personGroupId + ], + responses: { + 200: { + bodyMapper: Mappers.TrainingStatus + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "persongroups", + queryParameters: [ + Parameters.start1, + Parameters.top1, + Parameters.returnRecognitionModel + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PersonGroup" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const trainOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "persongroups/{personGroupId}/train", + urlParameters: [ + Parameters.personGroupId + ], + responses: { + 202: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/personGroupPerson.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/personGroupPerson.ts new file mode 100644 index 000000000000..ca73b27172c4 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/personGroupPerson.ts @@ -0,0 +1,627 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/personGroupPersonMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a PersonGroupPerson. */ +export class PersonGroupPerson { + private readonly client: FaceClientContext; + + /** + * Create a PersonGroupPerson. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * Create a new person in a specified person group. + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + create(personGroupId: string, options?: Models.PersonGroupPersonCreateOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + create(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + create(personGroupId: string, options: Models.PersonGroupPersonCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(personGroupId: string, options?: Models.PersonGroupPersonCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * List all persons in a person group, and retrieve person information (including personId, name, + * userData and persistedFaceIds of registered faces of the person). + * @param personGroupId Id referencing a particular person group. + * @param [options] The optional parameters + * @returns Promise + */ + list(personGroupId: string, options?: Models.PersonGroupPersonListOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param callback The callback + */ + list(personGroupId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param options The optional parameters + * @param callback The callback + */ + list(personGroupId: string, options: Models.PersonGroupPersonListOptionalParams, callback: msRest.ServiceCallback): void; + list(personGroupId: string, options?: Models.PersonGroupPersonListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Delete an existing person from a person group. All stored person data, and face features in the + * person entry will be deleted. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param callback The callback + */ + deleteMethod(personGroupId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(personGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param [options] The optional parameters + * @returns Promise + */ + get(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param callback The callback + */ + get(personGroupId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param options The optional parameters + * @param callback The callback + */ + get(personGroupId: string, personId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(personGroupId: string, personId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update name or userData of a person. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param [options] The optional parameters + * @returns Promise + */ + update(personGroupId: string, personId: string, options?: Models.PersonGroupPersonUpdateOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param callback The callback + */ + update(personGroupId: string, personId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param options The optional parameters + * @param callback The callback + */ + update(personGroupId: string, personId: string, options: Models.PersonGroupPersonUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(personGroupId: string, personId: string, options?: Models.PersonGroupPersonUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + options + }, + updateOperationSpec, + callback); + } + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + deleteFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + deleteFace(personGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + deleteFace(personGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + persistedFaceId, + options + }, + deleteFaceOperationSpec, + callback); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its + * belonging personGroupId). + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + getFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + getFace(personGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + getFace(personGroupId: string, personId: string, persistedFaceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getFace(personGroupId: string, personId: string, persistedFaceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + persistedFaceId, + options + }, + getFaceOperationSpec, + callback) as Promise; + } + + /** + * Update a person persisted face's userData field. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param [options] The optional parameters + * @returns Promise + */ + updateFace(personGroupId: string, personId: string, persistedFaceId: string, options?: Models.PersonGroupPersonUpdateFaceOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param callback The callback + */ + updateFace(personGroupId: string, personId: string, persistedFaceId: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param options The optional parameters + * @param callback The callback + */ + updateFace(personGroupId: string, personId: string, persistedFaceId: string, options: Models.PersonGroupPersonUpdateFaceOptionalParams, callback: msRest.ServiceCallback): void; + updateFace(personGroupId: string, personId: string, persistedFaceId: string, options?: Models.PersonGroupPersonUpdateFaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + persistedFaceId, + options + }, + updateFaceOperationSpec, + callback); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an + * image with a targetFace rectangle. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromUrl(personGroupId: string, personId: string, url: string, options?: Models.PersonGroupPersonAddFaceFromUrlOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param callback The callback + */ + addFaceFromUrl(personGroupId: string, personId: string, url: string, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromUrl(personGroupId: string, personId: string, url: string, options: Models.PersonGroupPersonAddFaceFromUrlOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromUrl(personGroupId: string, personId: string, url: string, options?: Models.PersonGroupPersonAddFaceFromUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + url, + options + }, + addFaceFromUrlOperationSpec, + callback) as Promise; + } + + /** + * Add a representative face to a person for identification. The input face is specified as an + * image with a targetFace rectangle. + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param [options] The optional parameters + * @returns Promise + */ + addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.PersonGroupPersonAddFaceFromStreamOptionalParams): Promise; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param callback The callback + */ + addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; + /** + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param options The optional parameters + * @param callback The callback + */ + addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, options: Models.PersonGroupPersonAddFaceFromStreamOptionalParams, callback: msRest.ServiceCallback): void; + addFaceFromStream(personGroupId: string, personId: string, image: msRest.HttpRequestBody, options?: Models.PersonGroupPersonAddFaceFromStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + personGroupId, + personId, + image, + options + }, + addFaceFromStreamOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "persongroups/{personGroupId}/persons", + urlParameters: [ + Parameters.personGroupId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.Person + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "persongroups/{personGroupId}/persons", + urlParameters: [ + Parameters.personGroupId + ], + queryParameters: [ + Parameters.start0, + Parameters.top0 + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Person" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "persongroups/{personGroupId}/persons/{personId}", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "persongroups/{personGroupId}/persons/{personId}", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId + ], + responses: { + 200: { + bodyMapper: Mappers.Person + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "persongroups/{personGroupId}/persons/{personId}", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId + ], + requestBody: { + parameterPath: { + name: [ + "options", + "name" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.NameAndUserDataContract, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId, + Parameters.persistedFaceId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId, + Parameters.persistedFaceId + ], + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateFaceOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId, + Parameters.persistedFaceId + ], + requestBody: { + parameterPath: { + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.UpdateFaceRequest, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromUrlOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: { + url: "url" + }, + mapper: { + ...Mappers.ImageUrl, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const addFaceFromStreamOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "persongroups/{personGroupId}/persons/{personId}/persistedfaces", + urlParameters: [ + Parameters.personGroupId, + Parameters.personId + ], + queryParameters: [ + Parameters.userData, + Parameters.targetFace + ], + requestBody: { + parameterPath: "image", + mapper: { + required: true, + serializedName: "Image", + type: { + name: "Stream" + } + } + }, + contentType: "application/octet-stream", + responses: { + 200: { + bodyMapper: Mappers.PersistedFace + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/lib/operations/snapshotOperations.ts b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/snapshotOperations.ts new file mode 100644 index 000000000000..6662f5ac8f20 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-face/lib/operations/snapshotOperations.ts @@ -0,0 +1,475 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/snapshotOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { FaceClientContext } from "../faceClientContext"; + +/** Class representing a SnapshotOperations. */ +export class SnapshotOperations { + private readonly client: FaceClientContext; + + /** + * Create a SnapshotOperations. + * @param {FaceClientContext} client Reference to the service client. + */ + constructor(client: FaceClientContext) { + this.client = client; + } + + /** + * 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 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 objectId User specified source object id to take snapshot from. + * @param 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 [options] The optional parameters + * @returns Promise + */ + take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], options?: Models.SnapshotTakeOptionalParams): Promise; + /** + * @param 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 objectId User specified source object id to take snapshot from. + * @param 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 callback The callback + */ + take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], callback: msRest.ServiceCallback): void; + /** + * @param 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 objectId User specified source object id to take snapshot from. + * @param 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 options The optional parameters + * @param callback The callback + */ + take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], options: Models.SnapshotTakeOptionalParams, callback: msRest.ServiceCallback): void; + take(type: Models.SnapshotObjectType, objectId: string, applyScope: string[], options?: Models.SnapshotTakeOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + type, + objectId, + applyScope, + options + }, + takeOperationSpec, + callback) as 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 [options] The optional parameters + * @returns Promise + */ + list(options?: Models.SnapshotListOptionalParams): Promise; + /** + * @param callback The callback + */ + list(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + list(options: Models.SnapshotListOptionalParams, callback: msRest.ServiceCallback): void; + list(options?: Models.SnapshotListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listOperationSpec, + callback) as 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 snapshotId Id referencing a particular snapshot. + * @param [options] The optional parameters + * @returns Promise + */ + get(snapshotId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param callback The callback + */ + get(snapshotId: string, callback: msRest.ServiceCallback): void; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param options The optional parameters + * @param callback The callback + */ + get(snapshotId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(snapshotId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + snapshotId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can + * update the snapshot. + * @param snapshotId Id referencing a particular snapshot. + * @param [options] The optional parameters + * @returns Promise + */ + update(snapshotId: string, options?: Models.SnapshotUpdateOptionalParams): Promise; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param callback The callback + */ + update(snapshotId: string, callback: msRest.ServiceCallback): void; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param options The optional parameters + * @param callback The callback + */ + update(snapshotId: string, options: Models.SnapshotUpdateOptionalParams, callback: msRest.ServiceCallback): void; + update(snapshotId: string, options?: Models.SnapshotUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + snapshotId, + options + }, + updateOperationSpec, + callback); + } + + /** + * 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 snapshotId Id referencing a particular snapshot. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(snapshotId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param callback The callback + */ + deleteMethod(snapshotId: string, callback: msRest.ServiceCallback): void; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(snapshotId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(snapshotId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + snapshotId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * 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 snapshotId Id referencing a particular snapshot. + * @param objectId User specified target object id to be created from the snapshot. + * @param [options] The optional parameters + * @returns Promise + */ + apply(snapshotId: string, objectId: string, options?: Models.SnapshotApplyOptionalParams): Promise; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param objectId User specified target object id to be created from the snapshot. + * @param callback The callback + */ + apply(snapshotId: string, objectId: string, callback: msRest.ServiceCallback): void; + /** + * @param snapshotId Id referencing a particular snapshot. + * @param objectId User specified target object id to be created from the snapshot. + * @param options The optional parameters + * @param callback The callback + */ + apply(snapshotId: string, objectId: string, options: Models.SnapshotApplyOptionalParams, callback: msRest.ServiceCallback): void; + apply(snapshotId: string, objectId: string, options?: Models.SnapshotApplyOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + snapshotId, + objectId, + options + }, + applyOperationSpec, + callback) as Promise; + } + + /** + * Retrieve the status of a take/apply snapshot operation. + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param [options] The optional parameters + * @returns Promise + */ + getOperationStatus(operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param callback The callback + */ + getOperationStatus(operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param options The optional parameters + * @param callback The callback + */ + getOperationStatus(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getOperationStatus(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + operationId, + options + }, + getOperationStatusOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const takeOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "snapshots", + requestBody: { + parameterPath: { + type: "type", + objectId: "objectId", + applyScope: "applyScope", + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.TakeSnapshotRequest, + required: true + } + }, + responses: { + 202: { + headersMapper: Mappers.SnapshotTakeHeaders + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "snapshots", + queryParameters: [ + Parameters.type, + Parameters.applyScope + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Snapshot" + } + } + } + } + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "snapshots/{snapshotId}", + urlParameters: [ + Parameters.snapshotId + ], + responses: { + 200: { + bodyMapper: Mappers.Snapshot + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "snapshots/{snapshotId}", + urlParameters: [ + Parameters.snapshotId + ], + requestBody: { + parameterPath: { + applyScope: [ + "options", + "applyScope" + ], + userData: [ + "options", + "userData" + ] + }, + mapper: { + ...Mappers.UpdateSnapshotRequest, + required: true + } + }, + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "snapshots/{snapshotId}", + urlParameters: [ + Parameters.snapshotId + ], + responses: { + 200: {}, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const applyOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "snapshots/{snapshotId}/apply", + urlParameters: [ + Parameters.snapshotId + ], + requestBody: { + parameterPath: { + objectId: "objectId", + mode: [ + "options", + "mode" + ] + }, + mapper: { + ...Mappers.ApplySnapshotRequest, + required: true + } + }, + responses: { + 202: { + headersMapper: Mappers.SnapshotApplyHeaders + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; + +const getOperationStatusOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "operations/{operationId}", + urlParameters: [ + Parameters.operationId + ], + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.APIError + } + }, + serializer +}; diff --git a/sdk/cognitiveservices/cognitiveservices-face/package.json b/sdk/cognitiveservices/cognitiveservices-face/package.json index a37121ff3dfa..474430433251 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/package.json +++ b/sdk/cognitiveservices/cognitiveservices-face/package.json @@ -4,7 +4,7 @@ "description": "FaceClient Library with typescript type definitions for node.js and browser.", "version": "3.0.0", "dependencies": { - "@azure/ms-rest-js": "^1.6.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -25,7 +25,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, - "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-face", + "homepage": "https://github.com/azure/azure-sdk-for-js", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-js.git" @@ -42,8 +42,7 @@ "esm/**/*.js.map", "esm/**/*.d.ts", "esm/**/*.d.ts.map", - "src/**/*.ts", - "README.md", + "lib/**/*.ts", "rollup.config.js", "tsconfig.json" ], @@ -52,6 +51,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-face.js.map'\" -o ./dist/cognitiveservices-face.min.js ./dist/cognitiveservices-face.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "autoPublish": true + "sideEffects": false } diff --git a/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json b/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json index 87bbf5b5fa49..51ea90961ce5 100644 --- a/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json +++ b/sdk/cognitiveservices/cognitiveservices-face/tsconfig.json @@ -14,6 +14,6 @@ "outDir": "./esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./lib/**/*.ts"], "exclude": ["node_modules"] }