diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index a8c074bd376d..e4eb21bde1be 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -146,6 +146,7 @@ com.azure:azure-template-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-media-videoanalyzer-edge;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-verticals-agrifood-farming;1.0.0-beta.2;1.0.0-beta.3 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-cognitiveservices-face;1.0.0-beta.1;1.0.0-beta.1 com.microsoft.azure:spring-cloud-azure-appconfiguration-config-web;1.3.0;1.4.0-beta.1 com.microsoft.azure:spring-cloud-azure-appconfiguration-config;1.3.0;1.4.0-beta.1 com.microsoft.azure:spring-cloud-azure-feature-management-web;1.3.0;1.4.0-beta.1 diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-face/CHANGELOG.md new file mode 100644 index 000000000000..d291b773784b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/CHANGELOG.md @@ -0,0 +1,13 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure FaceClient client library for Java. This package contains Microsoft Azure FaceClient client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/README.md b/sdk/cognitiveservices/azure-cognitiveservices-face/README.md new file mode 100644 index 000000000000..6df080a259f7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/README.md @@ -0,0 +1,63 @@ +# Azure FaceClient client library for Java + +Azure FaceClient client library for Java. + +This package contains Microsoft Azure FaceClient client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-cognitiveservices-face;current}) +```xml + + com.azure + azure-cognitiveservices-face + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.cognitiveservices.face.readme +``` + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/pom.xml b/sdk/cognitiveservices/azure-cognitiveservices-face/pom.xml new file mode 100644 index 000000000000..7504db7f80f4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-cognitiveservices-face + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for FaceClient Management + This package contains Microsoft Azure FaceClient client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.26.0 + + + com.azure + azure-core-http-netty + 1.11.8 + + + org.junit.jupiter + junit-jupiter-engine + 5.8.2 + test + + + com.azure + azure-core-test + 1.7.9 + test + + + com.azure + azure-identity + 1.4.6 + test + + + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceAsyncClient.java new file mode 100644 index 000000000000..9cb73de5804f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceAsyncClient.java @@ -0,0 +1,659 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FacesImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = FaceClientBuilder.class, isAsync = true) +public final class FaceAsyncClient { + @Generated private final FacesImpl serviceClient; + + /** + * Initializes an instance of FaceAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FaceAsyncClient(FacesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * 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 With + * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the time + * specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds that will not + * expire. And a "largeFaceListId" is created by [LargeFaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing persistedFaceIds that will + * also not expire. Depending on the input the returned similar faces list contains faceIds or persistedFaceIds + * ranked by similarity. <br/>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. + * <br/>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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     faceListId: String
+     *     largeFaceListId: String
+     *     faceIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     mode: String(matchPerson/matchFace)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         persistedFaceId: String
+     *         confidence: float
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for Find Similar. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of SimilarFace along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> findSimilarWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.findSimilarWithResponseAsync(body, requestOptions); + } + + /** + * Divide candidate faces into groups based on face similarity.<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 candidate faces. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     groups: [
+     *         [
+     *             String
+     *         ]
+     *     ]
+     *     messyGroup: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param body Request body for grouping. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face groups based on face similarity along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.groupWithResponseAsync(body, requestOptions); + } + + /** + * 1-to-many identification to find the closest matches of the specific query person face from a person group, large + * person group, person directory dynamic person group or person directory personIds array. <br/> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and [LargePersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). <br/> + * + *

Remarks:<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     dynamicPersonGroupId: String
+     *     personIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     confidenceThreshold: Float
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         candidates: [
+     *             {
+     *                 personId: String
+     *                 confidence: float
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for identify operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of IdentifyResult along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> identifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.identifyWithResponseAsync(body, requestOptions); + } + + /** + * Verify whether two faces belong to a same person or whether one face belongs to a person. <br/> + * Remarks:<br /> * 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId1: String
+     *     faceId2: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to face verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyFaceToFaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.verifyFaceToFaceWithResponseAsync(body, requestOptions); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

* 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectWithUrlWithResponse(BinaryData imageUrl, RequestOptions requestOptions) { + return this.serviceClient.detectWithUrlWithResponseAsync(imageUrl, requestOptions); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     personId: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to person verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyFaceToPersonWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.verifyFaceToPersonWithResponseAsync(body, requestOptions); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * + * 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectWithStreamWithResponse(BinaryData image, RequestOptions requestOptions) { + return this.serviceClient.detectWithStreamWithResponseAsync(image, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceClient.java new file mode 100644 index 000000000000..96ebbac00a00 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceClient.java @@ -0,0 +1,656 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = FaceClientBuilder.class) +public final class FaceClient { + @Generated private final FaceAsyncClient asyncClient; + + /** + * Initializes an instance of FaceClient class. + * + * @param asyncClient the async client. + */ + @Generated + FaceClient(FaceAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * 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 With + * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the time + * specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds that will not + * expire. And a "largeFaceListId" is created by [LargeFaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing persistedFaceIds that will + * also not expire. Depending on the input the returned similar faces list contains faceIds or persistedFaceIds + * ranked by similarity. <br/>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. + * <br/>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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     faceListId: String
+     *     largeFaceListId: String
+     *     faceIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     mode: String(matchPerson/matchFace)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         persistedFaceId: String
+     *         confidence: float
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for Find Similar. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of SimilarFace along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response findSimilarWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.findSimilarWithResponse(body, requestOptions).block(); + } + + /** + * Divide candidate faces into groups based on face similarity.<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 candidate faces. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     groups: [
+     *         [
+     *             String
+     *         ]
+     *     ]
+     *     messyGroup: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param body Request body for grouping. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face groups based on face similarity along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.groupWithResponse(body, requestOptions).block(); + } + + /** + * 1-to-many identification to find the closest matches of the specific query person face from a person group, large + * person group, person directory dynamic person group or person directory personIds array. <br/> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and [LargePersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). <br/> + * + *

Remarks:<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     dynamicPersonGroupId: String
+     *     personIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     confidenceThreshold: Float
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         candidates: [
+     *             {
+     *                 personId: String
+     *                 confidence: float
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for identify operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of IdentifyResult along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response identifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.identifyWithResponse(body, requestOptions).block(); + } + + /** + * Verify whether two faces belong to a same person or whether one face belongs to a person. <br/> + * Remarks:<br /> * 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId1: String
+     *     faceId2: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to face verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyFaceToFaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.verifyFaceToFaceWithResponse(body, requestOptions).block(); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

* 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectWithUrlWithResponse(BinaryData imageUrl, RequestOptions requestOptions) { + return this.asyncClient.detectWithUrlWithResponse(imageUrl, requestOptions).block(); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     personId: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to person verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyFaceToPersonWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.verifyFaceToPersonWithResponse(body, requestOptions).block(); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * + * 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectWithStreamWithResponse(BinaryData image, RequestOptions requestOptions) { + return this.asyncClient.detectWithStreamWithResponse(image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceClientBuilder.java new file mode 100644 index 000000000000..bcce339301e7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the FaceClient type. */ +@ServiceClientBuilder(serviceClients = {FaceClient.class, FaceAsyncClient.class}) +public final class FaceClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the FaceClientBuilder. */ + @Generated + public FaceClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the FaceClientBuilder. + */ + @Generated + public FaceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FaceAsyncClient class. + * + * @return an instance of FaceAsyncClient. + */ + @Generated + public FaceAsyncClient buildAsyncClient() { + return new FaceAsyncClient(buildInnerClient().getFaces()); + } + + /** + * Builds an instance of FaceClient class. + * + * @return an instance of FaceClient. + */ + @Generated + public FaceClient buildClient() { + return new FaceClient(new FaceAsyncClient(buildInnerClient().getFaces())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListAsyncClient.java new file mode 100644 index 000000000000..537e917d6ee4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListAsyncClient.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceListsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = FaceListClientBuilder.class, isAsync = true) +public final class FaceListAsyncClient { + @Generated private final FaceListsImpl serviceClient; + + /** + * Initializes an instance of FaceListAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FaceListAsyncClient(FaceListsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * 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. <br /> Face list is a list of faces, up to 1,000 faces, and + * used by [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After + * creation, user should use [FaceList - Add + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No image will be + * stored. Only the extracted face features are stored on server until [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> Please consider + * [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) when the face number is large. It can + * support up to 1,000,000 faces. <br />'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. Please Refer to [Specify a face + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for creating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(String faceListId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(faceListId, body, requestOptions); + } + + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     faceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     persistedFaces: [
+     *         {
+     *             persistedFaceId: String
+     *             userData: String
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return face list object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String faceListId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(faceListId, requestOptions); + } + + /** + * Update information of a face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for updating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse(String faceListId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(faceListId, body, requestOptions); + } + + /** + * Delete a specified face list. + * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String faceListId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(faceListId, requestOptions); + } + + /** + * List face lists’ faceListId, name, userData and recognitionModel. <br /> To get face information inside + * faceList use [FaceList - Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         persistedFaces: [
+     *             {
+     *                 persistedFaceId: String
+     *                 userData: String
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face list results, with fields of faceListId, name and userData along with {@link Response} + * on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * Delete a face from a face list by specified faceListId and persistedFaceId. <br /> Adding/deleting faces + * to/from a same face list are processed sequentially and to/from different face lists are in parallel. + * + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponse( + String faceListId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.deleteFaceWithResponseAsync(faceListId, persistedFaceId, requestOptions); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponse( + String faceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromUrlWithResponseAsync(faceListId, imageUrl, requestOptions); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponse( + String faceListId, BinaryData image, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromStreamWithResponseAsync(faceListId, image, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListClient.java new file mode 100644 index 000000000000..50f33b4fc9cb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListClient.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = FaceListClientBuilder.class) +public final class FaceListClient { + @Generated private final FaceListAsyncClient asyncClient; + + /** + * Initializes an instance of FaceListClient class. + * + * @param asyncClient the async client. + */ + @Generated + FaceListClient(FaceListAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * 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. <br /> Face list is a list of faces, up to 1,000 faces, and + * used by [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After + * creation, user should use [FaceList - Add + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No image will be + * stored. Only the extracted face features are stored on server until [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> Please consider + * [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) when the face number is large. It can + * support up to 1,000,000 faces. <br />'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. Please Refer to [Specify a face + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for creating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String faceListId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createWithResponse(faceListId, body, requestOptions).block(); + } + + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     faceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     persistedFaces: [
+     *         {
+     *             persistedFaceId: String
+     *             userData: String
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return face list object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String faceListId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(faceListId, requestOptions).block(); + } + + /** + * Update information of a face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for updating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String faceListId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(faceListId, body, requestOptions).block(); + } + + /** + * Delete a specified face list. + * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String faceListId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(faceListId, requestOptions).block(); + } + + /** + * List face lists’ faceListId, name, userData and recognitionModel. <br /> To get face information inside + * faceList use [FaceList - Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         persistedFaces: [
+     *             {
+     *                 persistedFaceId: String
+     *                 userData: String
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face list results, with fields of faceListId, name and userData along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(requestOptions).block(); + } + + /** + * Delete a face from a face list by specified faceListId and persistedFaceId. <br /> Adding/deleting faces + * to/from a same face list are processed sequentially and to/from different face lists are in parallel. + * + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String faceListId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient.deleteFaceWithResponse(faceListId, persistedFaceId, requestOptions).block(); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String faceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.asyncClient.addFaceFromUrlWithResponse(faceListId, imageUrl, requestOptions).block(); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String faceListId, BinaryData image, RequestOptions requestOptions) { + return this.asyncClient.addFaceFromStreamWithResponse(faceListId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListClientBuilder.java new file mode 100644 index 000000000000..bc890c30f893 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceListClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the FaceListClient type. */ +@ServiceClientBuilder(serviceClients = {FaceListClient.class, FaceListAsyncClient.class}) +public final class FaceListClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the FaceListClientBuilder. */ + @Generated + public FaceListClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the FaceListClientBuilder. + */ + @Generated + public FaceListClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FaceListAsyncClient class. + * + * @return an instance of FaceListAsyncClient. + */ + @Generated + public FaceListAsyncClient buildAsyncClient() { + return new FaceListAsyncClient(buildInnerClient().getFaceLists()); + } + + /** + * Builds an instance of FaceListClient class. + * + * @return an instance of FaceListClient. + */ + @Generated + public FaceListClient buildClient() { + return new FaceListClient(new FaceListAsyncClient(buildInnerClient().getFaceLists())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceServiceVersion.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceServiceVersion.java new file mode 100644 index 000000000000..4b08740edb3a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/FaceServiceVersion.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.util.ServiceVersion; + +/** Service version of FaceClient. */ +public enum FaceServiceVersion implements ServiceVersion { + /** Enum value 1.0-preview. */ + V1_0_PREVIEW("1.0-preview"); + + private final String version; + + FaceServiceVersion(String version) { + this.version = version; + } + + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link FaceServiceVersion}. + */ + public static FaceServiceVersion getLatest() { + return V1_0_PREVIEW; + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListAsyncClient.java new file mode 100644 index 000000000000..a7b57f69e9b8 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListAsyncClient.java @@ -0,0 +1,518 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.LargeFaceListsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = LargeFaceListClientBuilder.class, isAsync = true) +public final class LargeFaceListAsyncClient { + @Generated private final LargeFaceListsImpl serviceClient; + + /** + * Initializes an instance of LargeFaceListAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LargeFaceListAsyncClient(LargeFaceListsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - + * Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After creation, user + * should use [LargeFaceList Face - Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) + * to import the faces and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) + * to make it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br/>'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. Please refer to [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large face list quota: * Free-tier subscription quota: 64 large face lists. * S0-tier subscription quota: + * 1,000,000 large face lists. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for creating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse( + String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(largeFaceListId, body, requestOptions); + } + + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largeFaceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large face list object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(largeFaceListId, requestOptions); + } + + /** + * Update information of a large face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for updating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse( + String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(largeFaceListId, body, requestOptions); + } + + /** + * Delete a specified large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(largeFaceListId, requestOptions); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponse( + String largeFaceListId, RequestOptions requestOptions) { + return this.serviceClient.getTrainingStatusWithResponseAsync(largeFaceListId, requestOptions); + } + + /** + * List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get + * face information inside largeFaceList use [LargeFaceList Face - + * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)<br /> * 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. <br /> For example, total 5 large person lists: "list1", ..., + * "list5". <br /> "start=&top=" will return all 5 lists. <br /> "start=&top=2" will return + * "list1", "list2". <br /> "start=list2&top=3" will return "list3", "list4", "list5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
startStringNoStarting large face list id to return (used to list a range of large face lists).
topStringNoNumber of large face lists to return starting with the large face list id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largeFaceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large face list results, with fields of largeFaceListId, name and userData along with {@link + * Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.serviceClient.trainWithResponseAsync(largeFaceListId, requestOptions); + } + + /** + * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> + * Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face + * lists are in parallel. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponse( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.deleteFaceWithResponseAsync(largeFaceListId, persistedFaceId, requestOptions); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponse( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.getFaceWithResponseAsync(largeFaceListId, persistedFaceId, requestOptions); + } + + /** + * Update a persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponse( + String largeFaceListId, String persistedFaceId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateFaceWithResponseAsync(largeFaceListId, persistedFaceId, body, requestOptions); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponse( + String largeFaceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromUrlWithResponseAsync(largeFaceListId, imageUrl, requestOptions); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of + * registered faces of the face). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting face id to return (used to list a range of faces).
topStringNoNumber of faces to return starting with the face id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         persistedFaceId: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of persisted faces within the face list or large face list along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listFacesWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.serviceClient.listFacesWithResponseAsync(largeFaceListId, requestOptions); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponse( + String largeFaceListId, BinaryData image, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromStreamWithResponseAsync(largeFaceListId, image, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListClient.java new file mode 100644 index 000000000000..6f02a57873c5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListClient.java @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = LargeFaceListClientBuilder.class) +public final class LargeFaceListClient { + @Generated private final LargeFaceListAsyncClient asyncClient; + + /** + * Initializes an instance of LargeFaceListClient class. + * + * @param asyncClient the async client. + */ + @Generated + LargeFaceListClient(LargeFaceListAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - + * Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After creation, user + * should use [LargeFaceList Face - Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) + * to import the faces and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) + * to make it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br/>'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. Please refer to [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large face list quota: * Free-tier subscription quota: 64 large face lists. * S0-tier subscription quota: + * 1,000,000 large face lists. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for creating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createWithResponse(largeFaceListId, body, requestOptions).block(); + } + + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largeFaceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large face list object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(largeFaceListId, requestOptions).block(); + } + + /** + * Update information of a large face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for updating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(largeFaceListId, body, requestOptions).block(); + } + + /** + * Delete a specified large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(largeFaceListId, requestOptions).block(); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTrainingStatusWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.asyncClient.getTrainingStatusWithResponse(largeFaceListId, requestOptions).block(); + } + + /** + * List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get + * face information inside largeFaceList use [LargeFaceList Face - + * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)<br /> * 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. <br /> For example, total 5 large person lists: "list1", ..., + * "list5". <br /> "start=&top=" will return all 5 lists. <br /> "start=&top=2" will return + * "list1", "list2". <br /> "start=list2&top=3" will return "list3", "list4", "list5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
startStringNoStarting large face list id to return (used to list a range of large face lists).
topStringNoNumber of large face lists to return starting with the large face list id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largeFaceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large face list results, with fields of largeFaceListId, name and userData along with {@link + * Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.asyncClient.trainWithResponse(largeFaceListId, requestOptions).block(); + } + + /** + * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> + * Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face + * lists are in parallel. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient.deleteFaceWithResponse(largeFaceListId, persistedFaceId, requestOptions).block(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFaceWithResponse( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient.getFaceWithResponse(largeFaceListId, persistedFaceId, requestOptions).block(); + } + + /** + * Update a persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateFaceWithResponse( + String largeFaceListId, String persistedFaceId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateFaceWithResponse(largeFaceListId, persistedFaceId, body, requestOptions).block(); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String largeFaceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.asyncClient.addFaceFromUrlWithResponse(largeFaceListId, imageUrl, requestOptions).block(); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of + * registered faces of the face). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting face id to return (used to list a range of faces).
topStringNoNumber of faces to return starting with the face id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         persistedFaceId: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of persisted faces within the face list or large face list along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listFacesWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return this.asyncClient.listFacesWithResponse(largeFaceListId, requestOptions).block(); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String largeFaceListId, BinaryData image, RequestOptions requestOptions) { + return this.asyncClient.addFaceFromStreamWithResponse(largeFaceListId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListClientBuilder.java new file mode 100644 index 000000000000..5fd644780e49 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargeFaceListClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the LargeFaceListClient type. */ +@ServiceClientBuilder(serviceClients = {LargeFaceListClient.class, LargeFaceListAsyncClient.class}) +public final class LargeFaceListClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the LargeFaceListClientBuilder. */ + @Generated + public LargeFaceListClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the LargeFaceListClientBuilder. + */ + @Generated + public LargeFaceListClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of LargeFaceListAsyncClient class. + * + * @return an instance of LargeFaceListAsyncClient. + */ + @Generated + public LargeFaceListAsyncClient buildAsyncClient() { + return new LargeFaceListAsyncClient(buildInnerClient().getLargeFaceLists()); + } + + /** + * Builds an instance of LargeFaceListClient class. + * + * @return an instance of LargeFaceListClient. + */ + @Generated + public LargeFaceListClient buildClient() { + return new LargeFaceListClient(new LargeFaceListAsyncClient(buildInnerClient().getLargeFaceLists())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupAsyncClient.java new file mode 100644 index 000000000000..957e11f61ef3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupAsyncClient.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.LargePersonGroupsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = LargePersonGroupClientBuilder.class, isAsync = true) +public final class LargePersonGroupAsyncClient { + @Generated private final LargePersonGroupsImpl serviceClient; + + /** + * Initializes an instance of LargePersonGroupAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LargePersonGroupAsyncClient(LargePersonGroupsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData and + * recognitionModel. <br /> A large person group is the container of the uploaded person data, including face + * recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person into the group, + * and call [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get + * this group ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> + * No image will be stored. Only the person's extracted face features and userData will be stored on server until + * [LargePersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. + * <br/>'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. Please refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large person group quota: * Free-tier subscription quota: 1,000 large person groups. * S0-tier subscription + * quota: 1,000,000 large person groups. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(largePersonGroupId, body, requestOptions); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(largePersonGroupId, requestOptions); + } + + /** + * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve person + * information under the large person group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largePersonGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large person group object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(largePersonGroupId, requestOptions); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in + * request body will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for updating large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(largePersonGroupId, body, requestOptions); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponse( + String largePersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.getTrainingStatusWithResponseAsync(largePersonGroupId, requestOptions); + } + + /** + * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br /> * + * 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. <br /> For example, total 5 large + * person groups: "group1", ..., "group5". <br /> "start=&top=" will return all 5 groups. <br /> + * "start=&top=2" will return "group1", "group2". <br /> "start=group2&top=3" will return "group3", + * "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList large person groups from the least largePersonGroupId greater than the "start".
topStringNoThe number of large person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largePersonGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large person groups along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.trainWithResponseAsync(largePersonGroupId, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupClient.java new file mode 100644 index 000000000000..6ed1940a16fd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupClient.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = LargePersonGroupClientBuilder.class) +public final class LargePersonGroupClient { + @Generated private final LargePersonGroupAsyncClient asyncClient; + + /** + * Initializes an instance of LargePersonGroupClient class. + * + * @param asyncClient the async client. + */ + @Generated + LargePersonGroupClient(LargePersonGroupAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData and + * recognitionModel. <br /> A large person group is the container of the uploaded person data, including face + * recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person into the group, + * and call [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get + * this group ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> + * No image will be stored. Only the person's extracted face features and userData will be stored on server until + * [LargePersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. + * <br/>'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. Please refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large person group quota: * Free-tier subscription quota: 1,000 large person groups. * S0-tier subscription + * quota: 1,000,000 large person groups. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createWithResponse(largePersonGroupId, body, requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(largePersonGroupId, requestOptions).block(); + } + + /** + * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve person + * information under the large person group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largePersonGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large person group object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(largePersonGroupId, requestOptions).block(); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in + * request body will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for updating large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(largePersonGroupId, body, requestOptions).block(); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTrainingStatusWithResponse( + String largePersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.getTrainingStatusWithResponse(largePersonGroupId, requestOptions).block(); + } + + /** + * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br /> * + * 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. <br /> For example, total 5 large + * person groups: "group1", ..., "group5". <br /> "start=&top=" will return all 5 groups. <br /> + * "start=&top=2" will return "group1", "group2". <br /> "start=group2&top=3" will return "group3", + * "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList large person groups from the least largePersonGroupId greater than the "start".
topStringNoThe number of large person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largePersonGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large person groups along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.trainWithResponse(largePersonGroupId, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupClientBuilder.java new file mode 100644 index 000000000000..5389f611ca27 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the LargePersonGroupClient type. */ +@ServiceClientBuilder(serviceClients = {LargePersonGroupClient.class, LargePersonGroupAsyncClient.class}) +public final class LargePersonGroupClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the LargePersonGroupClientBuilder. */ + @Generated + public LargePersonGroupClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the LargePersonGroupClientBuilder. + */ + @Generated + public LargePersonGroupClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of LargePersonGroupAsyncClient class. + * + * @return an instance of LargePersonGroupAsyncClient. + */ + @Generated + public LargePersonGroupAsyncClient buildAsyncClient() { + return new LargePersonGroupAsyncClient(buildInnerClient().getLargePersonGroups()); + } + + /** + * Builds an instance of LargePersonGroupClient class. + * + * @return an instance of LargePersonGroupClient. + */ + @Generated + public LargePersonGroupClient buildClient() { + return new LargePersonGroupClient(new LargePersonGroupAsyncClient(buildInnerClient().getLargePersonGroups())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonAsyncClient.java new file mode 100644 index 000000000000..b4098c835d59 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonAsyncClient.java @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.LargePersonGroupPersonsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = LargePersonGroupPersonClientBuilder.class, isAsync = true) +public final class LargePersonGroupPersonAsyncClient { + @Generated private final LargePersonGroupPersonsImpl serviceClient; + + /** + * Initializes an instance of LargePersonGroupPersonAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LargePersonGroupPersonAsyncClient(LargePersonGroupPersonsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create a new person in a specified large person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(largePersonGroupId, body, requestOptions); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(largePersonGroupId, requestOptions); + } + + /** + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and face feature + * in the person entry will all be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(largePersonGroupId, personId, requestOptions); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face feature. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(largePersonGroupId, personId, requestOptions); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse( + String largePersonGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(largePersonGroupId, personId, body, requestOptions); + } + + /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. <br /> Adding/deleting faces to/from a same person will be processed sequentially. + * Adding/deleting faces to/from different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponse( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.deleteFaceWithResponseAsync( + largePersonGroupId, personId, persistedFaceId, requestOptions); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * largePersonGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponse( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.getFaceWithResponseAsync( + largePersonGroupId, personId, persistedFaceId, requestOptions); + } + + /** + * Update a person persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponse( + String largePersonGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.updateFaceWithResponseAsync( + largePersonGroupId, personId, persistedFaceId, body, requestOptions); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponse( + String largePersonGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromUrlWithResponseAsync( + largePersonGroupId, personId, imageUrl, requestOptions); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponse( + String largePersonGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromStreamWithResponseAsync( + largePersonGroupId, personId, image, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonClient.java new file mode 100644 index 000000000000..35034f1401f2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonClient.java @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = LargePersonGroupPersonClientBuilder.class) +public final class LargePersonGroupPersonClient { + @Generated private final LargePersonGroupPersonAsyncClient asyncClient; + + /** + * Initializes an instance of LargePersonGroupPersonClient class. + * + * @param asyncClient the async client. + */ + @Generated + LargePersonGroupPersonClient(LargePersonGroupPersonAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Create a new person in a specified large person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createWithResponse(largePersonGroupId, body, requestOptions).block(); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(largePersonGroupId, requestOptions).block(); + } + + /** + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and face feature + * in the person entry will all be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(largePersonGroupId, personId, requestOptions).block(); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face feature. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(largePersonGroupId, personId, requestOptions).block(); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String largePersonGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(largePersonGroupId, personId, body, requestOptions).block(); + } + + /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. <br /> Adding/deleting faces to/from a same person will be processed sequentially. + * Adding/deleting faces to/from different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient + .deleteFaceWithResponse(largePersonGroupId, personId, persistedFaceId, requestOptions) + .block(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * largePersonGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFaceWithResponse( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient + .getFaceWithResponse(largePersonGroupId, personId, persistedFaceId, requestOptions) + .block(); + } + + /** + * Update a person persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateFaceWithResponse( + String largePersonGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return this.asyncClient + .updateFaceWithResponse(largePersonGroupId, personId, persistedFaceId, body, requestOptions) + .block(); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String largePersonGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.asyncClient + .addFaceFromUrlWithResponse(largePersonGroupId, personId, imageUrl, requestOptions) + .block(); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String largePersonGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return this.asyncClient + .addFaceFromStreamWithResponse(largePersonGroupId, personId, image, requestOptions) + .block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonClientBuilder.java new file mode 100644 index 000000000000..0579d2bd26cd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/LargePersonGroupPersonClientBuilder.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the LargePersonGroupPersonClient type. */ +@ServiceClientBuilder(serviceClients = {LargePersonGroupPersonClient.class, LargePersonGroupPersonAsyncClient.class}) +public final class LargePersonGroupPersonClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the LargePersonGroupPersonClientBuilder. */ + @Generated + public LargePersonGroupPersonClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the LargePersonGroupPersonClientBuilder. + */ + @Generated + public LargePersonGroupPersonClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of LargePersonGroupPersonAsyncClient class. + * + * @return an instance of LargePersonGroupPersonAsyncClient. + */ + @Generated + public LargePersonGroupPersonAsyncClient buildAsyncClient() { + return new LargePersonGroupPersonAsyncClient(buildInnerClient().getLargePersonGroupPersons()); + } + + /** + * Builds an instance of LargePersonGroupPersonClient class. + * + * @return an instance of LargePersonGroupPersonClient. + */ + @Generated + public LargePersonGroupPersonClient buildClient() { + return new LargePersonGroupPersonClient( + new LargePersonGroupPersonAsyncClient(buildInnerClient().getLargePersonGroupPersons())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryAsyncClient.java new file mode 100644 index 000000000000..72f53c3126bf --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryAsyncClient.java @@ -0,0 +1,625 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.PersonDirectoriesImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = PersonDirectoryClientBuilder.class, isAsync = true) +public final class PersonDirectoryAsyncClient { + @Generated private final PersonDirectoriesImpl serviceClient; + + /** + * Initializes an instance of PersonDirectoryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PersonDirectoryAsyncClient(PersonDirectoriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Retrieve list of person information in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoThe start parameter
topStringNoThe top parameter
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of EnrollmentResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getPersonsWithResponseAsync(requestOptions); + } + + /** + * Creates a new person in person directory. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     * }
+     * }
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createPersonWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createPersonWithResponseAsync(body, requestOptions); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId The personId parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePersonWithResponse( + String personId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updatePersonWithResponseAsync(personId, body, requestOptions); + } + + /** + * Delete an existing person from person directory. The persistedFaceId, userData, person name and face feature(s) + * in the person entry will all be deleted. + * + * @param personId The personId parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deletePersonWithResponse(String personId, RequestOptions requestOptions) { + return this.serviceClient.deletePersonWithResponseAsync(personId, requestOptions); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face + * feature(s). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonWithResponse(String personId, RequestOptions requestOptions) { + return this.serviceClient.getPersonWithResponseAsync(personId, requestOptions); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addPersonFaceWithResponse( + String personId, String recognitionModel, RequestOptions requestOptions) { + return this.serviceClient.addPersonFaceWithResponseAsync(personId, recognitionModel, requestOptions); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get persistedFaceIds from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonFacesWithResponse( + String personId, String recognitionModel, RequestOptions requestOptions) { + return this.serviceClient.getPersonFacesWithResponseAsync(personId, recognitionModel, requestOptions); + } + + /** + * Delete an existing person face from person directory. The persistedFaceId, userData, and face feature in the + * person entry will all be deleted. + * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param persistedFaceId Persisted face id to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deletePersonFaceWithResponse( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.deletePersonFaceWithResponseAsync( + personId, recognitionModel, persistedFaceId, requestOptions); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId Target person face id to get. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonFaceWithResponse( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.getPersonFaceWithResponseAsync( + personId, recognitionModel, persistedFaceId, requestOptions); + } + + /** + * Update the data of a person face. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     detectionModel: String(detection_01/detection_02/detection_03/detection_preview_1904/ir_detection_01/expression_01)
+     *     faceFeature: byte[]
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to update face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId PersistedFaceId created from Person Face Create. + * @param body Target person face id to update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePersonFaceWithResponse( + String personId, + String recognitionModel, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.updatePersonFaceWithResponseAsync( + personId, recognitionModel, persistedFaceId, body, requestOptions); + } + + /** + * Creates a new dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. A + * dynamic person group is a container that references persons. After creation, use "DynamicPersonGroup - Update" to + * add/remove persons into the search space. DynamicPersonGroup and UserData will be stored on server until + * DynamicPersonGroup Delete is called. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. Valid format should be a string composed by + * numbers, English letters in lower case, '-', '_', and no longer than 64 characters. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, body, requestOptions); + } + + /** + * Updates an existing dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     removePersonIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, body, requestOptions); + } + + /** + * Get metadata on a dynamic person group. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     dynamicPersonGroupId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return metadata on a dynamic person group along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.getDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, requestOptions); + } + + /** + * Delete an existing dynamic person group. Note that Persons are not deleted with this operation. To delete person + * call Person Delete. + * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.deleteDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, requestOptions); + } + + /** + * Retrieve list of persons referenced in a given DynamicPersonGroup person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of persons to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId Dynamic person group Id to list persons from. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupPersonsWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return this.serviceClient.listDynamicPersonGroupPersonsWithResponseAsync(dynamicPersonGroupId, requestOptions); + } + + /** + * Retrieve list of dynamic person groups in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamicPersonGroupId from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroups to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         dynamicPersonGroupId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DynamicPersonGroupGetResponse along with {@link Response} on successful completion of {@link + * Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listDynamicPersonGroupsWithResponseAsync(requestOptions); + } + + /** + * List the dynamic person groups that a person has been referenced in. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamic person group id from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroupId to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     dynamicPersonGroupIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personId Valid PersonId created from Person Create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupPersonReferencesWithResponse( + String personId, RequestOptions requestOptions) { + return this.serviceClient.listDynamicPersonGroupPersonReferencesWithResponseAsync(personId, requestOptions); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addPersonFaceFromStreamWithResponse( + String personId, String recognitionModel, BinaryData image, RequestOptions requestOptions) { + return this.serviceClient.addPersonFaceFromStreamWithResponseAsync( + personId, recognitionModel, image, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryClient.java new file mode 100644 index 000000000000..57091ce1eb05 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryClient.java @@ -0,0 +1,629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = PersonDirectoryClientBuilder.class) +public final class PersonDirectoryClient { + @Generated private final PersonDirectoryAsyncClient asyncClient; + + /** + * Initializes an instance of PersonDirectoryClient class. + * + * @param asyncClient the async client. + */ + @Generated + PersonDirectoryClient(PersonDirectoryAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Retrieve list of person information in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoThe start parameter
topStringNoThe top parameter
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of EnrollmentResponse along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonsWithResponse(RequestOptions requestOptions) { + return this.asyncClient.getPersonsWithResponse(requestOptions).block(); + } + + /** + * Creates a new person in person directory. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     * }
+     * }
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createPersonWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createPersonWithResponse(body, requestOptions).block(); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId The personId parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePersonWithResponse(String personId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updatePersonWithResponse(personId, body, requestOptions).block(); + } + + /** + * Delete an existing person from person directory. The persistedFaceId, userData, person name and face feature(s) + * in the person entry will all be deleted. + * + * @param personId The personId parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deletePersonWithResponse(String personId, RequestOptions requestOptions) { + return this.asyncClient.deletePersonWithResponse(personId, requestOptions).block(); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face + * feature(s). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonWithResponse(String personId, RequestOptions requestOptions) { + return this.asyncClient.getPersonWithResponse(personId, requestOptions).block(); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addPersonFaceWithResponse( + String personId, String recognitionModel, RequestOptions requestOptions) { + return this.asyncClient.addPersonFaceWithResponse(personId, recognitionModel, requestOptions).block(); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get persistedFaceIds from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonFacesWithResponse( + String personId, String recognitionModel, RequestOptions requestOptions) { + return this.asyncClient.getPersonFacesWithResponse(personId, recognitionModel, requestOptions).block(); + } + + /** + * Delete an existing person face from person directory. The persistedFaceId, userData, and face feature in the + * person entry will all be deleted. + * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param persistedFaceId Persisted face id to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deletePersonFaceWithResponse( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient + .deletePersonFaceWithResponse(personId, recognitionModel, persistedFaceId, requestOptions) + .block(); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId Target person face id to get. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonFaceWithResponse( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient + .getPersonFaceWithResponse(personId, recognitionModel, persistedFaceId, requestOptions) + .block(); + } + + /** + * Update the data of a person face. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     detectionModel: String(detection_01/detection_02/detection_03/detection_preview_1904/ir_detection_01/expression_01)
+     *     faceFeature: byte[]
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to update face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId PersistedFaceId created from Person Face Create. + * @param body Target person face id to update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePersonFaceWithResponse( + String personId, + String recognitionModel, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return this.asyncClient + .updatePersonFaceWithResponse(personId, recognitionModel, persistedFaceId, body, requestOptions) + .block(); + } + + /** + * Creates a new dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. A + * dynamic person group is a container that references persons. After creation, use "DynamicPersonGroup - Update" to + * add/remove persons into the search space. DynamicPersonGroup and UserData will be stored on server until + * DynamicPersonGroup Delete is called. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. Valid format should be a string composed by + * numbers, English letters in lower case, '-', '_', and no longer than 64 characters. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient + .createDynamicPersonGroupWithResponse(dynamicPersonGroupId, body, requestOptions) + .block(); + } + + /** + * Updates an existing dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     removePersonIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient + .updateDynamicPersonGroupWithResponse(dynamicPersonGroupId, body, requestOptions) + .block(); + } + + /** + * Get metadata on a dynamic person group. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     dynamicPersonGroupId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return metadata on a dynamic person group along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.getDynamicPersonGroupWithResponse(dynamicPersonGroupId, requestOptions).block(); + } + + /** + * Delete an existing dynamic person group. Note that Persons are not deleted with this operation. To delete person + * call Person Delete. + * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.deleteDynamicPersonGroupWithResponse(dynamicPersonGroupId, requestOptions).block(); + } + + /** + * Retrieve list of persons referenced in a given DynamicPersonGroup person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of persons to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId Dynamic person group Id to list persons from. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDynamicPersonGroupPersonsWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return this.asyncClient.listDynamicPersonGroupPersonsWithResponse(dynamicPersonGroupId, requestOptions).block(); + } + + /** + * Retrieve list of dynamic person groups in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamicPersonGroupId from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroups to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         dynamicPersonGroupId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DynamicPersonGroupGetResponse along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDynamicPersonGroupsWithResponse(RequestOptions requestOptions) { + return this.asyncClient.listDynamicPersonGroupsWithResponse(requestOptions).block(); + } + + /** + * List the dynamic person groups that a person has been referenced in. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamic person group id from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroupId to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     dynamicPersonGroupIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personId Valid PersonId created from Person Create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDynamicPersonGroupPersonReferencesWithResponse( + String personId, RequestOptions requestOptions) { + return this.asyncClient.listDynamicPersonGroupPersonReferencesWithResponse(personId, requestOptions).block(); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addPersonFaceFromStreamWithResponse( + String personId, String recognitionModel, BinaryData image, RequestOptions requestOptions) { + return this.asyncClient + .addPersonFaceFromStreamWithResponse(personId, recognitionModel, image, requestOptions) + .block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryClientBuilder.java new file mode 100644 index 000000000000..33816eddb770 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonDirectoryClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the PersonDirectoryClient type. */ +@ServiceClientBuilder(serviceClients = {PersonDirectoryClient.class, PersonDirectoryAsyncClient.class}) +public final class PersonDirectoryClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the PersonDirectoryClientBuilder. */ + @Generated + public PersonDirectoryClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the PersonDirectoryClientBuilder. + */ + @Generated + public PersonDirectoryClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PersonDirectoryAsyncClient class. + * + * @return an instance of PersonDirectoryAsyncClient. + */ + @Generated + public PersonDirectoryAsyncClient buildAsyncClient() { + return new PersonDirectoryAsyncClient(buildInnerClient().getPersonDirectories()); + } + + /** + * Builds an instance of PersonDirectoryClient class. + * + * @return an instance of PersonDirectoryClient. + */ + @Generated + public PersonDirectoryClient buildClient() { + return new PersonDirectoryClient(new PersonDirectoryAsyncClient(buildInnerClient().getPersonDirectories())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupAsyncClient.java new file mode 100644 index 000000000000..c1ccd9dcd2dc --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupAsyncClient.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.PersonGroupsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = PersonGroupClientBuilder.class, isAsync = true) +public final class PersonGroupAsyncClient { + @Generated private final PersonGroupsImpl serviceClient; + + /** + * Initializes an instance of PersonGroupAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PersonGroupAsyncClient(PersonGroupsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create a new person group with specified personGroupId, name, user-provided userData and recognitionModel. <br + * /> A person group is the container of the uploaded person data, including face recognition features. <br + * /> After creation, use [PersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into the group, and + * then call [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group + * ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> No image + * will be stored. Only the person's extracted face features and userData will be stored on server until + * [PersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + * <br/>'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. + * + *

Person group quota: * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(personGroupId, body, requestOptions); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(personGroupId, requestOptions); + } + + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this personGroup, use + * [PersonGroup Person - List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person group object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(personGroupId, requestOptions); + } + + /** + * Update an existing person group's display name and userData. The properties which does not appear in request body + * will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for updating person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(personGroupId, body, requestOptions); + } + + /** + * Retrieve the training status of a person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponse( + String personGroupId, RequestOptions requestOptions) { + return this.serviceClient.getTrainingStatusWithResponseAsync(personGroupId, requestOptions); + } + + /** + * List person groups’ personGroupId, name, userData and recognitionModel.<br /> * 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. <br /> For example, total 5 person groups: "group1", ..., "group5". <br /> + * "start=&top=" will return all 5 groups. <br /> "start=&top=2" will return "group1", "group2". + * <br /> "start=group2&top=3" will return "group3", "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList person groups from the least personGroupId greater than the "start".
topStringNoThe number of person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of person groups along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * Queue a person group training task, the training task may not be started immediately. + * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.serviceClient.trainWithResponseAsync(personGroupId, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupClient.java new file mode 100644 index 000000000000..a74c91f584ec --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupClient.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = PersonGroupClientBuilder.class) +public final class PersonGroupClient { + @Generated private final PersonGroupAsyncClient asyncClient; + + /** + * Initializes an instance of PersonGroupClient class. + * + * @param asyncClient the async client. + */ + @Generated + PersonGroupClient(PersonGroupAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Create a new person group with specified personGroupId, name, user-provided userData and recognitionModel. <br + * /> A person group is the container of the uploaded person data, including face recognition features. <br + * /> After creation, use [PersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into the group, and + * then call [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group + * ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> No image + * will be stored. Only the person's extracted face features and userData will be stored on server until + * [PersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + * <br/>'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. + * + *

Person group quota: * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String personGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createWithResponse(personGroupId, body, requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(personGroupId, requestOptions).block(); + } + + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this personGroup, use + * [PersonGroup Person - List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person group object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(personGroupId, requestOptions).block(); + } + + /** + * Update an existing person group's display name and userData. The properties which does not appear in request body + * will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for updating person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String personGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(personGroupId, body, requestOptions).block(); + } + + /** + * Retrieve the training status of a person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTrainingStatusWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.asyncClient.getTrainingStatusWithResponse(personGroupId, requestOptions).block(); + } + + /** + * List person groups’ personGroupId, name, userData and recognitionModel.<br /> * 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. <br /> For example, total 5 person groups: "group1", ..., "group5". <br /> + * "start=&top=" will return all 5 groups. <br /> "start=&top=2" will return "group1", "group2". + * <br /> "start=group2&top=3" will return "group3", "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList person groups from the least personGroupId greater than the "start".
topStringNoThe number of person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of person groups along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(requestOptions).block(); + } + + /** + * Queue a person group training task, the training task may not be started immediately. + * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.asyncClient.trainWithResponse(personGroupId, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupClientBuilder.java new file mode 100644 index 000000000000..094239ad31fc --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the PersonGroupClient type. */ +@ServiceClientBuilder(serviceClients = {PersonGroupClient.class, PersonGroupAsyncClient.class}) +public final class PersonGroupClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the PersonGroupClientBuilder. */ + @Generated + public PersonGroupClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the PersonGroupClientBuilder. + */ + @Generated + public PersonGroupClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PersonGroupAsyncClient class. + * + * @return an instance of PersonGroupAsyncClient. + */ + @Generated + public PersonGroupAsyncClient buildAsyncClient() { + return new PersonGroupAsyncClient(buildInnerClient().getPersonGroups()); + } + + /** + * Builds an instance of PersonGroupClient class. + * + * @return an instance of PersonGroupClient. + */ + @Generated + public PersonGroupClient buildClient() { + return new PersonGroupClient(new PersonGroupAsyncClient(buildInnerClient().getPersonGroups())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonAsyncClient.java new file mode 100644 index 000000000000..dbab5cc1c053 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonAsyncClient.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.PersonGroupPersonsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = PersonGroupPersonClientBuilder.class, isAsync = true) +public final class PersonGroupPersonAsyncClient { + @Generated private final PersonGroupPersonsImpl serviceClient; + + /** + * Initializes an instance of PersonGroupPersonAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PersonGroupPersonAsyncClient(PersonGroupPersonsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create a new person in a specified person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(personGroupId, body, requestOptions); + } + + /** + * List all persons in a person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(personGroupId, requestOptions); + } + + /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face feature in the + * person entry will all be deleted. + * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse( + String personGroupId, String personId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(personGroupId, personId, requestOptions); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse( + String personGroupId, String personId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(personGroupId, personId, requestOptions); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse( + String personGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(personGroupId, personId, body, requestOptions); + } + + /** + * Delete a face from a person in a person group by specified personGroupId, personId and persistedFaceId. <br + * /> Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from + * different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponse( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.deleteFaceWithResponseAsync(personGroupId, personId, persistedFaceId, requestOptions); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * personGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponse( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.serviceClient.getFaceWithResponseAsync(personGroupId, personId, persistedFaceId, requestOptions); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponse( + String personGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.updateFaceWithResponseAsync( + personGroupId, personId, persistedFaceId, body, requestOptions); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponse( + String personGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromUrlWithResponseAsync(personGroupId, personId, imageUrl, requestOptions); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponse( + String personGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return this.serviceClient.addFaceFromStreamWithResponseAsync(personGroupId, personId, image, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonClient.java new file mode 100644 index 000000000000..aaad2b17e3d3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonClient.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = PersonGroupPersonClientBuilder.class) +public final class PersonGroupPersonClient { + @Generated private final PersonGroupPersonAsyncClient asyncClient; + + /** + * Initializes an instance of PersonGroupPersonClient class. + * + * @param asyncClient the async client. + */ + @Generated + PersonGroupPersonClient(PersonGroupPersonAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * Create a new person in a specified person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.createWithResponse(personGroupId, body, requestOptions).block(); + } + + /** + * List all persons in a person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String personGroupId, RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(personGroupId, requestOptions).block(); + } + + /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face feature in the + * person entry will all be deleted. + * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String personGroupId, String personId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(personGroupId, personId, requestOptions).block(); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String personGroupId, String personId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(personGroupId, personId, requestOptions).block(); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String personGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(personGroupId, personId, body, requestOptions).block(); + } + + /** + * Delete a face from a person in a person group by specified personGroupId, personId and persistedFaceId. <br + * /> Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from + * different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient + .deleteFaceWithResponse(personGroupId, personId, persistedFaceId, requestOptions) + .block(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * personGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFaceWithResponse( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return this.asyncClient.getFaceWithResponse(personGroupId, personId, persistedFaceId, requestOptions).block(); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateFaceWithResponse( + String personGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return this.asyncClient + .updateFaceWithResponse(personGroupId, personId, persistedFaceId, body, requestOptions) + .block(); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String personGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return this.asyncClient.addFaceFromUrlWithResponse(personGroupId, personId, imageUrl, requestOptions).block(); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String personGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return this.asyncClient.addFaceFromStreamWithResponse(personGroupId, personId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonClientBuilder.java new file mode 100644 index 000000000000..60c688359b0f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/PersonGroupPersonClientBuilder.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the PersonGroupPersonClient type. */ +@ServiceClientBuilder(serviceClients = {PersonGroupPersonClient.class, PersonGroupPersonAsyncClient.class}) +public final class PersonGroupPersonClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the PersonGroupPersonClientBuilder. */ + @Generated + public PersonGroupPersonClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the PersonGroupPersonClientBuilder. + */ + @Generated + public PersonGroupPersonClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PersonGroupPersonAsyncClient class. + * + * @return an instance of PersonGroupPersonAsyncClient. + */ + @Generated + public PersonGroupPersonAsyncClient buildAsyncClient() { + return new PersonGroupPersonAsyncClient(buildInnerClient().getPersonGroupPersons()); + } + + /** + * Builds an instance of PersonGroupPersonClient class. + * + * @return an instance of PersonGroupPersonClient. + */ + @Generated + public PersonGroupPersonClient buildClient() { + return new PersonGroupPersonClient( + new PersonGroupPersonAsyncClient(buildInnerClient().getPersonGroupPersons())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotAsyncClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotAsyncClient.java new file mode 100644 index 000000000000..3a7c8125b2db --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotAsyncClient.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.SnapshotsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous FaceClient type. */ +@ServiceClient(builder = SnapshotClientBuilder.class, isAsync = true) +public final class SnapshotAsyncClient { + @Generated private final SnapshotsImpl serviceClient; + + /** + * Initializes an instance of SnapshotAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SnapshotAsyncClient(SnapshotsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * 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.<br /> 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.<br /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 take operations per month. * S0-tier + * subscription quota: 100 take operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     objectId: String
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param body Request body for taking a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> takeWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.takeWithResponseAsync(body, requestOptions); + } + + /** + * 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). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoUser specified object type as a search filter.
applyScopeStringNoUser 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. In the form of "," separated string.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         id: String
+     *         account: String
+     *         type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *         applyScope: [
+     *             String
+     *         ]
+     *         userData: String
+     *         createdTime: String
+     *         lastUpdateTime: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of snapshots along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * 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. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     id: String
+     *     account: String
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     *     createdTime: String
+     *     lastUpdateTime: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return snapshot object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String snapshotId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(snapshotId, requestOptions); + } + + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update the snapshot. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for updating a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse(String snapshotId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(snapshotId, body, requestOptions); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String snapshotId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(snapshotId, requestOptions); + } + + /** + * 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.<br /> 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.<br + * /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 + * apply operations per month. * S0-tier subscription quota: 100 apply operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     objectId: String
+     *     mode: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for applying a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> applyWithResponse(String snapshotId, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.applyWithResponseAsync(snapshotId, body, requestOptions); + } + + /** + * Get status of a long running operation. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(notStarted/running/succeeded/failed)
+     *     createdTime: String
+     *     lastActionTime: String
+     *     finishedTime: String
+     *     resourceLocation: String
+     *     message: String
+     * }
+     * }
+ * + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return status of a long running operation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponse( + String operationId, RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponseAsync(operationId, requestOptions); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotClient.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotClient.java new file mode 100644 index 000000000000..311867c574a6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotClient.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous FaceClient type. */ +@ServiceClient(builder = SnapshotClientBuilder.class) +public final class SnapshotClient { + @Generated private final SnapshotAsyncClient asyncClient; + + /** + * Initializes an instance of SnapshotClient class. + * + * @param asyncClient the async client. + */ + @Generated + SnapshotClient(SnapshotAsyncClient asyncClient) { + this.asyncClient = asyncClient; + } + + /** + * 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.<br /> 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.<br /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 take operations per month. * S0-tier + * subscription quota: 100 take operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     objectId: String
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param body Request body for taking a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response takeWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.takeWithResponse(body, requestOptions).block(); + } + + /** + * 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). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoUser specified object type as a search filter.
applyScopeStringNoUser 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. In the form of "," separated string.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         id: String
+     *         account: String
+     *         type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *         applyScope: [
+     *             String
+     *         ]
+     *         userData: String
+     *         createdTime: String
+     *         lastUpdateTime: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of snapshots along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.asyncClient.listWithResponse(requestOptions).block(); + } + + /** + * 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. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     id: String
+     *     account: String
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     *     createdTime: String
+     *     lastUpdateTime: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return snapshot object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String snapshotId, RequestOptions requestOptions) { + return this.asyncClient.getWithResponse(snapshotId, requestOptions).block(); + } + + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update the snapshot. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for updating a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String snapshotId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.updateWithResponse(snapshotId, body, requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String snapshotId, RequestOptions requestOptions) { + return this.asyncClient.deleteWithResponse(snapshotId, requestOptions).block(); + } + + /** + * 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.<br /> 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.<br + * /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 + * apply operations per month. * S0-tier subscription quota: 100 apply operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     objectId: String
+     *     mode: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for applying a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response applyWithResponse(String snapshotId, BinaryData body, RequestOptions requestOptions) { + return this.asyncClient.applyWithResponse(snapshotId, body, requestOptions).block(); + } + + /** + * Get status of a long running operation. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(notStarted/running/succeeded/failed)
+     *     createdTime: String
+     *     lastActionTime: String
+     *     finishedTime: String
+     *     resourceLocation: String
+     *     message: String
+     * }
+     * }
+ * + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return status of a long running operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String operationId, RequestOptions requestOptions) { + return this.asyncClient.getOperationStatusWithResponse(operationId, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotClientBuilder.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotClientBuilder.java new file mode 100644 index 000000000000..871ac11497c2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/SnapshotClientBuilder.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +import com.azure.cognitiveservices.face.implementation.FaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** A builder for creating a new instance of the SnapshotClient type. */ +@ServiceClientBuilder(serviceClients = {SnapshotClient.class, SnapshotAsyncClient.class}) +public final class SnapshotClientBuilder { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private final Map properties = CoreUtils.getProperties("azure-cognitiveservices-face.properties"); + + /** Create an instance of the SnapshotClientBuilder. */ + @Generated + public SnapshotClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * Supported Cognitive Services endpoints (protocol and hostname, for + * example: https://westus.api.cognitive.microsoft.com). + */ + @Generated private String endpoint; + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + @Generated private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** + * Sets The HTTP client used to send the request. + * + * @param httpClient the httpClient value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** + * Sets The configuration store that is used during construction of the service client. + * + * @param configuration the configuration value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** + * Sets The logging configuration for HTTP requests and responses. + * + * @param httpLogOptions the httpLogOptions value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /* + * The list of Http pipeline policies to add. + */ + @Generated private final List pipelinePolicies; + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** + * Sets The client options such as application ID and custom headers to set on a request. + * + * @param clientOptions the clientOptions value. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /** + * Adds a custom Http pipeline policy. + * + * @param customPolicy The custom Http pipeline policy to add. + * @return the SnapshotClientBuilder. + */ + @Generated + public SnapshotClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /** + * Builds an instance of FaceClientImpl with the provided parameters. + * + * @return an instance of FaceClientImpl. + */ + @Generated + private FaceClientImpl buildInnerClient() { + if (pipeline == null) { + this.pipeline = createHttpPipeline(); + } + FaceClientImpl client = new FaceClientImpl(pipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SnapshotAsyncClient class. + * + * @return an instance of SnapshotAsyncClient. + */ + @Generated + public SnapshotAsyncClient buildAsyncClient() { + return new SnapshotAsyncClient(buildInnerClient().getSnapshots()); + } + + /** + * Builds an instance of SnapshotClient class. + * + * @return an instance of SnapshotClient. + */ + @Generated + public SnapshotClient buildClient() { + return new SnapshotClient(new SnapshotAsyncClient(buildInnerClient().getSnapshots())); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FaceClientImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FaceClientImpl.java new file mode 100644 index 000000000000..183834e06827 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FaceClientImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** Initializes a new instance of the FaceClient type. */ +public final class FaceClientImpl { + /** + * Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + */ + private final String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The FacesImpl object to access its operations. */ + private final FacesImpl faces; + + /** + * Gets the FacesImpl object to access its operations. + * + * @return the FacesImpl object. + */ + public FacesImpl getFaces() { + return this.faces; + } + + /** The PersonGroupPersonsImpl object to access its operations. */ + private final PersonGroupPersonsImpl personGroupPersons; + + /** + * Gets the PersonGroupPersonsImpl object to access its operations. + * + * @return the PersonGroupPersonsImpl object. + */ + public PersonGroupPersonsImpl getPersonGroupPersons() { + return this.personGroupPersons; + } + + /** The PersonGroupsImpl object to access its operations. */ + private final PersonGroupsImpl personGroups; + + /** + * Gets the PersonGroupsImpl object to access its operations. + * + * @return the PersonGroupsImpl object. + */ + public PersonGroupsImpl getPersonGroups() { + return this.personGroups; + } + + /** The FaceListsImpl object to access its operations. */ + private final FaceListsImpl faceLists; + + /** + * Gets the FaceListsImpl object to access its operations. + * + * @return the FaceListsImpl object. + */ + public FaceListsImpl getFaceLists() { + return this.faceLists; + } + + /** The LargePersonGroupPersonsImpl object to access its operations. */ + private final LargePersonGroupPersonsImpl largePersonGroupPersons; + + /** + * Gets the LargePersonGroupPersonsImpl object to access its operations. + * + * @return the LargePersonGroupPersonsImpl object. + */ + public LargePersonGroupPersonsImpl getLargePersonGroupPersons() { + return this.largePersonGroupPersons; + } + + /** The LargePersonGroupsImpl object to access its operations. */ + private final LargePersonGroupsImpl largePersonGroups; + + /** + * Gets the LargePersonGroupsImpl object to access its operations. + * + * @return the LargePersonGroupsImpl object. + */ + public LargePersonGroupsImpl getLargePersonGroups() { + return this.largePersonGroups; + } + + /** The LargeFaceListsImpl object to access its operations. */ + private final LargeFaceListsImpl largeFaceLists; + + /** + * Gets the LargeFaceListsImpl object to access its operations. + * + * @return the LargeFaceListsImpl object. + */ + public LargeFaceListsImpl getLargeFaceLists() { + return this.largeFaceLists; + } + + /** The SnapshotsImpl object to access its operations. */ + private final SnapshotsImpl snapshots; + + /** + * Gets the SnapshotsImpl object to access its operations. + * + * @return the SnapshotsImpl object. + */ + public SnapshotsImpl getSnapshots() { + return this.snapshots; + } + + /** The PersonDirectoriesImpl object to access its operations. */ + private final PersonDirectoriesImpl personDirectories; + + /** + * Gets the PersonDirectoriesImpl object to access its operations. + * + * @return the PersonDirectoriesImpl object. + */ + public PersonDirectoriesImpl getPersonDirectories() { + return this.personDirectories; + } + + /** + * Initializes an instance of FaceClient client. + * + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + */ + public FaceClientImpl(String endpoint) { + this( + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(), + JacksonAdapter.createDefaultSerializerAdapter(), + endpoint); + } + + /** + * Initializes an instance of FaceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + */ + public FaceClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of FaceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + */ + public FaceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.faces = new FacesImpl(this); + this.personGroupPersons = new PersonGroupPersonsImpl(this); + this.personGroups = new PersonGroupsImpl(this); + this.faceLists = new FaceListsImpl(this); + this.largePersonGroupPersons = new LargePersonGroupPersonsImpl(this); + this.largePersonGroups = new LargePersonGroupsImpl(this); + this.largeFaceLists = new LargeFaceListsImpl(this); + this.snapshots = new SnapshotsImpl(this); + this.personDirectories = new PersonDirectoriesImpl(this); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FaceListsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FaceListsImpl.java new file mode 100644 index 000000000000..7af8f0da3c64 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FaceListsImpl.java @@ -0,0 +1,1203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FaceLists. */ +public final class FaceListsImpl { + /** The proxy service used to perform REST calls. */ + private final FaceListsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of FaceListsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FaceListsImpl(FaceClientImpl client) { + this.service = + RestProxy.create(FaceListsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientFaceLists to be used by the proxy service to perform REST + * calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientFaceLists") + private interface FaceListsService { + @Put("/facelists/{faceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/facelists/{faceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + RequestOptions requestOptions, + Context context); + + @Patch("/facelists/{faceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/facelists/{faceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + RequestOptions requestOptions, + Context context); + + @Get("/facelists") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Delete("/facelists/{faceListId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteFace( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Post("/facelists/{faceListId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromUrl( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + @BodyParam("application/json") BinaryData imageUrl, + RequestOptions requestOptions, + Context context); + + @Post("/facelists/{faceListId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromStream( + @HostParam("Endpoint") String endpoint, + @PathParam("faceListId") String faceListId, + @BodyParam("application/octet-stream") BinaryData image, + RequestOptions requestOptions, + Context context); + } + + /** + * 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. <br /> Face list is a list of faces, up to 1,000 faces, and + * used by [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After + * creation, user should use [FaceList - Add + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No image will be + * stored. Only the extracted face features are stored on server until [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> Please consider + * [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) when the face number is large. It can + * support up to 1,000,000 faces. <br />'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. Please Refer to [Specify a face + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for creating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String faceListId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.create(this.client.getEndpoint(), faceListId, body, requestOptions, context)); + } + + /** + * 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. <br /> Face list is a list of faces, up to 1,000 faces, and + * used by [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After + * creation, user should use [FaceList - Add + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No image will be + * stored. Only the extracted face features are stored on server until [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> Please consider + * [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) when the face number is large. It can + * support up to 1,000,000 faces. <br />'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. Please Refer to [Specify a face + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for creating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String faceListId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.create(this.client.getEndpoint(), faceListId, body, requestOptions, context); + } + + /** + * 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. <br /> Face list is a list of faces, up to 1,000 faces, and + * used by [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After + * creation, user should use [FaceList - Add + * Face](https://docs.microsoft.com/rest/api/faceapi/facelist/addfacefromurl) to import the faces. No image will be + * stored. Only the extracted face features are stored on server until [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> Please consider + * [LargeFaceList](https://docs.microsoft.com/rest/api/faceapi/largefacelist) when the face number is large. It can + * support up to 1,000,000 faces. <br />'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. Please Refer to [Specify a face + * recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for creating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String faceListId, BinaryData body, RequestOptions requestOptions) { + return createWithResponseAsync(faceListId, body, requestOptions).block(); + } + + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     faceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     persistedFaces: [
+     *         {
+     *             persistedFaceId: String
+     *             userData: String
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return face list object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String faceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), faceListId, requestOptions, context)); + } + + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     faceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     persistedFaces: [
+     *         {
+     *             persistedFaceId: String
+     *             userData: String
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return face list object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String faceListId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), faceListId, requestOptions, context); + } + + /** + * Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     faceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     persistedFaces: [
+     *         {
+     *             persistedFaceId: String
+     *             userData: String
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return face list object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String faceListId, RequestOptions requestOptions) { + return getWithResponseAsync(faceListId, requestOptions).block(); + } + + /** + * Update information of a face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for updating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String faceListId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.update(this.client.getEndpoint(), faceListId, body, requestOptions, context)); + } + + /** + * Update information of a face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for updating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String faceListId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.update(this.client.getEndpoint(), faceListId, body, requestOptions, context); + } + + /** + * Update information of a face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param body Request body for updating a face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String faceListId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(faceListId, body, requestOptions).block(); + } + + /** + * Delete a specified face list. + * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String faceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), faceListId, requestOptions, context)); + } + + /** + * Delete a specified face list. + * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String faceListId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), faceListId, requestOptions, context); + } + + /** + * Delete a specified face list. + * + * @param faceListId Id referencing a particular face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String faceListId, RequestOptions requestOptions) { + return deleteWithResponseAsync(faceListId, requestOptions).block(); + } + + /** + * List face lists’ faceListId, name, userData and recognitionModel. <br /> To get face information inside + * faceList use [FaceList - Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         persistedFaces: [
+     *             {
+     *                 persistedFaceId: String
+     *                 userData: String
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face list results, with fields of faceListId, name and userData along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * List face lists’ faceListId, name, userData and recognitionModel. <br /> To get face information inside + * faceList use [FaceList - Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         persistedFaces: [
+     *             {
+     *                 persistedFaceId: String
+     *                 userData: String
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face list results, with fields of faceListId, name and userData along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), requestOptions, context); + } + + /** + * List face lists’ faceListId, name, userData and recognitionModel. <br /> To get face information inside + * faceList use [FaceList - Get](https://docs.microsoft.com/rest/api/faceapi/facelist/get). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         persistedFaces: [
+     *             {
+     *                 persistedFaceId: String
+     *                 userData: String
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face list results, with fields of faceListId, name and userData along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return listWithResponseAsync(requestOptions).block(); + } + + /** + * Delete a face from a face list by specified faceListId and persistedFaceId. <br /> Adding/deleting faces + * to/from a same face list are processed sequentially and to/from different face lists are in parallel. + * + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String faceListId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deleteFace( + this.client.getEndpoint(), faceListId, persistedFaceId, requestOptions, context)); + } + + /** + * Delete a face from a face list by specified faceListId and persistedFaceId. <br /> Adding/deleting faces + * to/from a same face list are processed sequentially and to/from different face lists are in parallel. + * + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String faceListId, String persistedFaceId, RequestOptions requestOptions, Context context) { + return service.deleteFace(this.client.getEndpoint(), faceListId, persistedFaceId, requestOptions, context); + } + + /** + * Delete a face from a face list by specified faceListId and persistedFaceId. <br /> Adding/deleting faces + * to/from a same face list are processed sequentially and to/from different face lists are in parallel. + * + * @param faceListId Id referencing a particular face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String faceListId, String persistedFaceId, RequestOptions requestOptions) { + return deleteFaceWithResponseAsync(faceListId, persistedFaceId, requestOptions).block(); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String faceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromUrl( + this.client.getEndpoint(), faceListId, imageUrl, requestOptions, context)); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String faceListId, BinaryData imageUrl, RequestOptions requestOptions, Context context) { + return service.addFaceFromUrl(this.client.getEndpoint(), faceListId, imageUrl, requestOptions, context); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String faceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return addFaceFromUrlWithResponseAsync(faceListId, imageUrl, requestOptions).block(); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String faceListId, BinaryData image, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromStream( + this.client.getEndpoint(), faceListId, image, requestOptions, context)); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String faceListId, BinaryData image, RequestOptions requestOptions, Context context) { + return service.addFaceFromStream(this.client.getEndpoint(), faceListId, image, requestOptions, context); + } + + /** + * Add a face to a specified face list, up to 1,000 faces. <br /> To deal with an image contains multiple + * faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [FaceList - Delete Face](https://docs.microsoft.com/rest/api/faceapi/facelist/deleteface) or [FaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/facelist/delete) is called. <br /> Note persistedFaceId + * is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * 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. * "targetFace" rectangle should contain one face. Zero or multiple + * faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param faceListId Id referencing a particular face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String faceListId, BinaryData image, RequestOptions requestOptions) { + return addFaceFromStreamWithResponseAsync(faceListId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FacesImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FacesImpl.java new file mode 100644 index 000000000000..992ed78e195d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/FacesImpl.java @@ -0,0 +1,2053 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Faces. */ +public final class FacesImpl { + /** The proxy service used to perform REST calls. */ + private final FacesService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of FacesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FacesImpl(FaceClientImpl client) { + this.service = RestProxy.create(FacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientFaces to be used by the proxy service to perform REST + * calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientFaces") + private interface FacesService { + @Post("/findsimilars") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> findSimilar( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/group") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> group( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/identify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> identify( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/verify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verifyFaceToFace( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/detect") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> detectWithUrl( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData imageUrl, + RequestOptions requestOptions, + Context context); + + @Post("/verify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verifyFaceToPerson( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/detect") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> detectWithStream( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/octet-stream") BinaryData image, + RequestOptions requestOptions, + Context context); + } + + /** + * 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 With + * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the time + * specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds that will not + * expire. And a "largeFaceListId" is created by [LargeFaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing persistedFaceIds that will + * also not expire. Depending on the input the returned similar faces list contains faceIds or persistedFaceIds + * ranked by similarity. <br/>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. + * <br/>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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     faceListId: String
+     *     largeFaceListId: String
+     *     faceIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     mode: String(matchPerson/matchFace)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         persistedFaceId: String
+     *         confidence: float
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for Find Similar. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of SimilarFace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> findSimilarWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.findSimilar(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * 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 With + * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the time + * specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds that will not + * expire. And a "largeFaceListId" is created by [LargeFaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing persistedFaceIds that will + * also not expire. Depending on the input the returned similar faces list contains faceIds or persistedFaceIds + * ranked by similarity. <br/>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. + * <br/>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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     faceListId: String
+     *     largeFaceListId: String
+     *     faceIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     mode: String(matchPerson/matchFace)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         persistedFaceId: String
+     *         confidence: float
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for Find Similar. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of SimilarFace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> findSimilarWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.findSimilar(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * 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 With + * Url](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl) or [Face - Detect With + * Stream](https://docs.microsoft.com/rest/api/faceapi/face/detectwithstream), which will expire at the time + * specified by faceIdTimeToLive after creation. A "faceListId" is created by [FaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/facelist/create) containing persistedFaceIds that will not + * expire. And a "largeFaceListId" is created by [LargeFaceList - + * Create](https://docs.microsoft.com/rest/api/faceapi/largefacelist/create) containing persistedFaceIds that will + * also not expire. Depending on the input the returned similar faces list contains faceIds or persistedFaceIds + * ranked by similarity. <br/>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. + * <br/>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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     faceListId: String
+     *     largeFaceListId: String
+     *     faceIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     mode: String(matchPerson/matchFace)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         persistedFaceId: String
+     *         confidence: float
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for Find Similar. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of SimilarFace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response findSimilarWithResponse(BinaryData body, RequestOptions requestOptions) { + return findSimilarWithResponseAsync(body, requestOptions).block(); + } + + /** + * Divide candidate faces into groups based on face similarity.<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 candidate faces. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     groups: [
+     *         [
+     *             String
+     *         ]
+     *     ]
+     *     messyGroup: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param body Request body for grouping. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face groups based on face similarity along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.group(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * Divide candidate faces into groups based on face similarity.<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 candidate faces. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     groups: [
+     *         [
+     *             String
+     *         ]
+     *     ]
+     *     messyGroup: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param body Request body for grouping. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face groups based on face similarity along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.group(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * Divide candidate faces into groups based on face similarity.<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface) when you only have 2 candidate faces. + * * The 'recognitionModel' associated with the query faces' faceIds should be the same. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     groups: [
+     *         [
+     *             String
+     *         ]
+     *     ]
+     *     messyGroup: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param body Request body for grouping. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of face groups based on face similarity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupWithResponse(BinaryData body, RequestOptions requestOptions) { + return groupWithResponseAsync(body, requestOptions).block(); + } + + /** + * 1-to-many identification to find the closest matches of the specific query person face from a person group, large + * person group, person directory dynamic person group or person directory personIds array. <br/> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and [LargePersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). <br/> + * + *

Remarks:<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     dynamicPersonGroupId: String
+     *     personIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     confidenceThreshold: Float
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         candidates: [
+     *             {
+     *                 personId: String
+     *                 confidence: float
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for identify operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of IdentifyResult along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> identifyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.identify(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * 1-to-many identification to find the closest matches of the specific query person face from a person group, large + * person group, person directory dynamic person group or person directory personIds array. <br/> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and [LargePersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). <br/> + * + *

Remarks:<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     dynamicPersonGroupId: String
+     *     personIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     confidenceThreshold: Float
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         candidates: [
+     *             {
+     *                 personId: String
+     *                 confidence: float
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for identify operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of IdentifyResult along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> identifyWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.identify(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * 1-to-many identification to find the closest matches of the specific query person face from a person group, large + * person group, person directory dynamic person group or person directory personIds array. <br/> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) and [LargePersonGroup - + * Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train). <br/> + * + *

Remarks:<br /> * 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](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceIds: [
+     *         String
+     *     ]
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     dynamicPersonGroupId: String
+     *     personIds: [
+     *         String
+     *     ]
+     *     maxNumOfCandidatesReturned: Integer
+     *     confidenceThreshold: Float
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         candidates: [
+     *             {
+     *                 personId: String
+     *                 confidence: float
+     *             }
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param body Request body for identify operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of IdentifyResult along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response identifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return identifyWithResponseAsync(body, requestOptions).block(); + } + + /** + * Verify whether two faces belong to a same person or whether one face belongs to a person. <br/> + * Remarks:<br /> * 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId1: String
+     *     faceId2: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to face verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyFaceToFaceWithResponseAsync( + BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.verifyFaceToFace(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * Verify whether two faces belong to a same person or whether one face belongs to a person. <br/> + * Remarks:<br /> * 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId1: String
+     *     faceId2: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to face verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyFaceToFaceWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.verifyFaceToFace(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * Verify whether two faces belong to a same person or whether one face belongs to a person. <br/> + * Remarks:<br /> * 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. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId1: String
+     *     faceId2: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to face verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyFaceToFaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return verifyFaceToFaceWithResponseAsync(body, requestOptions).block(); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

* 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectWithUrlWithResponseAsync( + BinaryData imageUrl, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.detectWithUrl(this.client.getEndpoint(), imageUrl, requestOptions, context)); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

* 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectWithUrlWithResponseAsync( + BinaryData imageUrl, RequestOptions requestOptions, Context context) { + return service.detectWithUrl(this.client.getEndpoint(), imageUrl, requestOptions, context); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

* 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectWithUrlWithResponse(BinaryData imageUrl, RequestOptions requestOptions) { + return detectWithUrlWithResponseAsync(imageUrl, requestOptions).block(); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     personId: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to person verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyFaceToPersonWithResponseAsync( + BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.verifyFaceToPerson(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     personId: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to person verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyFaceToPersonWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.verifyFaceToPerson(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     faceId: String
+     *     personGroupId: String
+     *     largePersonGroupId: String
+     *     personId: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     isIdentical: boolean
+     *     confidence: float
+     * }
+     * }
+ * + * @param body Request body for face to person verification. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return result of the verify operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyFaceToPersonWithResponse(BinaryData body, RequestOptions requestOptions) { + return verifyFaceToPersonWithResponseAsync(body, requestOptions).block(); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * + * 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectWithStreamWithResponseAsync( + BinaryData image, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.detectWithStream(this.client.getEndpoint(), image, requestOptions, context)); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * + * 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> detectWithStreamWithResponseAsync( + BinaryData image, RequestOptions requestOptions, Context context) { + return service.detectWithStream(this.client.getEndpoint(), image, requestOptions, context); + } + + /** + * Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and + * attributes.<br /> * No image will be stored. Only the extracted face feature will be stored on server. The + * faceId is an identifier of the face feature and will be used in [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). The stored face feature(s) will expire + * and be deleted at the time specified by faceIdTimeToLive after the original detection call. * Optional parameters + * include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, + * emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, mask, and qualityForRecognition. Some of + * the results returned for specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and + * BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for + * an image. Faces are ranked by face rectangle size from large to small. * For optimal results when querying [Face + * - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify), [Face - + * Verify](https://docs.microsoft.com/rest/api/faceapi/face/verifyfacetoface), and [Face - Find + * Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar) ('returnFaceId' is true), please use faces + * that are: frontal, clear, and with a minimum size of 200x200 pixels (100 pixels between eyes). * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) * + * 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 [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Query Parameters + * + * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnFaceIdStringNoA value indicating whether the operation should return faceIds of detected faces.
returnFaceLandmarksStringNoA value indicating whether the operation should return landmarks of the detected faces.
returnFaceAttributesStringNoAnalyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition. While 'detection_02' does not support any attributes and 'detection_03' only supports mask and qualityForRecognition. Additionally, qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'. Note that each face attribute analysis has additional computational and time cost. In the form of "," separated string.
recognitionModelStringNoName 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.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
faceIdTimeToLiveStringNoThe number of seconds for the faceId being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours).
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         faceId: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *         faceRectangle: {
+     *             width: int
+     *             height: int
+     *             left: int
+     *             top: int
+     *         }
+     *         faceLandmarks: {
+     *             pupilLeft: {
+     *                 x: float
+     *                 y: float
+     *             }
+     *             pupilRight: (recursive schema, see pupilRight above)
+     *             noseTip: (recursive schema, see noseTip above)
+     *             mouthLeft: (recursive schema, see mouthLeft above)
+     *             mouthRight: (recursive schema, see mouthRight above)
+     *             eyebrowLeftOuter: (recursive schema, see eyebrowLeftOuter above)
+     *             eyebrowLeftInner: (recursive schema, see eyebrowLeftInner above)
+     *             eyeLeftOuter: (recursive schema, see eyeLeftOuter above)
+     *             eyeLeftTop: (recursive schema, see eyeLeftTop above)
+     *             eyeLeftBottom: (recursive schema, see eyeLeftBottom above)
+     *             eyeLeftInner: (recursive schema, see eyeLeftInner above)
+     *             eyebrowRightInner: (recursive schema, see eyebrowRightInner above)
+     *             eyebrowRightOuter: (recursive schema, see eyebrowRightOuter above)
+     *             eyeRightInner: (recursive schema, see eyeRightInner above)
+     *             eyeRightTop: (recursive schema, see eyeRightTop above)
+     *             eyeRightBottom: (recursive schema, see eyeRightBottom above)
+     *             eyeRightOuter: (recursive schema, see eyeRightOuter above)
+     *             noseRootLeft: (recursive schema, see noseRootLeft above)
+     *             noseRootRight: (recursive schema, see noseRootRight above)
+     *             noseLeftAlarTop: (recursive schema, see noseLeftAlarTop above)
+     *             noseRightAlarTop: (recursive schema, see noseRightAlarTop above)
+     *             noseLeftAlarOutTip: (recursive schema, see noseLeftAlarOutTip above)
+     *             noseRightAlarOutTip: (recursive schema, see noseRightAlarOutTip above)
+     *             upperLipTop: (recursive schema, see upperLipTop above)
+     *             upperLipBottom: (recursive schema, see upperLipBottom above)
+     *             underLipTop: (recursive schema, see underLipTop above)
+     *             underLipBottom: (recursive schema, see underLipBottom above)
+     *         }
+     *         faceAttributes: {
+     *             age: Float
+     *             gender: String(male/female)
+     *             smile: Float
+     *             facialHair: {
+     *                 moustache: Float
+     *                 beard: Float
+     *                 sideburns: Float
+     *             }
+     *             glasses: String(noGlasses/readingGlasses/sunglasses/swimmingGoggles)
+     *             headPose: {
+     *                 roll: Float
+     *                 yaw: Float
+     *                 pitch: Float
+     *             }
+     *             emotion: {
+     *                 anger: Float
+     *                 contempt: Float
+     *                 disgust: Float
+     *                 fear: Float
+     *                 happiness: Float
+     *                 neutral: Float
+     *                 sadness: Float
+     *                 surprise: Float
+     *             }
+     *             hair: {
+     *                 bald: Float
+     *                 invisible: Boolean
+     *                 hairColor: [
+     *                     {
+     *                         color: String(unknown/white/gray/blond/brown/red/black/other)
+     *                         confidence: Float
+     *                     }
+     *                 ]
+     *             }
+     *             makeup: {
+     *                 eyeMakeup: Boolean
+     *                 lipMakeup: Boolean
+     *             }
+     *             occlusion: {
+     *                 foreheadOccluded: Boolean
+     *                 eyeOccluded: Boolean
+     *                 mouthOccluded: Boolean
+     *             }
+     *             accessories: [
+     *                 {
+     *                     type: String(headWear/glasses/mask)
+     *                     confidence: Float
+     *                 }
+     *             ]
+     *             blur: {
+     *                 blurLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             exposure: {
+     *                 exposureLevel: String(UnderExposure/GoodExposure/OverExposure)
+     *                 value: Float
+     *             }
+     *             noise: {
+     *                 noiseLevel: String(Low/Medium/High)
+     *                 value: Float
+     *             }
+     *             mask: {
+     *                 type: String(noMask/faceMask/otherMaskOrOcclusion/uncertain)
+     *                 noseAndMouthCovered: Boolean
+     *             }
+     *             qualityForRecognition: String(Low/Medium/High)
+     *         }
+     *     }
+     * ]
+     * }
+ * + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DetectedFace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response detectWithStreamWithResponse(BinaryData image, RequestOptions requestOptions) { + return detectWithStreamWithResponseAsync(image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargeFaceListsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargeFaceListsImpl.java new file mode 100644 index 000000000000..b6dde9180898 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargeFaceListsImpl.java @@ -0,0 +1,1755 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LargeFaceLists. */ +public final class LargeFaceListsImpl { + /** The proxy service used to perform REST calls. */ + private final LargeFaceListsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of LargeFaceListsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LargeFaceListsImpl(FaceClientImpl client) { + this.service = + RestProxy.create(LargeFaceListsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientLargeFaceLists to be used by the proxy service to perform + * REST calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientLargeFaceL") + private interface LargeFaceListsService { + @Put("/largefacelists/{largeFaceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/largefacelists/{largeFaceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + RequestOptions requestOptions, + Context context); + + @Patch("/largefacelists/{largeFaceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/largefacelists/{largeFaceListId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + RequestOptions requestOptions, + Context context); + + @Get("/largefacelists/{largeFaceListId}/training") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTrainingStatus( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + RequestOptions requestOptions, + Context context); + + @Get("/largefacelists") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Post("/largefacelists/{largeFaceListId}/train") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> train( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + RequestOptions requestOptions, + Context context); + + @Delete("/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteFace( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Get("/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFace( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Patch("/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateFace( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @PathParam("persistedFaceId") String persistedFaceId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/largefacelists/{largeFaceListId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromUrl( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @BodyParam("application/json") BinaryData imageUrl, + RequestOptions requestOptions, + Context context); + + @Get("/largefacelists/{largeFaceListId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listFaces( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + RequestOptions requestOptions, + Context context); + + @Post("/largefacelists/{largeFaceListId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromStream( + @HostParam("Endpoint") String endpoint, + @PathParam("largeFaceListId") String largeFaceListId, + @BodyParam("application/octet-stream") BinaryData image, + RequestOptions requestOptions, + Context context); + } + + /** + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - + * Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After creation, user + * should use [LargeFaceList Face - Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) + * to import the faces and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) + * to make it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br/>'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. Please refer to [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large face list quota: * Free-tier subscription quota: 64 large face lists. * S0-tier subscription quota: + * 1,000,000 large face lists. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for creating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.create(this.client.getEndpoint(), largeFaceListId, body, requestOptions, context)); + } + + /** + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - + * Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After creation, user + * should use [LargeFaceList Face - Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) + * to import the faces and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) + * to make it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br/>'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. Please refer to [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large face list quota: * Free-tier subscription quota: 64 large face lists. * S0-tier subscription quota: + * 1,000,000 large face lists. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for creating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String largeFaceListId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.create(this.client.getEndpoint(), largeFaceListId, body, requestOptions, context); + } + + /** + * Create an empty large face list with user-specified largeFaceListId, name, an optional userData and + * recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - + * Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). <br /> After creation, user + * should use [LargeFaceList Face - Add](https://docs.microsoft.com/rest/api/faceapi/largefacelist/addfacefromurl) + * to import the faces and [LargeFaceList - Train](https://docs.microsoft.com/rest/api/faceapi/largefacelist/train) + * to make it ready for [Face - Find Similar](https://docs.microsoft.com/rest/api/faceapi/face/findsimilar). No + * image will be stored. Only the extracted face features are stored on server until [LargeFaceList - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br /> 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](https://docs.microsoft.com/rest/api/faceapi/persongroup) / + * [LargePersonGroup](https://docs.microsoft.com/rest/api/faceapi/largepersongroup) and [Face - + * Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br/>'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. Please refer to [Specify a recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large face list quota: * Free-tier subscription quota: 64 large face lists. * S0-tier subscription quota: + * 1,000,000 large face lists. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for creating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return createWithResponseAsync(largeFaceListId, body, requestOptions).block(); + } + + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largeFaceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large face list object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String largeFaceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), largeFaceListId, requestOptions, context)); + } + + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largeFaceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large face list object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), largeFaceListId, requestOptions, context); + } + + /** + * Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largeFaceListId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large face list object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return getWithResponseAsync(largeFaceListId, requestOptions).block(); + } + + /** + * Update information of a large face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for updating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.update(this.client.getEndpoint(), largeFaceListId, body, requestOptions, context)); + } + + /** + * Update information of a large face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for updating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String largeFaceListId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.update(this.client.getEndpoint(), largeFaceListId, body, requestOptions, context); + } + + /** + * Update information of a large face list. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param body Request body for updating a large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String largeFaceListId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(largeFaceListId, body, requestOptions).block(); + } + + /** + * Delete a specified large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String largeFaceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), largeFaceListId, requestOptions, context)); + } + + /** + * Delete a specified large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), largeFaceListId, requestOptions, context); + } + + /** + * Delete a specified large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return deleteWithResponseAsync(largeFaceListId, requestOptions).block(); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getTrainingStatus(this.client.getEndpoint(), largeFaceListId, requestOptions, context)); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions, Context context) { + return service.getTrainingStatus(this.client.getEndpoint(), largeFaceListId, requestOptions, context); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTrainingStatusWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return getTrainingStatusWithResponseAsync(largeFaceListId, requestOptions).block(); + } + + /** + * List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get + * face information inside largeFaceList use [LargeFaceList Face - + * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)<br /> * 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. <br /> For example, total 5 large person lists: "list1", ..., + * "list5". <br /> "start=&top=" will return all 5 lists. <br /> "start=&top=2" will return + * "list1", "list2". <br /> "start=list2&top=3" will return "list3", "list4", "list5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
startStringNoStarting large face list id to return (used to list a range of large face lists).
topStringNoNumber of large face lists to return starting with the large face list id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largeFaceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large face list results, with fields of largeFaceListId, name and userData along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get + * face information inside largeFaceList use [LargeFaceList Face - + * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)<br /> * 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. <br /> For example, total 5 large person lists: "list1", ..., + * "list5". <br /> "start=&top=" will return all 5 lists. <br /> "start=&top=2" will return + * "list1", "list2". <br /> "start=list2&top=3" will return "list3", "list4", "list5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
startStringNoStarting large face list id to return (used to list a range of large face lists).
topStringNoNumber of large face lists to return starting with the large face list id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largeFaceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large face list results, with fields of largeFaceListId, name and userData along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), requestOptions, context); + } + + /** + * List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get + * face information inside largeFaceList use [LargeFaceList Face - + * Get](https://docs.microsoft.com/rest/api/faceapi/largefacelist/getface)<br /> * 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. <br /> For example, total 5 large person lists: "list1", ..., + * "list5". <br /> "start=&top=" will return all 5 lists. <br /> "start=&top=2" will return + * "list1", "list2". <br /> "start=list2&top=3" will return "list3", "list4", "list5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
startStringNoStarting large face list id to return (used to list a range of large face lists).
topStringNoNumber of large face lists to return starting with the large face list id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largeFaceListId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large face list results, with fields of largeFaceListId, name and userData along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return listWithResponseAsync(requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponseAsync(String largeFaceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.train(this.client.getEndpoint(), largeFaceListId, requestOptions, context)); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions, Context context) { + return service.train(this.client.getEndpoint(), largeFaceListId, requestOptions, context); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return trainWithResponseAsync(largeFaceListId, requestOptions).block(); + } + + /** + * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> + * Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face + * lists are in parallel. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deleteFace( + this.client.getEndpoint(), largeFaceListId, persistedFaceId, requestOptions, context)); + } + + /** + * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> + * Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face + * lists are in parallel. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions, Context context) { + return service.deleteFace(this.client.getEndpoint(), largeFaceListId, persistedFaceId, requestOptions, context); + } + + /** + * Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> + * Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face + * lists are in parallel. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return deleteFaceWithResponseAsync(largeFaceListId, persistedFaceId, requestOptions).block(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponseAsync( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getFace( + this.client.getEndpoint(), largeFaceListId, persistedFaceId, requestOptions, context)); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponseAsync( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions, Context context) { + return service.getFace(this.client.getEndpoint(), largeFaceListId, persistedFaceId, requestOptions, context); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFaceWithResponse( + String largeFaceListId, String persistedFaceId, RequestOptions requestOptions) { + return getFaceWithResponseAsync(largeFaceListId, persistedFaceId, requestOptions).block(); + } + + /** + * Update a persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponseAsync( + String largeFaceListId, String persistedFaceId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.updateFace( + this.client.getEndpoint(), + largeFaceListId, + persistedFaceId, + body, + requestOptions, + context)); + } + + /** + * Update a persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponseAsync( + String largeFaceListId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions, + Context context) { + return service.updateFace( + this.client.getEndpoint(), largeFaceListId, persistedFaceId, body, requestOptions, context); + } + + /** + * Update a persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateFaceWithResponse( + String largeFaceListId, String persistedFaceId, BinaryData body, RequestOptions requestOptions) { + return updateFaceWithResponseAsync(largeFaceListId, persistedFaceId, body, requestOptions).block(); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String largeFaceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromUrl( + this.client.getEndpoint(), largeFaceListId, imageUrl, requestOptions, context)); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String largeFaceListId, BinaryData imageUrl, RequestOptions requestOptions, Context context) { + return service.addFaceFromUrl(this.client.getEndpoint(), largeFaceListId, imageUrl, requestOptions, context); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String largeFaceListId, BinaryData imageUrl, RequestOptions requestOptions) { + return addFaceFromUrlWithResponseAsync(largeFaceListId, imageUrl, requestOptions).block(); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of + * registered faces of the face). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting face id to return (used to list a range of faces).
topStringNoNumber of faces to return starting with the face id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         persistedFaceId: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of persisted faces within the face list or large face list along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listFacesWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.listFaces(this.client.getEndpoint(), largeFaceListId, requestOptions, context)); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of + * registered faces of the face). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting face id to return (used to list a range of faces).
topStringNoNumber of faces to return starting with the face id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         persistedFaceId: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of persisted faces within the face list or large face list along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listFacesWithResponseAsync( + String largeFaceListId, RequestOptions requestOptions, Context context) { + return service.listFaces(this.client.getEndpoint(), largeFaceListId, requestOptions, context); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of + * registered faces of the face). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting face id to return (used to list a range of faces).
topStringNoNumber of faces to return starting with the face id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         persistedFaceId: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of persisted faces within the face list or large face list along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listFacesWithResponse(String largeFaceListId, RequestOptions requestOptions) { + return listFacesWithResponseAsync(largeFaceListId, requestOptions).block(); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String largeFaceListId, BinaryData image, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromStream( + this.client.getEndpoint(), largeFaceListId, image, requestOptions, context)); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String largeFaceListId, BinaryData image, RequestOptions requestOptions, Context context) { + return service.addFaceFromStream(this.client.getEndpoint(), largeFaceListId, image, requestOptions, context); + } + + /** + * Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains + * multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId + * representing the added face. No image will be stored. Only the extracted face feature will be stored on server + * until [LargeFaceList Face - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/deleteface) or + * [LargeFaceList - Delete](https://docs.microsoft.com/rest/api/faceapi/largefacelist/delete) is called. <br + * /> Note persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * 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. * "targetFace" rectangle should contain one face. Zero or multiple faces will + * be regarded as an error. If the provided "targetFace" rectangle is not returned from [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no guarantee to detect and add + * the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large + * occlusions will cause failures. * Adding/deleting faces to/from a same face list are processed sequentially and + * to/from different face lists are in parallel. * The minimum detectable face size is 36x36 pixels in an image no + * larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally + * larger minimum face size. * Different 'detectionModel' values can be provided. To use and compare different + * detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Quota: * Free-tier subscription quota: 1,000 faces per large face list. * S0-tier subscription quota: + * 1,000,000 faces per large face list. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String largeFaceListId, BinaryData image, RequestOptions requestOptions) { + return addFaceFromStreamWithResponseAsync(largeFaceListId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargePersonGroupPersonsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargePersonGroupPersonsImpl.java new file mode 100644 index 000000000000..fdd222fb5ef1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargePersonGroupPersonsImpl.java @@ -0,0 +1,1492 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LargePersonGroupPersons. */ +public final class LargePersonGroupPersonsImpl { + /** The proxy service used to perform REST calls. */ + private final LargePersonGroupPersonsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of LargePersonGroupPersonsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LargePersonGroupPersonsImpl(FaceClientImpl client) { + this.service = + RestProxy.create( + LargePersonGroupPersonsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientLargePersonGroupPersons to be used by the proxy service to + * perform REST calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientLargePerso") + private interface LargePersonGroupPersonsService { + @Post("/largepersongroups/{largePersonGroupId}/persons") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/largepersongroups/{largePersonGroupId}/persons") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + RequestOptions requestOptions, + Context context); + + @Delete("/largepersongroups/{largePersonGroupId}/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Get("/largepersongroups/{largePersonGroupId}/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Patch("/largepersongroups/{largePersonGroupId}/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteFace( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Get("/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFace( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Patch("/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateFace( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + @PathParam("persistedFaceId") String persistedFaceId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromUrl( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + @BodyParam("application/json") BinaryData imageUrl, + RequestOptions requestOptions, + Context context); + + @Post("/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromStream( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @PathParam("personId") String personId, + @BodyParam("application/octet-stream") BinaryData image, + RequestOptions requestOptions, + Context context); + } + + /** + * Create a new person in a specified large person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.create(this.client.getEndpoint(), largePersonGroupId, body, requestOptions, context)); + } + + /** + * Create a new person in a specified large person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.create(this.client.getEndpoint(), largePersonGroupId, body, requestOptions, context); + } + + /** + * Create a new person in a specified large person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return createWithResponseAsync(largePersonGroupId, body, requestOptions).block(); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String largePersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), largePersonGroupId, requestOptions, context)); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync( + String largePersonGroupId, RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), largePersonGroupId, requestOptions, context); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return listWithResponseAsync(largePersonGroupId, requestOptions).block(); + } + + /** + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and face feature + * in the person entry will all be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.delete( + this.client.getEndpoint(), largePersonGroupId, personId, requestOptions, context)); + } + + /** + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and face feature + * in the person entry will all be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String largePersonGroupId, String personId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), largePersonGroupId, personId, requestOptions, context); + } + + /** + * Delete an existing person from a large person group. The persistedFaceId, userData, person name and face feature + * in the person entry will all be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return deleteWithResponseAsync(largePersonGroupId, personId, requestOptions).block(); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face feature. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.get(this.client.getEndpoint(), largePersonGroupId, personId, requestOptions, context)); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face feature. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String largePersonGroupId, String personId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), largePersonGroupId, personId, requestOptions, context); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face feature. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String largePersonGroupId, String personId, RequestOptions requestOptions) { + return getWithResponseAsync(largePersonGroupId, personId, requestOptions).block(); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String largePersonGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.update( + this.client.getEndpoint(), + largePersonGroupId, + personId, + body, + requestOptions, + context)); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String largePersonGroupId, + String personId, + BinaryData body, + RequestOptions requestOptions, + Context context) { + return service.update(this.client.getEndpoint(), largePersonGroupId, personId, body, requestOptions, context); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String largePersonGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(largePersonGroupId, personId, body, requestOptions).block(); + } + + /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. <br /> Adding/deleting faces to/from a same person will be processed sequentially. + * Adding/deleting faces to/from different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deleteFace( + this.client.getEndpoint(), + largePersonGroupId, + personId, + persistedFaceId, + requestOptions, + context)); + } + + /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. <br /> Adding/deleting faces to/from a same person will be processed sequentially. + * Adding/deleting faces to/from different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String largePersonGroupId, + String personId, + String persistedFaceId, + RequestOptions requestOptions, + Context context) { + return service.deleteFace( + this.client.getEndpoint(), largePersonGroupId, personId, persistedFaceId, requestOptions, context); + } + + /** + * Delete a face from a person in a large person group by specified largePersonGroupId, personId and + * persistedFaceId. <br /> Adding/deleting faces to/from a same person will be processed sequentially. + * Adding/deleting faces to/from different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return deleteFaceWithResponseAsync(largePersonGroupId, personId, persistedFaceId, requestOptions).block(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * largePersonGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponseAsync( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getFace( + this.client.getEndpoint(), + largePersonGroupId, + personId, + persistedFaceId, + requestOptions, + context)); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * largePersonGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponseAsync( + String largePersonGroupId, + String personId, + String persistedFaceId, + RequestOptions requestOptions, + Context context) { + return service.getFace( + this.client.getEndpoint(), largePersonGroupId, personId, persistedFaceId, requestOptions, context); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * largePersonGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFaceWithResponse( + String largePersonGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return getFaceWithResponseAsync(largePersonGroupId, personId, persistedFaceId, requestOptions).block(); + } + + /** + * Update a person persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponseAsync( + String largePersonGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.updateFace( + this.client.getEndpoint(), + largePersonGroupId, + personId, + persistedFaceId, + body, + requestOptions, + context)); + } + + /** + * Update a person persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponseAsync( + String largePersonGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions, + Context context) { + return service.updateFace( + this.client.getEndpoint(), + largePersonGroupId, + personId, + persistedFaceId, + body, + requestOptions, + context); + } + + /** + * Update a person persisted face's userData field. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateFaceWithResponse( + String largePersonGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return updateFaceWithResponseAsync(largePersonGroupId, personId, persistedFaceId, body, requestOptions).block(); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String largePersonGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromUrl( + this.client.getEndpoint(), + largePersonGroupId, + personId, + imageUrl, + requestOptions, + context)); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String largePersonGroupId, + String personId, + BinaryData imageUrl, + RequestOptions requestOptions, + Context context) { + return service.addFaceFromUrl( + this.client.getEndpoint(), largePersonGroupId, personId, imageUrl, requestOptions, context); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String largePersonGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return addFaceFromUrlWithResponseAsync(largePersonGroupId, personId, imageUrl, requestOptions).block(); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String largePersonGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromStream( + this.client.getEndpoint(), + largePersonGroupId, + personId, + image, + requestOptions, + context)); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String largePersonGroupId, + String personId, + BinaryData image, + RequestOptions requestOptions, + Context context) { + return service.addFaceFromStream( + this.client.getEndpoint(), largePersonGroupId, personId, image, requestOptions, context); + } + + /** + * Add a face to a person into a large person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [LargePersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/deleteface), [LargePersonGroup Person + * - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or [LargePersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String largePersonGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return addFaceFromStreamWithResponseAsync(largePersonGroupId, personId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargePersonGroupsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargePersonGroupsImpl.java new file mode 100644 index 000000000000..55f6ef9d8e36 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/LargePersonGroupsImpl.java @@ -0,0 +1,862 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LargePersonGroups. */ +public final class LargePersonGroupsImpl { + /** The proxy service used to perform REST calls. */ + private final LargePersonGroupsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of LargePersonGroupsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LargePersonGroupsImpl(FaceClientImpl client) { + this.service = + RestProxy.create( + LargePersonGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientLargePersonGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientLargePerso") + private interface LargePersonGroupsService { + @Put("/largepersongroups/{largePersonGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/largepersongroups/{largePersonGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + RequestOptions requestOptions, + Context context); + + @Get("/largepersongroups/{largePersonGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + RequestOptions requestOptions, + Context context); + + @Patch("/largepersongroups/{largePersonGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/largepersongroups/{largePersonGroupId}/training") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTrainingStatus( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + RequestOptions requestOptions, + Context context); + + @Get("/largepersongroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Post("/largepersongroups/{largePersonGroupId}/train") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> train( + @HostParam("Endpoint") String endpoint, + @PathParam("largePersonGroupId") String largePersonGroupId, + RequestOptions requestOptions, + Context context); + } + + /** + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData and + * recognitionModel. <br /> A large person group is the container of the uploaded person data, including face + * recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person into the group, + * and call [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get + * this group ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> + * No image will be stored. Only the person's extracted face features and userData will be stored on server until + * [LargePersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. + * <br/>'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. Please refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large person group quota: * Free-tier subscription quota: 1,000 large person groups. * S0-tier subscription + * quota: 1,000,000 large person groups. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.create(this.client.getEndpoint(), largePersonGroupId, body, requestOptions, context)); + } + + /** + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData and + * recognitionModel. <br /> A large person group is the container of the uploaded person data, including face + * recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person into the group, + * and call [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get + * this group ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> + * No image will be stored. Only the person's extracted face features and userData will be stored on server until + * [LargePersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. + * <br/>'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. Please refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large person group quota: * Free-tier subscription quota: 1,000 large person groups. * S0-tier subscription + * quota: 1,000,000 large person groups. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.create(this.client.getEndpoint(), largePersonGroupId, body, requestOptions, context); + } + + /** + * Create a new large person group with user-specified largePersonGroupId, name, an optional userData and + * recognitionModel. <br /> A large person group is the container of the uploaded person data, including face + * recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/create) to add person into the group, + * and call [LargePersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/train) to get + * this group ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> + * No image will be stored. Only the person's extracted face features and userData will be stored on server until + * [LargePersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/delete) or + * [LargePersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/largepersongroup/delete) is called. + * <br/>'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. Please refer to [Specify a face recognition + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model). + * + *

Large person group quota: * Free-tier subscription quota: 1,000 large person groups. * S0-tier subscription + * quota: 1,000,000 large person groups. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for creating new large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return createWithResponseAsync(largePersonGroupId, body, requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String largePersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), largePersonGroupId, requestOptions, context)); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String largePersonGroupId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), largePersonGroupId, requestOptions, context); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return deleteWithResponseAsync(largePersonGroupId, requestOptions).block(); + } + + /** + * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve person + * information under the large person group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largePersonGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large person group object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String largePersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), largePersonGroupId, requestOptions, context)); + } + + /** + * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve person + * information under the large person group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largePersonGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large person group object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String largePersonGroupId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), largePersonGroupId, requestOptions, context); + } + + /** + * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroupperson/list) instead to retrieve person + * information under the large person group. + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     largePersonGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return large person group object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return getWithResponseAsync(largePersonGroupId, requestOptions).block(); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in + * request body will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for updating large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.update(this.client.getEndpoint(), largePersonGroupId, body, requestOptions, context)); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in + * request body will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for updating large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.update(this.client.getEndpoint(), largePersonGroupId, body, requestOptions, context); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in + * request body will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param body Request body for updating large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String largePersonGroupId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(largePersonGroupId, body, requestOptions).block(); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponseAsync( + String largePersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getTrainingStatus( + this.client.getEndpoint(), largePersonGroupId, requestOptions, context)); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponseAsync( + String largePersonGroupId, RequestOptions requestOptions, Context context) { + return service.getTrainingStatus(this.client.getEndpoint(), largePersonGroupId, requestOptions, context); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param largePersonGroupId Id referencing a particular large person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTrainingStatusWithResponse( + String largePersonGroupId, RequestOptions requestOptions) { + return getTrainingStatusWithResponseAsync(largePersonGroupId, requestOptions).block(); + } + + /** + * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br /> * + * 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. <br /> For example, total 5 large + * person groups: "group1", ..., "group5". <br /> "start=&top=" will return all 5 groups. <br /> + * "start=&top=2" will return "group1", "group2". <br /> "start=group2&top=3" will return "group3", + * "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList large person groups from the least largePersonGroupId greater than the "start".
topStringNoThe number of large person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largePersonGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large person groups along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br /> * + * 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. <br /> For example, total 5 large + * person groups: "group1", ..., "group5". <br /> "start=&top=" will return all 5 groups. <br /> + * "start=&top=2" will return "group1", "group2". <br /> "start=group2&top=3" will return "group3", + * "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList large person groups from the least largePersonGroupId greater than the "start".
topStringNoThe number of large person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largePersonGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large person groups along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), requestOptions, context); + } + + /** + * List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br /> * + * 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. <br /> For example, total 5 large + * person groups: "group1", ..., "group5". <br /> "start=&top=" will return all 5 groups. <br /> + * "start=&top=2" will return "group1", "group2". <br /> "start=group2&top=3" will return "group3", + * "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList large person groups from the least largePersonGroupId greater than the "start".
topStringNoThe number of large person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         largePersonGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of large person groups along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return listWithResponseAsync(requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponseAsync(String largePersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.train(this.client.getEndpoint(), largePersonGroupId, requestOptions, context)); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponseAsync( + String largePersonGroupId, RequestOptions requestOptions, Context context) { + return service.train(this.client.getEndpoint(), largePersonGroupId, requestOptions, context); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainWithResponse(String largePersonGroupId, RequestOptions requestOptions) { + return trainWithResponseAsync(largePersonGroupId, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonDirectoriesImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonDirectoriesImpl.java new file mode 100644 index 000000000000..44403ecf9215 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonDirectoriesImpl.java @@ -0,0 +1,2196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PersonDirectories. */ +public final class PersonDirectoriesImpl { + /** The proxy service used to perform REST calls. */ + private final PersonDirectoriesService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of PersonDirectoriesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PersonDirectoriesImpl(FaceClientImpl client) { + this.service = + RestProxy.create( + PersonDirectoriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientPersonDirectories to be used by the proxy service to + * perform REST calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientPersonDire") + private interface PersonDirectoriesService { + @Get("/persons") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getPersons( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Post("/persons") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createPerson( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Patch("/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updatePerson( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/persons/{personId}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deletePerson( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Get("/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getPerson( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Post("/persons/{personId}/recognitionModels/{recognitionModel}/persistedFaces") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addPersonFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @PathParam("recognitionModel") String recognitionModel, + RequestOptions requestOptions, + Context context); + + @Get("/persons/{personId}/recognitionModels/{recognitionModel}/persistedFaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getPersonFaces( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @PathParam("recognitionModel") String recognitionModel, + RequestOptions requestOptions, + Context context); + + @Delete("/persons/{personId}/recognitionModels/{recognitionModel}/persistedFaces/{persistedFaceId}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deletePersonFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @PathParam("recognitionModel") String recognitionModel, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Get("/persons/{personId}/recognitionModels/{recognitionModel}/persistedFaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getPersonFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @PathParam("recognitionModel") String recognitionModel, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Patch("/persons/{personId}/recognitionModels/{recognitionModel}/persistedFaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updatePersonFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @PathParam("recognitionModel") String recognitionModel, + @PathParam("persistedFaceId") String persistedFaceId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Put("/dynamicpersongroups/{dynamicPersonGroupId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createDynamicPersonGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("dynamicPersonGroupId") String dynamicPersonGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Patch("/dynamicpersongroups/{dynamicPersonGroupId}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateDynamicPersonGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("dynamicPersonGroupId") String dynamicPersonGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/dynamicpersongroups/{dynamicPersonGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDynamicPersonGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("dynamicPersonGroupId") String dynamicPersonGroupId, + RequestOptions requestOptions, + Context context); + + @Delete("/dynamicpersongroups/{dynamicPersonGroupId}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteDynamicPersonGroup( + @HostParam("Endpoint") String endpoint, + @PathParam("dynamicPersonGroupId") String dynamicPersonGroupId, + RequestOptions requestOptions, + Context context); + + @Get("/dynamicpersongroups/{dynamicPersonGroupId}/persons") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listDynamicPersonGroupPersons( + @HostParam("Endpoint") String endpoint, + @PathParam("dynamicPersonGroupId") String dynamicPersonGroupId, + RequestOptions requestOptions, + Context context); + + @Get("/dynamicpersongroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listDynamicPersonGroups( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/persons/{personId}/dynamicPersonGroupReferences") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listDynamicPersonGroupPersonReferences( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Post("/persons/{personId}/recognitionModels/{recognitionModel}/persistedFaces") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addPersonFaceFromStream( + @HostParam("Endpoint") String endpoint, + @PathParam("personId") String personId, + @PathParam("recognitionModel") String recognitionModel, + @BodyParam("application/octet-stream") BinaryData image, + RequestOptions requestOptions, + Context context); + } + + /** + * Retrieve list of person information in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoThe start parameter
topStringNoThe top parameter
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of EnrollmentResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonsWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.getPersons(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * Retrieve list of person information in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoThe start parameter
topStringNoThe top parameter
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of EnrollmentResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonsWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.getPersons(this.client.getEndpoint(), requestOptions, context); + } + + /** + * Retrieve list of person information in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoThe start parameter
topStringNoThe top parameter
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of EnrollmentResponse along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonsWithResponse(RequestOptions requestOptions) { + return getPersonsWithResponseAsync(requestOptions).block(); + } + + /** + * Creates a new person in person directory. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     * }
+     * }
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createPersonWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.createPerson(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * Creates a new person in person directory. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     * }
+     * }
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createPersonWithResponseAsync( + BinaryData body, RequestOptions requestOptions, Context context) { + return service.createPerson(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * Creates a new person in person directory. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     * }
+     * }
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createPersonWithResponse(BinaryData body, RequestOptions requestOptions) { + return createPersonWithResponseAsync(body, requestOptions).block(); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId The personId parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePersonWithResponseAsync( + String personId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.updatePerson(this.client.getEndpoint(), personId, body, requestOptions, context)); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId The personId parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePersonWithResponseAsync( + String personId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.updatePerson(this.client.getEndpoint(), personId, body, requestOptions, context); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId The personId parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePersonWithResponse(String personId, BinaryData body, RequestOptions requestOptions) { + return updatePersonWithResponseAsync(personId, body, requestOptions).block(); + } + + /** + * Delete an existing person from person directory. The persistedFaceId, userData, person name and face feature(s) + * in the person entry will all be deleted. + * + * @param personId The personId parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deletePersonWithResponseAsync(String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.deletePerson(this.client.getEndpoint(), personId, requestOptions, context)); + } + + /** + * Delete an existing person from person directory. The persistedFaceId, userData, person name and face feature(s) + * in the person entry will all be deleted. + * + * @param personId The personId parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deletePersonWithResponseAsync( + String personId, RequestOptions requestOptions, Context context) { + return service.deletePerson(this.client.getEndpoint(), personId, requestOptions, context); + } + + /** + * Delete an existing person from person directory. The persistedFaceId, userData, person name and face feature(s) + * in the person entry will all be deleted. + * + * @param personId The personId parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deletePersonWithResponse(String personId, RequestOptions requestOptions) { + return deletePersonWithResponseAsync(personId, requestOptions).block(); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face + * feature(s). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonWithResponseAsync(String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.getPerson(this.client.getEndpoint(), personId, requestOptions, context)); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face + * feature(s). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonWithResponseAsync( + String personId, RequestOptions requestOptions, Context context) { + return service.getPerson(this.client.getEndpoint(), personId, requestOptions, context); + } + + /** + * Retrieve a person's name and userData, and the persisted faceIds representing the registered person face + * feature(s). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonWithResponse(String personId, RequestOptions requestOptions) { + return getPersonWithResponseAsync(personId, requestOptions).block(); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addPersonFaceWithResponseAsync( + String personId, String recognitionModel, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addPersonFace( + this.client.getEndpoint(), personId, recognitionModel, requestOptions, context)); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addPersonFaceWithResponseAsync( + String personId, String recognitionModel, RequestOptions requestOptions, Context context) { + return service.addPersonFace(this.client.getEndpoint(), personId, recognitionModel, requestOptions, context); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addPersonFaceWithResponse( + String personId, String recognitionModel, RequestOptions requestOptions) { + return addPersonFaceWithResponseAsync(personId, recognitionModel, requestOptions).block(); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get persistedFaceIds from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonFacesWithResponseAsync( + String personId, String recognitionModel, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getPersonFaces( + this.client.getEndpoint(), personId, recognitionModel, requestOptions, context)); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get persistedFaceIds from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonFacesWithResponseAsync( + String personId, String recognitionModel, RequestOptions requestOptions, Context context) { + return service.getPersonFaces(this.client.getEndpoint(), personId, recognitionModel, requestOptions, context); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get persistedFaceIds from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonFacesWithResponse( + String personId, String recognitionModel, RequestOptions requestOptions) { + return getPersonFacesWithResponseAsync(personId, recognitionModel, requestOptions).block(); + } + + /** + * Delete an existing person face from person directory. The persistedFaceId, userData, and face feature in the + * person entry will all be deleted. + * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param persistedFaceId Persisted face id to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deletePersonFaceWithResponseAsync( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deletePersonFace( + this.client.getEndpoint(), + personId, + recognitionModel, + persistedFaceId, + requestOptions, + context)); + } + + /** + * Delete an existing person face from person directory. The persistedFaceId, userData, and face feature in the + * person entry will all be deleted. + * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param persistedFaceId Persisted face id to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deletePersonFaceWithResponseAsync( + String personId, + String recognitionModel, + String persistedFaceId, + RequestOptions requestOptions, + Context context) { + return service.deletePersonFace( + this.client.getEndpoint(), personId, recognitionModel, persistedFaceId, requestOptions, context); + } + + /** + * Delete an existing person face from person directory. The persistedFaceId, userData, and face feature in the + * person entry will all be deleted. + * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param persistedFaceId Persisted face id to delete. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deletePersonFaceWithResponse( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return deletePersonFaceWithResponseAsync(personId, recognitionModel, persistedFaceId, requestOptions).block(); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId Target person face id to get. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonFaceWithResponseAsync( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getPersonFace( + this.client.getEndpoint(), + personId, + recognitionModel, + persistedFaceId, + requestOptions, + context)); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId Target person face id to get. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPersonFaceWithResponseAsync( + String personId, + String recognitionModel, + String persistedFaceId, + RequestOptions requestOptions, + Context context) { + return service.getPersonFace( + this.client.getEndpoint(), personId, recognitionModel, persistedFaceId, requestOptions, context); + } + + /** + * Retrieve person face information. The persisted person face is specified by its personId and persistedFaceId. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to get face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId Target person face id to get. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPersonFaceWithResponse( + String personId, String recognitionModel, String persistedFaceId, RequestOptions requestOptions) { + return getPersonFaceWithResponseAsync(personId, recognitionModel, persistedFaceId, requestOptions).block(); + } + + /** + * Update the data of a person face. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     detectionModel: String(detection_01/detection_02/detection_03/detection_preview_1904/ir_detection_01/expression_01)
+     *     faceFeature: byte[]
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to update face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId PersistedFaceId created from Person Face Create. + * @param body Target person face id to update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePersonFaceWithResponseAsync( + String personId, + String recognitionModel, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.updatePersonFace( + this.client.getEndpoint(), + personId, + recognitionModel, + persistedFaceId, + body, + requestOptions, + context)); + } + + /** + * Update the data of a person face. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     detectionModel: String(detection_01/detection_02/detection_03/detection_preview_1904/ir_detection_01/expression_01)
+     *     faceFeature: byte[]
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to update face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId PersistedFaceId created from Person Face Create. + * @param body Target person face id to update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePersonFaceWithResponseAsync( + String personId, + String recognitionModel, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions, + Context context) { + return service.updatePersonFace( + this.client.getEndpoint(), personId, recognitionModel, persistedFaceId, body, requestOptions, context); + } + + /** + * Update the data of a person face. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     detectionModel: String(detection_01/detection_02/detection_03/detection_preview_1904/ir_detection_01/expression_01)
+     *     faceFeature: byte[]
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Target person to update face from. + * @param recognitionModel The 'recognitionModel' associated with this persisted face. + * @param persistedFaceId PersistedFaceId created from Person Face Create. + * @param body Target person face id to update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePersonFaceWithResponse( + String personId, + String recognitionModel, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return updatePersonFaceWithResponseAsync(personId, recognitionModel, persistedFaceId, body, requestOptions) + .block(); + } + + /** + * Creates a new dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. A + * dynamic person group is a container that references persons. After creation, use "DynamicPersonGroup - Update" to + * add/remove persons into the search space. DynamicPersonGroup and UserData will be stored on server until + * DynamicPersonGroup Delete is called. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. Valid format should be a string composed by + * numbers, English letters in lower case, '-', '_', and no longer than 64 characters. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.createDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, body, requestOptions, context)); + } + + /** + * Creates a new dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. A + * dynamic person group is a container that references persons. After creation, use "DynamicPersonGroup - Update" to + * add/remove persons into the search space. DynamicPersonGroup and UserData will be stored on server until + * DynamicPersonGroup Delete is called. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. Valid format should be a string composed by + * numbers, English letters in lower case, '-', '_', and no longer than 64 characters. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.createDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, body, requestOptions, context); + } + + /** + * Creates a new dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. A + * dynamic person group is a container that references persons. After creation, use "DynamicPersonGroup - Update" to + * add/remove persons into the search space. DynamicPersonGroup and UserData will be stored on server until + * DynamicPersonGroup Delete is called. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. Valid format should be a string composed by + * numbers, English letters in lower case, '-', '_', and no longer than 64 characters. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return createDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, body, requestOptions).block(); + } + + /** + * Updates an existing dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     removePersonIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.updateDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, body, requestOptions, context)); + } + + /** + * Updates an existing dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     removePersonIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.updateDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, body, requestOptions, context); + } + + /** + * Updates an existing dynamic person group with specified dynamicPersonGroupId, name, and user-provided userData. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     removePersonIds: [
+     *         String
+     *     ]
+     *     name: String
+     *     userData: String
+     *     addPersonIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, BinaryData body, RequestOptions requestOptions) { + return updateDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, body, requestOptions).block(); + } + + /** + * Get metadata on a dynamic person group. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     dynamicPersonGroupId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return metadata on a dynamic person group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, requestOptions, context)); + } + + /** + * Get metadata on a dynamic person group. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     dynamicPersonGroupId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return metadata on a dynamic person group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, RequestOptions requestOptions, Context context) { + return service.getDynamicPersonGroup(this.client.getEndpoint(), dynamicPersonGroupId, requestOptions, context); + } + + /** + * Get metadata on a dynamic person group. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     dynamicPersonGroupId: String
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param dynamicPersonGroupId User provided dynamic person group id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return metadata on a dynamic person group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return getDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, requestOptions).block(); + } + + /** + * Delete an existing dynamic person group. Note that Persons are not deleted with this operation. To delete person + * call Person Delete. + * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deleteDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, requestOptions, context)); + } + + /** + * Delete an existing dynamic person group. Note that Persons are not deleted with this operation. To delete person + * call Person Delete. + * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteDynamicPersonGroupWithResponseAsync( + String dynamicPersonGroupId, RequestOptions requestOptions, Context context) { + return service.deleteDynamicPersonGroup( + this.client.getEndpoint(), dynamicPersonGroupId, requestOptions, context); + } + + /** + * Delete an existing dynamic person group. Note that Persons are not deleted with this operation. To delete person + * call Person Delete. + * + * @param dynamicPersonGroupId User provided dynamic person group Id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteDynamicPersonGroupWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return deleteDynamicPersonGroupWithResponseAsync(dynamicPersonGroupId, requestOptions).block(); + } + + /** + * Retrieve list of persons referenced in a given DynamicPersonGroup person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of persons to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId Dynamic person group Id to list persons from. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupPersonsWithResponseAsync( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.listDynamicPersonGroupPersons( + this.client.getEndpoint(), dynamicPersonGroupId, requestOptions, context)); + } + + /** + * Retrieve list of persons referenced in a given DynamicPersonGroup person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of persons to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId Dynamic person group Id to list persons from. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupPersonsWithResponseAsync( + String dynamicPersonGroupId, RequestOptions requestOptions, Context context) { + return service.listDynamicPersonGroupPersons( + this.client.getEndpoint(), dynamicPersonGroupId, requestOptions, context); + } + + /** + * Retrieve list of persons referenced in a given DynamicPersonGroup person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList persons from the least personId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of persons to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param dynamicPersonGroupId Dynamic person group Id to list persons from. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDynamicPersonGroupPersonsWithResponse( + String dynamicPersonGroupId, RequestOptions requestOptions) { + return listDynamicPersonGroupPersonsWithResponseAsync(dynamicPersonGroupId, requestOptions).block(); + } + + /** + * Retrieve list of dynamic person groups in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamicPersonGroupId from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroups to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         dynamicPersonGroupId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DynamicPersonGroupGetResponse along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupsWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.listDynamicPersonGroups(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * Retrieve list of dynamic person groups in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamicPersonGroupId from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroups to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         dynamicPersonGroupId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DynamicPersonGroupGetResponse along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupsWithResponseAsync( + RequestOptions requestOptions, Context context) { + return service.listDynamicPersonGroups(this.client.getEndpoint(), requestOptions, context); + } + + /** + * Retrieve list of dynamic person groups in person directory. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamicPersonGroupId from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroups to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         dynamicPersonGroupId: String
+     *         name: String
+     *         userData: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return array of DynamicPersonGroupGetResponse along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDynamicPersonGroupsWithResponse(RequestOptions requestOptions) { + return listDynamicPersonGroupsWithResponseAsync(requestOptions).block(); + } + + /** + * List the dynamic person groups that a person has been referenced in. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamic person group id from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroupId to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     dynamicPersonGroupIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personId Valid PersonId created from Person Create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupPersonReferencesWithResponseAsync( + String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.listDynamicPersonGroupPersonReferences( + this.client.getEndpoint(), personId, requestOptions, context)); + } + + /** + * List the dynamic person groups that a person has been referenced in. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamic person group id from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroupId to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     dynamicPersonGroupIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personId Valid PersonId created from Person Create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listDynamicPersonGroupPersonReferencesWithResponseAsync( + String personId, RequestOptions requestOptions, Context context) { + return service.listDynamicPersonGroupPersonReferences( + this.client.getEndpoint(), personId, requestOptions, context); + } + + /** + * List the dynamic person groups that a person has been referenced in. + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList dynamic person group id from the least dynamicPersonGroupId greater than the "start". It contains no more than 64 characters. Default is empty.
topStringNoThe number of dynamicPersonGroupId to list, ranging in [1, 1000]. Default is 1000.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personId: String
+     *     dynamicPersonGroupIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personId Valid PersonId created from Person Create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDynamicPersonGroupPersonReferencesWithResponse( + String personId, RequestOptions requestOptions) { + return listDynamicPersonGroupPersonReferencesWithResponseAsync(personId, requestOptions).block(); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addPersonFaceFromStreamWithResponseAsync( + String personId, String recognitionModel, BinaryData image, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addPersonFaceFromStream( + this.client.getEndpoint(), personId, recognitionModel, image, requestOptions, context)); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addPersonFaceFromStreamWithResponseAsync( + String personId, + String recognitionModel, + BinaryData image, + RequestOptions requestOptions, + Context context) { + return service.addPersonFaceFromStream( + this.client.getEndpoint(), personId, recognitionModel, image, requestOptions, context); + } + + /** + * Add a new face to person. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
detectionModelStringNoDetection model string.
userDataStringNoUser data of person face.
targetFaceStringNoTarget face.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     recognitionModel: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personId Person id. + * @param recognitionModel Recognition model string. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addPersonFaceFromStreamWithResponse( + String personId, String recognitionModel, BinaryData image, RequestOptions requestOptions) { + return addPersonFaceFromStreamWithResponseAsync(personId, recognitionModel, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonGroupPersonsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonGroupPersonsImpl.java new file mode 100644 index 000000000000..a5f1492c509d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonGroupPersonsImpl.java @@ -0,0 +1,1505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PersonGroupPersons. */ +public final class PersonGroupPersonsImpl { + /** The proxy service used to perform REST calls. */ + private final PersonGroupPersonsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of PersonGroupPersonsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PersonGroupPersonsImpl(FaceClientImpl client) { + this.service = + RestProxy.create( + PersonGroupPersonsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientPersonGroupPersons to be used by the proxy service to + * perform REST calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientPersonGrou") + private interface PersonGroupPersonsService { + @Post("/persongroups/{personGroupId}/persons") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/persongroups/{personGroupId}/persons") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + RequestOptions requestOptions, + Context context); + + @Delete("/persongroups/{personGroupId}/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Get("/persongroups/{personGroupId}/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + RequestOptions requestOptions, + Context context); + + @Patch("/persongroups/{personGroupId}/persons/{personId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Get("/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + @PathParam("persistedFaceId") String persistedFaceId, + RequestOptions requestOptions, + Context context); + + @Patch("/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateFace( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + @PathParam("persistedFaceId") String persistedFaceId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/persongroups/{personGroupId}/persons/{personId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromUrl( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + @BodyParam("application/json") BinaryData imageUrl, + RequestOptions requestOptions, + Context context); + + @Post("/persongroups/{personGroupId}/persons/{personId}/persistedfaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addFaceFromStream( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @PathParam("personId") String personId, + @BodyParam("application/octet-stream") BinaryData image, + RequestOptions requestOptions, + Context context); + } + + /** + * Create a new person in a specified person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.create(this.client.getEndpoint(), personGroupId, body, requestOptions, context)); + } + + /** + * Create a new person in a specified person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String personGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.create(this.client.getEndpoint(), personGroupId, body, requestOptions, context); + } + + /** + * Create a new person in a specified person group. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return createWithResponseAsync(personGroupId, body, requestOptions).block(); + } + + /** + * List all persons in a person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String personGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), personGroupId, requestOptions, context)); + } + + /** + * List all persons in a person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync( + String personGroupId, RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), personGroupId, requestOptions, context); + } + + /** + * List all persons in a person group, and retrieve person information (including personId, name, userData and + * persistedFaceIds of registered faces of the person). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoStarting person id to return (used to list a range of persons).
topStringNoNumber of persons to return starting with the person id indicated by the 'start' parameter.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         name: String
+     *         userData: String
+     *         personId: String
+     *         persistedFaceIds: [
+     *             String
+     *         ]
+     *     }
+     * ]
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of Persons along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String personGroupId, RequestOptions requestOptions) { + return listWithResponseAsync(personGroupId, requestOptions).block(); + } + + /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face feature in the + * person entry will all be deleted. + * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String personGroupId, String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), personGroupId, personId, requestOptions, context)); + } + + /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face feature in the + * person entry will all be deleted. + * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String personGroupId, String personId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), personGroupId, personId, requestOptions, context); + } + + /** + * Delete an existing person from a person group. The persistedFaceId, userData, person name and face feature in the + * person entry will all be deleted. + * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String personGroupId, String personId, RequestOptions requestOptions) { + return deleteWithResponseAsync(personGroupId, personId, requestOptions).block(); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String personGroupId, String personId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), personGroupId, personId, requestOptions, context)); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String personGroupId, String personId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), personGroupId, personId, requestOptions, context); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     personId: String
+     *     persistedFaceIds: [
+     *         String
+     *     ]
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String personGroupId, String personId, RequestOptions requestOptions) { + return getWithResponseAsync(personGroupId, personId, requestOptions).block(); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String personGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.update( + this.client.getEndpoint(), personGroupId, personId, body, requestOptions, context)); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String personGroupId, String personId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.update(this.client.getEndpoint(), personGroupId, personId, body, requestOptions, context); + } + + /** + * Update name or userData of a person. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param body Request body for person update operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String personGroupId, String personId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(personGroupId, personId, body, requestOptions).block(); + } + + /** + * Delete a face from a person in a person group by specified personGroupId, personId and persistedFaceId. <br + * /> Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from + * different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.deleteFace( + this.client.getEndpoint(), + personGroupId, + personId, + persistedFaceId, + requestOptions, + context)); + } + + /** + * Delete a face from a person in a person group by specified personGroupId, personId and persistedFaceId. <br + * /> Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from + * different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteFaceWithResponseAsync( + String personGroupId, + String personId, + String persistedFaceId, + RequestOptions requestOptions, + Context context) { + return service.deleteFace( + this.client.getEndpoint(), personGroupId, personId, persistedFaceId, requestOptions, context); + } + + /** + * Delete a face from a person in a person group by specified personGroupId, personId and persistedFaceId. <br + * /> Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from + * different persons are processed in parallel. + * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteFaceWithResponse( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return deleteFaceWithResponseAsync(personGroupId, personId, persistedFaceId, requestOptions).block(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * personGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponseAsync( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getFace( + this.client.getEndpoint(), + personGroupId, + personId, + persistedFaceId, + requestOptions, + context)); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * personGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFaceWithResponseAsync( + String personGroupId, + String personId, + String persistedFaceId, + RequestOptions requestOptions, + Context context) { + return service.getFace( + this.client.getEndpoint(), personGroupId, personId, persistedFaceId, requestOptions, context); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging + * personGroupId). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFaceWithResponse( + String personGroupId, String personId, String persistedFaceId, RequestOptions requestOptions) { + return getFaceWithResponseAsync(personGroupId, personId, persistedFaceId, requestOptions).block(); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponseAsync( + String personGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.updateFace( + this.client.getEndpoint(), + personGroupId, + personId, + persistedFaceId, + body, + requestOptions, + context)); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateFaceWithResponseAsync( + String personGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions, + Context context) { + return service.updateFace( + this.client.getEndpoint(), personGroupId, personId, persistedFaceId, body, requestOptions, context); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     userData: String
+     * }
+     * }
+ * + * @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 body Request body for updating persisted face. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateFaceWithResponse( + String personGroupId, + String personId, + String persistedFaceId, + BinaryData body, + RequestOptions requestOptions) { + return updateFaceWithResponseAsync(personGroupId, personId, persistedFaceId, body, requestOptions).block(); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String personGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromUrl( + this.client.getEndpoint(), personGroupId, personId, imageUrl, requestOptions, context)); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromUrlWithResponseAsync( + String personGroupId, + String personId, + BinaryData imageUrl, + RequestOptions requestOptions, + Context context) { + return service.addFaceFromUrl( + this.client.getEndpoint(), personGroupId, personId, imageUrl, requestOptions, context); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Request Body Schema + * + *

{@code
+     * {
+     *     url: String
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param imageUrl A JSON document with a URL pointing to the image that is to be analyzed. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromUrlWithResponse( + String personGroupId, String personId, BinaryData imageUrl, RequestOptions requestOptions) { + return addFaceFromUrlWithResponseAsync(personGroupId, personId, imageUrl, requestOptions).block(); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String personGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.addFaceFromStream( + this.client.getEndpoint(), personGroupId, personId, image, requestOptions, context)); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addFaceFromStreamWithResponseAsync( + String personGroupId, String personId, BinaryData image, RequestOptions requestOptions, Context context) { + return service.addFaceFromStream( + this.client.getEndpoint(), personGroupId, personId, image, requestOptions, context); + } + + /** + * Add a face to a person into a person group for face identification or verification. To deal with an image + * contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a + * persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be + * stored on server until [PersonGroup PersonFace - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/deleteface), [PersonGroup Person - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or [PersonGroup - + * Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. <br /> Note + * persistedFaceId is different from faceId generated by [Face - + * Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl). * Higher face image quality means better + * recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 + * pixels between eyes) or bigger. * Each person entry can hold up to 248 faces. * JPEG, PNG, GIF (the first frame), + * and BMP format are supported. The allowed image file size is from 1KB to 6MB. * "targetFace" rectangle should + * contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is + * not returned from [Face - Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl), there’s no + * guarantee to detect and add the face successfully. * Out of detectable face size (36x36 - 4096x4096 pixels), + * large head-pose, or large occlusions will cause failures. * Adding/deleting faces to/from a same person will be + * processed sequentially. Adding/deleting faces to/from different persons are processed in parallel. * The minimum + * detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher + * than 1920x1080 pixels will need a proportionally larger minimum face size. * Different 'detectionModel' values + * can be provided. To use and compare different detection models, please refer to [How to specify a detection + * model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model). + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
userDataStringNoUser-specified data about the face for any purpose. The maximum length is 1KB.
targetFaceStringNoA 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. In the form of "," separated string.
detectionModelStringNoName of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it.
+ * + *

Header Parameters + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-LengthlongYesThe contentLength parameter
+ * + *

Request Body Schema + * + *

{@code
+     * Flux
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     persistedFaceId: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return personFace object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addFaceFromStreamWithResponse( + String personGroupId, String personId, BinaryData image, RequestOptions requestOptions) { + return addFaceFromStreamWithResponseAsync(personGroupId, personId, image, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonGroupsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonGroupsImpl.java new file mode 100644 index 000000000000..5d2e6e42bb4a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/PersonGroupsImpl.java @@ -0,0 +1,846 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PersonGroups. */ +public final class PersonGroupsImpl { + /** The proxy service used to perform REST calls. */ + private final PersonGroupsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of PersonGroupsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PersonGroupsImpl(FaceClientImpl client) { + this.service = + RestProxy.create(PersonGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientPersonGroups to be used by the proxy service to perform + * REST calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientPersonGrou") + private interface PersonGroupsService { + @Put("/persongroups/{personGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/persongroups/{personGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + RequestOptions requestOptions, + Context context); + + @Get("/persongroups/{personGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + RequestOptions requestOptions, + Context context); + + @Patch("/persongroups/{personGroupId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/persongroups/{personGroupId}/training") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTrainingStatus( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + RequestOptions requestOptions, + Context context); + + @Get("/persongroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Post("/persongroups/{personGroupId}/train") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> train( + @HostParam("Endpoint") String endpoint, + @PathParam("personGroupId") String personGroupId, + RequestOptions requestOptions, + Context context); + } + + /** + * Create a new person group with specified personGroupId, name, user-provided userData and recognitionModel. <br + * /> A person group is the container of the uploaded person data, including face recognition features. <br + * /> After creation, use [PersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into the group, and + * then call [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group + * ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> No image + * will be stored. Only the person's extracted face features and userData will be stored on server until + * [PersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + * <br/>'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. + * + *

Person group quota: * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.create(this.client.getEndpoint(), personGroupId, body, requestOptions, context)); + } + + /** + * Create a new person group with specified personGroupId, name, user-provided userData and recognitionModel. <br + * /> A person group is the container of the uploaded person data, including face recognition features. <br + * /> After creation, use [PersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into the group, and + * then call [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group + * ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> No image + * will be stored. Only the person's extracted face features and userData will be stored on server until + * [PersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + * <br/>'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. + * + *

Person group quota: * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync( + String personGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.create(this.client.getEndpoint(), personGroupId, body, requestOptions, context); + } + + /** + * Create a new person group with specified personGroupId, name, user-provided userData and recognitionModel. <br + * /> A person group is the container of the uploaded person data, including face recognition features. <br + * /> After creation, use [PersonGroup Person - + * Create](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/create) to add persons into the group, and + * then call [PersonGroup - Train](https://docs.microsoft.com/rest/api/faceapi/persongroup/train) to get this group + * ready for [Face - Identify](https://docs.microsoft.com/rest/api/faceapi/face/identify). <br /> No image + * will be stored. Only the person's extracted face features and userData will be stored on server until + * [PersonGroup Person - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/delete) or + * [PersonGroup - Delete](https://docs.microsoft.com/rest/api/faceapi/persongroup/delete) is called. + * <br/>'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. + * + *

Person group quota: * 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](https://docs.microsoft.com/rest/api/faceapi/largepersongroup). + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for creating new person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String personGroupId, BinaryData body, RequestOptions requestOptions) { + return createWithResponseAsync(personGroupId, body, requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String personGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), personGroupId, requestOptions, context)); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String personGroupId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), personGroupId, requestOptions, context); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String personGroupId, RequestOptions requestOptions) { + return deleteWithResponseAsync(personGroupId, requestOptions).block(); + } + + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this personGroup, use + * [PersonGroup Person - List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person group object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String personGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), personGroupId, requestOptions, context)); + } + + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this personGroup, use + * [PersonGroup Person - List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person group object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String personGroupId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), personGroupId, requestOptions, context); + } + + /** + * Retrieve person group name, userData and recognitionModel. To get person information under this personGroup, use + * [PersonGroup Person - List](https://docs.microsoft.com/rest/api/faceapi/persongroupperson/list). + * + *

Query Parameters + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     personGroupId: String
+     *     name: String
+     *     userData: String
+     *     recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return person group object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String personGroupId, RequestOptions requestOptions) { + return getWithResponseAsync(personGroupId, requestOptions).block(); + } + + /** + * Update an existing person group's display name and userData. The properties which does not appear in request body + * will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for updating person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String personGroupId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.update(this.client.getEndpoint(), personGroupId, body, requestOptions, context)); + } + + /** + * Update an existing person group's display name and userData. The properties which does not appear in request body + * will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for updating person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String personGroupId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.update(this.client.getEndpoint(), personGroupId, body, requestOptions, context); + } + + /** + * Update an existing person group's display name and userData. The properties which does not appear in request body + * will not be updated. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     name: String
+     *     userData: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param body Request body for updating person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String personGroupId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(personGroupId, body, requestOptions).block(); + } + + /** + * Retrieve the training status of a person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponseAsync( + String personGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> + service.getTrainingStatus(this.client.getEndpoint(), personGroupId, requestOptions, context)); + } + + /** + * Retrieve the training status of a person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTrainingStatusWithResponseAsync( + String personGroupId, RequestOptions requestOptions, Context context) { + return service.getTrainingStatus(this.client.getEndpoint(), personGroupId, requestOptions, context); + } + + /** + * Retrieve the training status of a person group (completed or ongoing). + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(nonstarted/running/succeeded/failed)
+     *     created: String
+     *     lastAction: String
+     *     lastSuccessfulTraining: String
+     *     message: String
+     * }
+     * }
+ * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return training status object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTrainingStatusWithResponse(String personGroupId, RequestOptions requestOptions) { + return getTrainingStatusWithResponseAsync(personGroupId, requestOptions).block(); + } + + /** + * List person groups’ personGroupId, name, userData and recognitionModel.<br /> * 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. <br /> For example, total 5 person groups: "group1", ..., "group5". <br /> + * "start=&top=" will return all 5 groups. <br /> "start=&top=2" will return "group1", "group2". + * <br /> "start=group2&top=3" will return "group3", "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList person groups from the least personGroupId greater than the "start".
topStringNoThe number of person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of person groups along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * List person groups’ personGroupId, name, userData and recognitionModel.<br /> * 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. <br /> For example, total 5 person groups: "group1", ..., "group5". <br /> + * "start=&top=" will return all 5 groups. <br /> "start=&top=2" will return "group1", "group2". + * <br /> "start=group2&top=3" will return "group3", "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList person groups from the least personGroupId greater than the "start".
topStringNoThe number of person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of person groups along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), requestOptions, context); + } + + /** + * List person groups’ personGroupId, name, userData and recognitionModel.<br /> * 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. <br /> For example, total 5 person groups: "group1", ..., "group5". <br /> + * "start=&top=" will return all 5 groups. <br /> "start=&top=2" will return "group1", "group2". + * <br /> "start=group2&top=3" will return "group3", "group4", "group5". + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
startStringNoList person groups from the least personGroupId greater than the "start".
topStringNoThe number of person groups to list.
returnRecognitionModelStringNoA value indicating whether the operation should return 'recognitionModel' in response.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         personGroupId: String
+     *         name: String
+     *         userData: String
+     *         recognitionModel: String(recognition_01/recognition_02/recognition_03/recognition_04)
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of person groups along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return listWithResponseAsync(requestOptions).block(); + } + + /** + * Queue a person group training task, the training task may not be started immediately. + * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponseAsync(String personGroupId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.train(this.client.getEndpoint(), personGroupId, requestOptions, context)); + } + + /** + * Queue a person group training task, the training task may not be started immediately. + * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> trainWithResponseAsync( + String personGroupId, RequestOptions requestOptions, Context context) { + return service.train(this.client.getEndpoint(), personGroupId, requestOptions, context); + } + + /** + * Queue a person group training task, the training task may not be started immediately. + * + * @param personGroupId Id referencing a particular person group. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response trainWithResponse(String personGroupId, RequestOptions requestOptions) { + return trainWithResponseAsync(personGroupId, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/SnapshotsImpl.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/SnapshotsImpl.java new file mode 100644 index 000000000000..1a70d680b736 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/SnapshotsImpl.java @@ -0,0 +1,947 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in Snapshots. */ +public final class SnapshotsImpl { + /** The proxy service used to perform REST calls. */ + private final SnapshotsService service; + + /** The service client containing this operation class. */ + private final FaceClientImpl client; + + /** + * Initializes an instance of SnapshotsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SnapshotsImpl(FaceClientImpl client) { + this.service = + RestProxy.create(SnapshotsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FaceClientSnapshots to be used by the proxy service to perform REST + * calls. + */ + @Host("{Endpoint}/face/v1.0-preview") + @ServiceInterface(name = "FaceClientSnapshots") + private interface SnapshotsService { + @Post("/snapshots") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> take( + @HostParam("Endpoint") String endpoint, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/snapshots") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list( + @HostParam("Endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/snapshots/{snapshotId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get( + @HostParam("Endpoint") String endpoint, + @PathParam("snapshotId") String snapshotId, + RequestOptions requestOptions, + Context context); + + @Patch("/snapshots/{snapshotId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update( + @HostParam("Endpoint") String endpoint, + @PathParam("snapshotId") String snapshotId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Delete("/snapshots/{snapshotId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete( + @HostParam("Endpoint") String endpoint, + @PathParam("snapshotId") String snapshotId, + RequestOptions requestOptions, + Context context); + + @Post("/snapshots/{snapshotId}/apply") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> apply( + @HostParam("Endpoint") String endpoint, + @PathParam("snapshotId") String snapshotId, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/operations/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getOperationStatus( + @HostParam("Endpoint") String endpoint, + @PathParam("operationId") String operationId, + RequestOptions requestOptions, + Context context); + } + + /** + * 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.<br /> 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.<br /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 take operations per month. * S0-tier + * subscription quota: 100 take operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     objectId: String
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param body Request body for taking a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> takeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.take(this.client.getEndpoint(), body, requestOptions, context)); + } + + /** + * 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.<br /> 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.<br /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 take operations per month. * S0-tier + * subscription quota: 100 take operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     objectId: String
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param body Request body for taking a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> takeWithResponseAsync(BinaryData body, RequestOptions requestOptions, Context context) { + return service.take(this.client.getEndpoint(), body, requestOptions, context); + } + + /** + * 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.<br /> 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.<br /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 take operations per month. * S0-tier + * subscription quota: 100 take operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     objectId: String
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param body Request body for taking a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response takeWithResponse(BinaryData body, RequestOptions requestOptions) { + return takeWithResponseAsync(body, requestOptions).block(); + } + + /** + * 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). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoUser specified object type as a search filter.
applyScopeStringNoUser 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. In the form of "," separated string.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         id: String
+     *         account: String
+     *         type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *         applyScope: [
+     *             String
+     *         ]
+     *         userData: String
+     *         createdTime: String
+     *         lastUpdateTime: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of snapshots along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * 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). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoUser specified object type as a search filter.
applyScopeStringNoUser 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. In the form of "," separated string.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         id: String
+     *         account: String
+     *         type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *         applyScope: [
+     *             String
+     *         ]
+     *         userData: String
+     *         createdTime: String
+     *         lastUpdateTime: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of snapshots along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions, Context context) { + return service.list(this.client.getEndpoint(), requestOptions, context); + } + + /** + * 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). + * + *

Query Parameters + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoUser specified object type as a search filter.
applyScopeStringNoUser 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. In the form of "," separated string.
+ * + *

Response Body Schema + * + *

{@code
+     * [
+     *     {
+     *         id: String
+     *         account: String
+     *         type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *         applyScope: [
+     *             String
+     *         ]
+     *         userData: String
+     *         createdTime: String
+     *         lastUpdateTime: String
+     *     }
+     * ]
+     * }
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an array of snapshots along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return listWithResponseAsync(requestOptions).block(); + } + + /** + * 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. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     id: String
+     *     account: String
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     *     createdTime: String
+     *     lastUpdateTime: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return snapshot object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String snapshotId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.get(this.client.getEndpoint(), snapshotId, requestOptions, context)); + } + + /** + * 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. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     id: String
+     *     account: String
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     *     createdTime: String
+     *     lastUpdateTime: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return snapshot object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String snapshotId, RequestOptions requestOptions, Context context) { + return service.get(this.client.getEndpoint(), snapshotId, requestOptions, context); + } + + /** + * 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. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     id: String
+     *     account: String
+     *     type: String(FaceList/LargeFaceList/LargePersonGroup/PersonGroup)
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     *     createdTime: String
+     *     lastUpdateTime: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return snapshot object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String snapshotId, RequestOptions requestOptions) { + return getWithResponseAsync(snapshotId, requestOptions).block(); + } + + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update the snapshot. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for updating a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String snapshotId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.update(this.client.getEndpoint(), snapshotId, body, requestOptions, context)); + } + + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update the snapshot. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for updating a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync( + String snapshotId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.update(this.client.getEndpoint(), snapshotId, body, requestOptions, context); + } + + /** + * Update the information of a snapshot. Only the source subscription who took the snapshot can update the snapshot. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     applyScope: [
+     *         String
+     *     ]
+     *     userData: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for updating a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String snapshotId, BinaryData body, RequestOptions requestOptions) { + return updateWithResponseAsync(snapshotId, body, requestOptions).block(); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String snapshotId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), snapshotId, requestOptions, context)); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync( + String snapshotId, RequestOptions requestOptions, Context context) { + return service.delete(this.client.getEndpoint(), snapshotId, requestOptions, context); + } + + /** + * 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 requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String snapshotId, RequestOptions requestOptions) { + return deleteWithResponseAsync(snapshotId, requestOptions).block(); + } + + /** + * 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.<br /> 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.<br + * /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 + * apply operations per month. * S0-tier subscription quota: 100 apply operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     objectId: String
+     *     mode: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for applying a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> applyWithResponseAsync( + String snapshotId, BinaryData body, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.apply(this.client.getEndpoint(), snapshotId, body, requestOptions, context)); + } + + /** + * 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.<br /> 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.<br + * /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 + * apply operations per month. * S0-tier subscription quota: 100 apply operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     objectId: String
+     *     mode: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for applying a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> applyWithResponseAsync( + String snapshotId, BinaryData body, RequestOptions requestOptions, Context context) { + return service.apply(this.client.getEndpoint(), snapshotId, body, requestOptions, context); + } + + /** + * 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.<br /> 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.<br + * /> 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".<br /> 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.<br /> 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.<br /> 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.<br /> 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.<br /> * Free-tier subscription quota: 100 + * apply operations per month. * S0-tier subscription quota: 100 apply operations per day. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     objectId: String
+     *     mode: String
+     * }
+     * }
+ * + * @param snapshotId Id referencing a particular snapshot. + * @param body Request body for applying a snapshot. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response applyWithResponse(String snapshotId, BinaryData body, RequestOptions requestOptions) { + return applyWithResponseAsync(snapshotId, body, requestOptions).block(); + } + + /** + * Get status of a long running operation. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(notStarted/running/succeeded/failed)
+     *     createdTime: String
+     *     lastActionTime: String
+     *     finishedTime: String
+     *     resourceLocation: String
+     *     message: String
+     * }
+     * }
+ * + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return status of a long running operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponseAsync( + String operationId, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.getOperationStatus(this.client.getEndpoint(), operationId, requestOptions, context)); + } + + /** + * Get status of a long running operation. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(notStarted/running/succeeded/failed)
+     *     createdTime: String
+     *     lastActionTime: String
+     *     finishedTime: String
+     *     resourceLocation: String
+     *     message: String
+     * }
+     * }
+ * + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @param context The context to associate with this operation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return status of a long running operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponseAsync( + String operationId, RequestOptions requestOptions, Context context) { + return service.getOperationStatus(this.client.getEndpoint(), operationId, requestOptions, context); + } + + /** + * Get status of a long running operation. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     status: String(notStarted/running/succeeded/failed)
+     *     createdTime: String
+     *     lastActionTime: String
+     *     finishedTime: String
+     *     resourceLocation: String
+     *     message: String
+     * }
+     * }
+ * + * @param operationId Id referencing a particular take/apply snapshot operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return status of a long running operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String operationId, RequestOptions requestOptions) { + return getOperationStatusWithResponseAsync(operationId, requestOptions).block(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/package-info.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/package-info.java new file mode 100644 index 000000000000..6c8c96388f6d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for FaceClient. An API for face detection, verification, and identification. + */ +package com.azure.cognitiveservices.face.implementation; diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/package-info.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/package-info.java new file mode 100644 index 000000000000..1838b43a6a5a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/com/azure/cognitiveservices/face/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for FaceClient. An API for face detection, verification, and identification. */ +package com.azure.cognitiveservices.face; diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/module-info.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/module-info.java new file mode 100644 index 000000000000..4c75a1ba590b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/java/module-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.cognitiveservices.face { + requires transitive com.azure.core; + + exports com.azure.cognitiveservices.face; +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/resources/azure-cognitiveservices-face.properties b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/resources/azure-cognitiveservices-face.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/main/resources/azure-cognitiveservices-face.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/ReadmeSamples.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/ReadmeSamples.java new file mode 100644 index 000000000000..122da82b617c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.cognitiveservices.face.readme + // END: com.azure.cognitiveservices.face.readme + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToFaceListFromStreamExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToFaceListFromStreamExample.java new file mode 100644 index 000000000000..3327f6b611bc --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToFaceListFromStreamExample.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class AddFaceToFaceListFromStreamExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.facelistaddfacefromstream.addfacetofacelistfromstreamexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + faceListClient.addFaceFromStreamWithResponse("sample_face_list", Image, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistaddfacefromstream.addfacetofacelistfromstreamexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToLargeFaceListFromStreamExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToLargeFaceListFromStreamExample.java new file mode 100644 index 000000000000..58b8000d429f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToLargeFaceListFromStreamExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class AddFaceToLargeFaceListFromStreamExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.largefacelistaddfacefromstream.addfacetolargefacelistfromstreamexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + largeFaceListClient.addFaceFromStreamWithResponse("sample_face_list", Image, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.largefacelistaddfacefromstream.addfacetolargefacelistfromstreamexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonDirectoryPersonWithStreamExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonDirectoryPersonWithStreamExample.java new file mode 100644 index 000000000000..5086d3c9f7d2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonDirectoryPersonWithStreamExample.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class AddFaceToPersonDirectoryPersonWithStreamExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectoryaddpersonfacefromstream.addfacetopersondirectorypersonwithstreamexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "[10, 10, 100, 100]"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personDirectoryClient.addPersonFaceFromStreamWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", "recognition_02", Image, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectoryaddpersonfacefromstream.addfacetopersondirectorypersonwithstreamexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonInPersonDirectoryExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonInPersonDirectoryExample.java new file mode 100644 index 000000000000..dbf2c0c6c2c6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonInPersonDirectoryExample.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class AddFaceToPersonInPersonDirectoryExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectoryaddpersonface.addfacetopersoninpersondirectoryexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "[10, 10, 100, 100]"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personDirectoryClient.addPersonFaceWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", "recognition_02", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectoryaddpersonface.addfacetopersoninpersondirectoryexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonWithStreamExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonWithStreamExample.java new file mode 100644 index 000000000000..574bc798f566 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonWithStreamExample.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class AddFaceToPersonWithStreamExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persongrouppersonaddfacefromstream.addfacetopersonwithstreamexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personGroupPersonClient.addFaceFromStreamWithResponse( + "abc", "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", Image, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persongrouppersonaddfacefromstream.addfacetopersonwithstreamexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddPersonFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddPersonFaceExample.java new file mode 100644 index 000000000000..1b817c834837 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/AddPersonFaceExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class AddPersonFaceExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersonaddfacefromurl.addpersonfaceexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personGroupPersonClient.addFaceFromUrlWithResponse( + "abc", "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", ImageUrl, requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersonaddfacefromurl.addpersonfaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ApplySnapshotExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ApplySnapshotExample.java new file mode 100644 index 000000000000..d980842080d2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ApplySnapshotExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ApplySnapshotExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.snapshotapply.applysnapshotexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = BinaryData.fromString("{\"mode\":\"CreateNew\",\"objectId\":\"target-face-list-id\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.applyWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshotapply.applysnapshotexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateDynamicPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateDynamicPersonGroupExample.java new file mode 100644 index 000000000000..4d27d1537a9d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateDynamicPersonGroupExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateDynamicPersonGroupExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorycreatedynamicpersongroup.createdynamicpersongroupexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"userData\":\"user-provided data attached to the person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.createDynamicPersonGroupWithResponse("abc", body, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorycreatedynamicpersongroup.createdynamicpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateFaceListFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateFaceListFaceExample.java new file mode 100644 index 000000000000..7952504a702e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateFaceListFaceExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateFaceListFaceExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistaddfacefromurl.createfacelistfaceexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + faceListClient.addFaceFromUrlWithResponse("sample_face_list", ImageUrl, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistaddfacefromurl.createfacelistfaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateLargeFaceListFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateLargeFaceListFaceExample.java new file mode 100644 index 000000000000..572b941a5118 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateLargeFaceListFaceExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateLargeFaceListFaceExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistaddfacefromurl.createlargefacelistfaceexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + largeFaceListClient.addFaceFromUrlWithResponse("sample_face_list", ImageUrl, requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistaddfacefromurl.createlargefacelistfaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewFaceListExample.java new file mode 100644 index 000000000000..7286d9c426b1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewFaceListExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateNewFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistcreate.createnewfacelistexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"sample_list\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceListClient.createWithResponse("sample_face_list", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistcreate.createnewfacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewLargeFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewLargeFaceListExample.java new file mode 100644 index 000000000000..8839c70f636d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewLargeFaceListExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateNewLargeFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistcreate.createnewlargefacelistexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"large-face-list-name\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.createWithResponse("sample_face_list", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistcreate.createnewlargefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewLargePersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewLargePersonGroupExample.java new file mode 100644 index 000000000000..cd81977ddda0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewLargePersonGroupExample.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateNewLargePersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largepersongroupcreate.createnewlargepersongroupexample + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"large-person-group-name\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.createWithResponse("abc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.largepersongroupcreate.createnewlargepersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForLargePersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForLargePersonGroupExample.java new file mode 100644 index 000000000000..963b19c0a4d6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForLargePersonGroupExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupPersonClient; +import com.azure.cognitiveservices.face.LargePersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateNewPersonForLargePersonGroupExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.largepersongrouppersoncreate.createnewpersonforlargepersongroupexample + LargePersonGroupPersonClient largePersonGroupPersonClient = + new LargePersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupPersonClient.createWithResponse("abc", body, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.largepersongrouppersoncreate.createnewpersonforlargepersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForPersonGroupExample.java new file mode 100644 index 000000000000..883d0bc4eda5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForPersonGroupExample.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateNewPersonForPersonGroupExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persongrouppersoncreate.createnewpersonforpersongroupexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupPersonClient.createWithResponse("abc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersoncreate.createnewpersonforpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonGroupExample.java new file mode 100644 index 000000000000..56da5a1a28e0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreateNewPersonGroupExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreateNewPersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongroupcreate.createnewpersongroupexample + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"recognitionModel\":\"recognition_01\",\"userData\":\"user-provided data attached to the person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.createWithResponse("abc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongroupcreate.createnewpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreatePersonInPersonDirectoryExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreatePersonInPersonDirectoryExample.java new file mode 100644 index 000000000000..b537ad34373c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/CreatePersonInPersonDirectoryExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class CreatePersonInPersonDirectoryExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorycreateperson.createpersoninpersondirectoryexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.createPersonWithResponse(body, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorycreateperson.createpersoninpersondirectoryexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteALargePersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteALargePersonGroupExample.java new file mode 100644 index 000000000000..ee7321fa5dc3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteALargePersonGroupExample.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteALargePersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largepersongroupdelete.deletealargepersongroupexample + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.deleteWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largepersongroupdelete.deletealargepersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteAPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteAPersonGroupExample.java new file mode 100644 index 000000000000..05f2b13bf227 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteAPersonGroupExample.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteAPersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongroupdelete.deleteapersongroupexample + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.deleteWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongroupdelete.deleteapersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteAnExistingPersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteAnExistingPersonExample.java new file mode 100644 index 000000000000..1a11ba29ff3a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteAnExistingPersonExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteAnExistingPersonExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersondelete.deleteanexistingpersonexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.deleteWithResponse( + "abc", "25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersondelete.deleteanexistingpersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteDynamicPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteDynamicPersonGroupExample.java new file mode 100644 index 000000000000..8940f0f134dc --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteDynamicPersonGroupExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteDynamicPersonGroupExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorydeletedynamicpersongroup.deletedynamicpersongroupexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.deleteDynamicPersonGroupWithResponse("abc", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorydeletedynamicpersongroup.deletedynamicpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonDirectoryPersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonDirectoryPersonExample.java new file mode 100644 index 000000000000..14d218b6ff88 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonDirectoryPersonExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteFaceFromPersonDirectoryPersonExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorydeletepersonface.deletefacefrompersondirectorypersonexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.deletePersonFaceWithResponse( + "25985303-c537-4467-b41d-bdb45cd95ca1", + "recognition_02", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorydeletepersonface.deletefacefrompersondirectorypersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonExample.java new file mode 100644 index 000000000000..8823bfab4a21 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteFaceFromPersonExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersondeleteface.deletefacefrompersonexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.deleteFaceWithResponse( + "abc", + "25985303-c537-4467-b41d-bdb45cd95ca1", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersondeleteface.deletefacefrompersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceInFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceInFaceListExample.java new file mode 100644 index 000000000000..4a38a1304c96 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceInFaceListExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteFaceInFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistdeleteface.deletefaceinfacelistexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + faceListClient.deleteFaceWithResponse( + "sample_face_list", "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistdeleteface.deletefaceinfacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceInLargeFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceInLargeFaceListExample.java new file mode 100644 index 000000000000..938d7a8a0ffd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceInLargeFaceListExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteFaceInLargeFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistdeleteface.deletefaceinlargefacelistexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + largeFaceListClient.deleteFaceWithResponse( + "sample_face_list", "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistdeleteface.deletefaceinlargefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceListExample.java new file mode 100644 index 000000000000..99553ba810ed --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteFaceListExample.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistdelete.deletefacelistexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceListClient.deleteWithResponse("sample_face_list", requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistdelete.deletefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteLargeFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteLargeFaceListExample.java new file mode 100644 index 000000000000..1c016353744f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteLargeFaceListExample.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteLargeFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistdelete.deletelargefacelistexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.deleteWithResponse("sample_face_list", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistdelete.deletelargefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeletePersonFromPersonDirectoryExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeletePersonFromPersonDirectoryExample.java new file mode 100644 index 000000000000..ba61907dd8ce --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeletePersonFromPersonDirectoryExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeletePersonFromPersonDirectoryExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorydeleteperson.deletepersonfrompersondirectoryexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.deletePersonWithResponse("25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorydeleteperson.deletepersonfrompersondirectoryexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteSnapshotExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteSnapshotExample.java new file mode 100644 index 000000000000..733e27c49810 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DeleteSnapshotExample.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class DeleteSnapshotExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.snapshotdelete.deletesnapshotexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.deleteWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshotdelete.deletesnapshotexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DetectWithStreamExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DetectWithStreamExample.java new file mode 100644 index 000000000000..941360aa1408 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DetectWithStreamExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class DetectWithStreamExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facedetectwithstream.detectwithstreamexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData Image = BinaryData.fromString("\"{Image binary in base 64 format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("recognitionModel", "recognition_01"); + requestOptions.addQueryParam( + "returnFaceAttributes", + "age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise"); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceClient.detectWithStreamWithResponse(Image, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facedetectwithstream.detectwithstreamexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DetectWithUrlExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DetectWithUrlExample.java new file mode 100644 index 000000000000..0088f9f4e599 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/DetectWithUrlExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class DetectWithUrlExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facedetectwithurl.detectwithurlexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("recognitionModel", "recognition_01"); + requestOptions.addQueryParam( + "returnFaceAttributes", + "age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise"); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceClient.detectWithUrlWithResponse(ImageUrl, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facedetectwithurl.detectwithurlexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/FindSimilarResultsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/FindSimilarResultsExample.java new file mode 100644 index 000000000000..3ed8e696a108 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/FindSimilarResultsExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class FindSimilarResultsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facefindsimilar.findsimilarresultsexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"faceId\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"largeFaceListId\":\"sample_list\",\"maxNumOfCandidatesReturned\":1,\"mode\":\"matchPerson\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.findSimilarWithResponse(body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facefindsimilar.findsimilarresultsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetDynamicPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetDynamicPersonGroupExample.java new file mode 100644 index 000000000000..ed9c127eb9c3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetDynamicPersonGroupExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetDynamicPersonGroupExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorygetdynamicpersongroup.getdynamicpersongroupexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.getDynamicPersonGroupWithResponse("abc", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorygetdynamicpersongroup.getdynamicpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetFaceListExample.java new file mode 100644 index 000000000000..d6843d6c6602 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetFaceListExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistget.getfacelistexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceListClient.getWithResponse("sample_face_list", requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistget.getfacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListExample.java new file mode 100644 index 000000000000..2254f4fa7dce --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetLargeFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistget.getlargefacelistexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = + largeFaceListClient.getWithResponse("f92f6f1b-3258-4444-8fa2-c2df505cc7ac", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistget.getlargefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListSTrainingStatusExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListSTrainingStatusExample.java new file mode 100644 index 000000000000..63a1cdaa8730 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListSTrainingStatusExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetLargeFaceListSTrainingStatusExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.largefacelistgettrainingstatus.getlargefaceliststrainingstatusexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.getTrainingStatusWithResponse("abc", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.largefacelistgettrainingstatus.getlargefaceliststrainingstatusexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupExample.java new file mode 100644 index 000000000000..0b6c5389f6ba --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetLargePersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largepersongroupget.getlargepersongroupexample + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = largePersonGroupClient.getWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largepersongroupget.getlargepersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupSTrainingStatusExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupSTrainingStatusExample.java new file mode 100644 index 000000000000..c55600517aaf --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupSTrainingStatusExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetLargePersonGroupSTrainingStatusExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.largepersongroupgettrainingstatus.getlargepersongroupstrainingstatusexample + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.getTrainingStatusWithResponse("abc", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.largepersongroupgettrainingstatus.getlargepersongroupstrainingstatusexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersistedFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersistedFaceExample.java new file mode 100644 index 000000000000..fdfa9dc54d21 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersistedFaceExample.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersistedFaceExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersongetface.getpersistedfaceexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.getFaceWithResponse( + "abc", + "B8D802CF-DD8F-4E61-B15C-9E6C5844CCBA", + "015839fb-fbd9-4f79-ace9-7675fc2f1dd9", + requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersongetface.getpersistedfaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonFaceExample.java new file mode 100644 index 000000000000..cf6d4ecdc04e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonFaceExample.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonDirectoryPersonFaceExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorygetpersonface.getpersondirectorypersonfaceexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.getPersonFaceWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", + "recognition_02", + "6e04c175-219e-42a2-9d26-0e7b790e1ef4", + requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorygetpersonface.getpersondirectorypersonfaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonsExample.java new file mode 100644 index 000000000000..80497631678b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonsExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonDirectoryPersonsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persondirectorygetpersons.getpersondirectorypersonsexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.getPersonsWithResponse(requestOptions); + // END: com.azure.cognitiveservices.face.generated.persondirectorygetpersons.getpersondirectorypersonsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonExample.java new file mode 100644 index 000000000000..51eed6614f90 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersonget.getpersonexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.getWithResponse("abc", "25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersonget.getpersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonFaceInPersonDirectoryExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonFaceInPersonDirectoryExample.java new file mode 100644 index 000000000000..fb9619c1548d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonFaceInPersonDirectoryExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonFaceInPersonDirectoryExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorygetpersonfaces.getpersonfaceinpersondirectoryexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.getPersonFacesWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", "recognition_02", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorygetpersonfaces.getpersonfaceinpersondirectoryexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonFromPersonDirectoryExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonFromPersonDirectoryExample.java new file mode 100644 index 000000000000..4b8e02491604 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonFromPersonDirectoryExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonFromPersonDirectoryExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorygetperson.getpersonfrompersondirectoryexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.getPersonWithResponse("25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persondirectorygetperson.getpersonfrompersondirectoryexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonGroupExample.java new file mode 100644 index 000000000000..43bc48493c62 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonGroupExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongroupget.getpersongroupexample + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = personGroupClient.getWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongroupget.getpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonGroupSTrainingStatusExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonGroupSTrainingStatusExample.java new file mode 100644 index 000000000000..ed8e2f0f5164 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetPersonGroupSTrainingStatusExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetPersonGroupSTrainingStatusExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persongroupgettrainingstatus.getpersongroupstrainingstatusexample + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.getTrainingStatusWithResponse("abc", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persongroupgettrainingstatus.getpersongroupstrainingstatusexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetSnapshotExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetSnapshotExample.java new file mode 100644 index 000000000000..7933f29797e0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetSnapshotExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetSnapshotExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.snapshotget.getsnapshotexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.getWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshotget.getsnapshotexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetSnapshotOperationStatusExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetSnapshotOperationStatusExample.java new file mode 100644 index 000000000000..ceec441e8a3f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GetSnapshotOperationStatusExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GetSnapshotOperationStatusExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.snapshotgetoperationstatus.getsnapshotoperationstatusexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.getOperationStatusWithResponse("a63a3bdd-a1db-4d05-87b8-dbad6850062a", requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshotgetoperationstatus.getsnapshotoperationstatusexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GroupExample.java new file mode 100644 index 000000000000..da1c12c525e4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/GroupExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class GroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facegroup.groupexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"faceIds\":[\"c5c24a82-6845-4031-9d5d-978df9175426\",\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"65d083d4-9447-47d1-af30-b626144bf0fb\",\"fce92aed-d578-4d2e-8114-068f8af4492e\",\"30ea1073-cc9e-4652-b1e3-d08fb7b95315\",\"be386ab3-af91-4104-9e6d-4dae4c9fddb7\",\"fbd2a038-dbff-452c-8e79-2ee81b1aa84e\",\"b64d5e15-8257-4af2-b20a-5a750f8940e7\"]}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.groupWithResponse(body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facegroup.groupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/IdentifyExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/IdentifyExample.java new file mode 100644 index 000000000000..ee09068747dd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/IdentifyExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class IdentifyExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.faceidentify.identifyexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"confidenceThreshold\":0.5,\"faceIds\":[\"c5c24a82-6845-4031-9d5d-978df9175426\",\"65d083d4-9447-47d1-af30-b626144bf0fb\"],\"largePersonGroupId\":\"sample_group\",\"maxNumOfCandidatesReturned\":1}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.identifyWithResponse(body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.faceidentify.identifyexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupPersonsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupPersonsExample.java new file mode 100644 index 000000000000..088523905902 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupPersonsExample.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListDynamicPersonGroupPersonsExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorylistdynamicpersongrouppersons.listdynamicpersongrouppersonsexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "25985303-c537-4467-b41d-bdb45cd95ca1"); + requestOptions.addQueryParam("top", "2"); + Response response = + personDirectoryClient.listDynamicPersonGroupPersonsWithResponse("abc", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorylistdynamicpersongrouppersons.listdynamicpersongrouppersonsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupReferencesExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupReferencesExample.java new file mode 100644 index 000000000000..931863d7acb0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupReferencesExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListDynamicPersonGroupReferencesExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorylistdynamicpersongrouppersonreferences.listdynamicpersongroupreferencesexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.listDynamicPersonGroupPersonReferencesWithResponse( + "1d44651f-fadb-41f5-8918-c30609964489", requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorylistdynamicpersongrouppersonreferences.listdynamicpersongroupreferencesexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupsExample.java new file mode 100644 index 000000000000..238eee54d6dd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupsExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListDynamicPersonGroupsExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectorylistdynamicpersongroups.listdynamicpersongroupsexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "sample_group"); + requestOptions.addQueryParam("top", "2"); + Response response = personDirectoryClient.listDynamicPersonGroupsWithResponse(requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectorylistdynamicpersongroups.listdynamicpersongroupsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListFaceListsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListFaceListsExample.java new file mode 100644 index 000000000000..5acd2374269f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListFaceListsExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListFaceListsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistlist.listfacelistsexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceListClient.listWithResponse(requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistlist.listfacelistsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListFacesInLargeFaceList.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListFacesInLargeFaceList.java new file mode 100644 index 000000000000..ca3798a4b0d5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListFacesInLargeFaceList.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListFacesInLargeFaceList { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistlistfaces.listfacesinlargefacelist + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "25985303-c537-4467-b41d-bdb45cd95ca1"); + requestOptions.addQueryParam("top", "2"); + Response response = largeFaceListClient.listFacesWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistlistfaces.listfacesinlargefacelist + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListLargeFaceListsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListLargeFaceListsExample.java new file mode 100644 index 000000000000..5ec85026e7cd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListLargeFaceListsExample.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListLargeFaceListsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistlist.listlargefacelistsexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = largeFaceListClient.listWithResponse(requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistlist.listlargefacelistsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListLargePersonGroupsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListLargePersonGroupsExample.java new file mode 100644 index 000000000000..acd22979e56e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListLargePersonGroupsExample.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListLargePersonGroupsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largepersongrouplist.listlargepersongroupsexample + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + requestOptions.addQueryParam("start", "sample_group"); + requestOptions.addQueryParam("top", "2"); + Response response = largePersonGroupClient.listWithResponse(requestOptions); + // END: com.azure.cognitiveservices.face.generated.largepersongrouplist.listlargepersongroupsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListPersonGroupsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListPersonGroupsExample.java new file mode 100644 index 000000000000..1f426e1127ed --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListPersonGroupsExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListPersonGroupsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouplist.listpersongroupsexample + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + requestOptions.addQueryParam("start", "sample_group"); + requestOptions.addQueryParam("top", "2"); + Response response = personGroupClient.listWithResponse(requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouplist.listpersongroupsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListPersonsInPersonGroup.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListPersonsInPersonGroup.java new file mode 100644 index 000000000000..841f546caaa9 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListPersonsInPersonGroup.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListPersonsInPersonGroup { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersonlist.listpersonsinpersongroup + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "25985303-c537-4467-b41d-bdb45cd95ca1"); + requestOptions.addQueryParam("top", "2"); + Response response = personGroupPersonClient.listWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersonlist.listpersonsinpersongroup + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListSnapshotsExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListSnapshotsExample.java new file mode 100644 index 000000000000..ba62576209d6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/ListSnapshotsExample.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class ListSnapshotsExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.snapshotlist.listsnapshotsexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("type", "FaceList"); + requestOptions.addQueryParam("applyScope", "64084E07-9B7F-4A98-BEA4-9986D3A1EDEB"); + Response response = snapshotClient.listWithResponse(requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshotlist.listsnapshotsexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueueLargeFaceListTraining.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueueLargeFaceListTraining.java new file mode 100644 index 000000000000..f1ab4e3fdc85 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueueLargeFaceListTraining.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class QueueLargeFaceListTraining { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelisttrain.queuelargefacelisttraining + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.trainWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelisttrain.queuelargefacelisttraining + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueueLargePersonGroupTraining.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueueLargePersonGroupTraining.java new file mode 100644 index 000000000000..995ada407dd1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueueLargePersonGroupTraining.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class QueueLargePersonGroupTraining { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largepersongrouptrain.queuelargepersongrouptraining + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.trainWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.largepersongrouptrain.queuelargepersongrouptraining + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueuePersonGroupTraining.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueuePersonGroupTraining.java new file mode 100644 index 000000000000..4304748d218e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/QueuePersonGroupTraining.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +public class QueuePersonGroupTraining { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouptrain.queuepersongrouptraining + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.trainWithResponse("abc", requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouptrain.queuepersongrouptraining + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/TakeASnapshotExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/TakeASnapshotExample.java new file mode 100644 index 000000000000..bdf7c577b7c3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/TakeASnapshotExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class TakeASnapshotExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.snapshottake.takeasnapshotexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"type\":\"FaceList\",\"applyScope\":[\"35230F59-AA9C-45E0-AB5E-C859BF1A5429\",\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"objectId\":\"source-face-list-id\",\"userData\":\"User-provided data attached to the snapshot.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = snapshotClient.takeWithResponse(body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshottake.takeasnapshotexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateDynamicPersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateDynamicPersonGroupExample.java new file mode 100644 index 000000000000..b3a4af94128b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateDynamicPersonGroupExample.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateDynamicPersonGroupExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectoryupdatedynamicpersongroup.updatedynamicpersongroupexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"Display Name of Dynamic Person Group\",\"addPersonIds\":[\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"4caa25ee-3bc6-4e88-adf8-12455ce7aab0\"],\"removePersonIds\":[\"2ae4935b-9659-44c3-977f-61fac20d0538\"],\"userData\":\"User-provided data attached to the dynamic person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.updateDynamicPersonGroupWithResponse("abc", body, requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectoryupdatedynamicpersongroup.updatedynamicpersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceExample.java new file mode 100644 index 000000000000..dd6704102a0f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateFaceExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistupdateface.updatefaceexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = BinaryData.fromString("{\"userData\":\"User-provided data attached to the face.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + largeFaceListClient.updateFaceWithResponse( + "abc", "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistupdateface.updatefaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceFromPersonDirectoryPersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceFromPersonDirectoryPersonExample.java new file mode 100644 index 000000000000..73a64115052c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceFromPersonDirectoryPersonExample.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateFaceFromPersonDirectoryPersonExample { + public static void main(String[] args) { + // BEGIN: + // com.azure.cognitiveservices.face.generated.persondirectoryupdatepersonface.updatefacefrompersondirectorypersonexample + PersonDirectoryClient personDirectoryClient = + new PersonDirectoryClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = BinaryData.fromString("{\"userData\":\"User-provided data attached to the face.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.updatePersonFaceWithResponse( + "25985303-c537-4467-b41d-bdb45cd95ca1", + "recognition_02", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + body, + requestOptions); + // END: + // com.azure.cognitiveservices.face.generated.persondirectoryupdatepersonface.updatefacefrompersondirectorypersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceListExample.java new file mode 100644 index 000000000000..e4272bea5be5 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateFaceListExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.facelistupdate.updatefacelistexample + FaceListClient faceListClient = new FaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"list1\",\"userData\":\"User-provided data attached to the face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceListClient.updateWithResponse("sample_face_list", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.facelistupdate.updatefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateLargeFaceListExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateLargeFaceListExample.java new file mode 100644 index 000000000000..c4fdaf1c6ea4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateLargeFaceListExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateLargeFaceListExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largefacelistupdate.updatelargefacelistexample + LargeFaceListClient largeFaceListClient = new LargeFaceListClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"large-face-list-name\",\"userData\":\"User-provided data attached to the large face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.updateWithResponse("sample_face_list", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.largefacelistupdate.updatelargefacelistexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateLargePersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateLargePersonGroupExample.java new file mode 100644 index 000000000000..a48a900bff07 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateLargePersonGroupExample.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateLargePersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.largepersongroupupdate.updatelargepersongroupexample + LargePersonGroupClient largePersonGroupClient = + new LargePersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"userData\":\"user-provided data attached to the large person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.updateWithResponse("abc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.largepersongroupupdate.updatelargepersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonExample.java new file mode 100644 index 000000000000..502533509958 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonExample.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdatePersonExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersonupdate.updatepersonexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.updateWithResponse( + "abc", "25985303-c537-4467-b41d-bdb45cd95ca1", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersonupdate.updatepersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonFaceExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonFaceExample.java new file mode 100644 index 000000000000..1c885a09e741 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonFaceExample.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdatePersonFaceExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongrouppersonupdateface.updatepersonfaceexample + PersonGroupPersonClient personGroupPersonClient = + new PersonGroupPersonClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = BinaryData.fromString("{\"userData\":\"User-provided data attached to the face.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.updateFaceWithResponse( + "abc", + "25985303-c537-4467-b41d-bdb45cd95ca1", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + body, + requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongrouppersonupdateface.updatepersonfaceexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonGroupExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonGroupExample.java new file mode 100644 index 000000000000..11dd8d77072b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdatePersonGroupExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdatePersonGroupExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.persongroupupdate.updatepersongroupexample + PersonGroupClient personGroupClient = new PersonGroupClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"userData\":\"user-provided data attached to the person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.updateWithResponse("abc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.persongroupupdate.updatepersongroupexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateSnapshotExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateSnapshotExample.java new file mode 100644 index 000000000000..f9d285a04a16 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/UpdateSnapshotExample.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class UpdateSnapshotExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.snapshotupdate.updatesnapshotexample + SnapshotClient snapshotClient = new SnapshotClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"applyScope\":[\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"userData\":\"User-provided data attached to the snapshot.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.updateWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.snapshotupdate.updatesnapshotexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/VerifyFaceToPersonExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/VerifyFaceToPersonExample.java new file mode 100644 index 000000000000..740ad11eaad8 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/VerifyFaceToPersonExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class VerifyFaceToPersonExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.faceverifyfacetoperson.verifyfacetopersonexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"faceId\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"largePersonGroupId\":\"sample_group\",\"personId\":\"815df99c-598f-4926-930a-a734b3fd651c\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.verifyFaceToPersonWithResponse(body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.faceverifyfacetoperson.verifyfacetopersonexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/VerifyFacesExample.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/VerifyFacesExample.java new file mode 100644 index 000000000000..a8d0ae3fc0cb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/samples/java/com/azure/cognitiveservices/face/generated/VerifyFacesExample.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +public class VerifyFacesExample { + public static void main(String[] args) { + // BEGIN: com.azure.cognitiveservices.face.generated.faceverifyfacetoface.verifyfacesexample + FaceClient faceClient = new FaceClientBuilder().endpoint("{Endpoint}").buildClient(); + BinaryData body = + BinaryData.fromString( + "{\"faceId1\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"faceId2\":\"815df99c-598f-4926-930a-a734b3fd651c\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.verifyFaceToFaceWithResponse(body, requestOptions); + // END: com.azure.cognitiveservices.face.generated.faceverifyfacetoface.verifyfacesexample + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToFaceListFromStreamExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToFaceListFromStreamExampleTests.java new file mode 100644 index 000000000000..6c5f291547aa --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToFaceListFromStreamExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class AddFaceToFaceListFromStreamExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testAddFaceToFaceListFromStreamExampleTests() { + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + faceListClient.addFaceFromStreamWithResponse("sample_face_list", Image, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToLargeFaceListFromStreamExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToLargeFaceListFromStreamExampleTests.java new file mode 100644 index 000000000000..932af9e19e2b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToLargeFaceListFromStreamExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class AddFaceToLargeFaceListFromStreamExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testAddFaceToLargeFaceListFromStreamExampleTests() { + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + largeFaceListClient.addFaceFromStreamWithResponse("sample_face_list", Image, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonDirectoryPersonWithStreamExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonDirectoryPersonWithStreamExampleTests.java new file mode 100644 index 000000000000..ccb8a842c346 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonDirectoryPersonWithStreamExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class AddFaceToPersonDirectoryPersonWithStreamExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testAddFaceToPersonDirectoryPersonWithStreamExampleTests() { + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "[10, 10, 100, 100]"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personDirectoryClient.addPersonFaceFromStreamWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", "recognition_02", Image, requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonInPersonDirectoryExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonInPersonDirectoryExampleTests.java new file mode 100644 index 000000000000..ec45bd2efa70 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonInPersonDirectoryExampleTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class AddFaceToPersonInPersonDirectoryExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testAddFaceToPersonInPersonDirectoryExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "[10, 10, 100, 100]"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personDirectoryClient.addPersonFaceWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", "recognition_02", requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"persistedFaceId\":\"6e04c175-219e-42a2-9d26-0e7b790e1ef4\",\"recognitionModel\":null,\"userData\":null}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonWithStreamExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonWithStreamExampleTests.java new file mode 100644 index 000000000000..df9be265a968 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddFaceToPersonWithStreamExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class AddFaceToPersonWithStreamExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testAddFaceToPersonWithStreamExampleTests() { + BinaryData Image = BinaryData.fromString("\"{Image stream in base 64 encoded format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personGroupPersonClient.addFaceFromStreamWithResponse( + "abc", "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", Image, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddPersonFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddPersonFaceExampleTests.java new file mode 100644 index 000000000000..79509c1151b1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/AddPersonFaceExampleTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class AddPersonFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testAddPersonFaceExampleTests() { + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{customized User data}"); + Response response = + personGroupPersonClient.addFaceFromUrlWithResponse( + "abc", "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", ImageUrl, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"persistedFaceId\":\"6e04c175-219e-42a2-9d26-0e7b790e1ef4\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ApplySnapshotExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ApplySnapshotExampleTests.java new file mode 100644 index 000000000000..fdfbc8a4d348 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ApplySnapshotExampleTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ApplySnapshotExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testApplySnapshotExampleTests() { + BinaryData body = BinaryData.fromString("{\"mode\":\"CreateNew\",\"objectId\":\"target-face-list-id\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.applyWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", body, requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateDynamicPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateDynamicPersonGroupExampleTests.java new file mode 100644 index 000000000000..8bbdfa73caf2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateDynamicPersonGroupExampleTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateDynamicPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateDynamicPersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"userData\":\"user-provided data attached to the person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.createDynamicPersonGroupWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateFaceListFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateFaceListFaceExampleTests.java new file mode 100644 index 000000000000..67e35cf5ea33 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateFaceListFaceExampleTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateFaceListFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateFaceListFaceExampleTests() { + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + faceListClient.addFaceFromUrlWithResponse("sample_face_list", ImageUrl, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"persistedFaceId\":\"B8D802CF-DD8F-4E61-B15C-9E6C5844CCBA\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateLargeFaceListFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateLargeFaceListFaceExampleTests.java new file mode 100644 index 000000000000..6e284a190c8f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateLargeFaceListFaceExampleTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateLargeFaceListFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateLargeFaceListFaceExampleTests() { + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("targetFace", "10,10,100,100"); + requestOptions.addQueryParam("userData", "{Customized user data}"); + Response response = + largeFaceListClient.addFaceFromUrlWithResponse("sample_face_list", ImageUrl, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"persistedFaceId\":\"B8D802CF-DD8F-4E61-B15C-9E6C5844CCBA\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewFaceListExampleTests.java new file mode 100644 index 000000000000..e4e5c7a8201d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewFaceListExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateNewFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateNewFaceListExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"sample_list\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceListClient.createWithResponse("sample_face_list", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewLargeFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewLargeFaceListExampleTests.java new file mode 100644 index 000000000000..17ba921a11d9 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewLargeFaceListExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateNewLargeFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateNewLargeFaceListExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"large-face-list-name\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.createWithResponse("sample_face_list", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewLargePersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewLargePersonGroupExampleTests.java new file mode 100644 index 000000000000..b5eb76491691 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewLargePersonGroupExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateNewLargePersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateNewLargePersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"large-person-group-name\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.createWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForLargePersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForLargePersonGroupExampleTests.java new file mode 100644 index 000000000000..095a9ba43715 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForLargePersonGroupExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateNewPersonForLargePersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateNewPersonForLargePersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupPersonClient.createWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"personId\":\"4caa25ee-3bc6-4e88-adf8-12455ce7aab0\"}").toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForPersonGroupExampleTests.java new file mode 100644 index 000000000000..4492357787c9 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonForPersonGroupExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateNewPersonForPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateNewPersonForPersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupPersonClient.createWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"personId\":\"4caa25ee-3bc6-4e88-adf8-12455ce7aab0\"}").toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonGroupExampleTests.java new file mode 100644 index 000000000000..a6506a7da9e0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreateNewPersonGroupExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreateNewPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreateNewPersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"recognitionModel\":\"recognition_01\",\"userData\":\"user-provided data attached to the person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.createWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreatePersonInPersonDirectoryExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreatePersonInPersonDirectoryExampleTests.java new file mode 100644 index 000000000000..7c5a566a1d15 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/CreatePersonInPersonDirectoryExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class CreatePersonInPersonDirectoryExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testCreatePersonInPersonDirectoryExampleTests() { + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.createPersonWithResponse(body, requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"personId\":\"4caa25ee-3bc6-4e88-adf8-12455ce7aab0\"}").toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteALargePersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteALargePersonGroupExampleTests.java new file mode 100644 index 000000000000..8c82b55ee564 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteALargePersonGroupExampleTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteALargePersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteALargePersonGroupExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.deleteWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteAPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteAPersonGroupExampleTests.java new file mode 100644 index 000000000000..151fec8bc30e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteAPersonGroupExampleTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteAPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteAPersonGroupExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.deleteWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteAnExistingPersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteAnExistingPersonExampleTests.java new file mode 100644 index 000000000000..59dd06da06ae --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteAnExistingPersonExampleTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteAnExistingPersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteAnExistingPersonExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.deleteWithResponse( + "abc", "25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteDynamicPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteDynamicPersonGroupExampleTests.java new file mode 100644 index 000000000000..31fdc80c5ac7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteDynamicPersonGroupExampleTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteDynamicPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteDynamicPersonGroupExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.deleteDynamicPersonGroupWithResponse("abc", requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonDirectoryPersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonDirectoryPersonExampleTests.java new file mode 100644 index 000000000000..cfa1ead722dd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonDirectoryPersonExampleTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteFaceFromPersonDirectoryPersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteFaceFromPersonDirectoryPersonExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.deletePersonFaceWithResponse( + "25985303-c537-4467-b41d-bdb45cd95ca1", + "recognition_02", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonExampleTests.java new file mode 100644 index 000000000000..82c1f5d41ad2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceFromPersonExampleTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteFaceFromPersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteFaceFromPersonExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.deleteFaceWithResponse( + "abc", + "25985303-c537-4467-b41d-bdb45cd95ca1", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceInFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceInFaceListExampleTests.java new file mode 100644 index 000000000000..70b4552c7797 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceInFaceListExampleTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteFaceInFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteFaceInFaceListExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + faceListClient.deleteFaceWithResponse( + "sample_face_list", "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceInLargeFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceInLargeFaceListExampleTests.java new file mode 100644 index 000000000000..bdfacb1755f2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceInLargeFaceListExampleTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteFaceInLargeFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteFaceInLargeFaceListExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + largeFaceListClient.deleteFaceWithResponse( + "sample_face_list", "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceListExampleTests.java new file mode 100644 index 000000000000..3a02adc37dfb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteFaceListExampleTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteFaceListExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = faceListClient.deleteWithResponse("sample_face_list", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteLargeFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteLargeFaceListExampleTests.java new file mode 100644 index 000000000000..b0b7efd93250 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteLargeFaceListExampleTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteLargeFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteLargeFaceListExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.deleteWithResponse("sample_face_list", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeletePersonFromPersonDirectoryExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeletePersonFromPersonDirectoryExampleTests.java new file mode 100644 index 000000000000..bf07dd28ca6f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeletePersonFromPersonDirectoryExampleTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeletePersonFromPersonDirectoryExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeletePersonFromPersonDirectoryExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.deletePersonWithResponse("25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteSnapshotExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteSnapshotExampleTests.java new file mode 100644 index 000000000000..6dbf44438f76 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DeleteSnapshotExampleTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DeleteSnapshotExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDeleteSnapshotExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.deleteWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DetectWithStreamExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DetectWithStreamExampleTests.java new file mode 100644 index 000000000000..66619557fd8b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DetectWithStreamExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DetectWithStreamExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDetectWithStreamExampleTests() { + BinaryData Image = BinaryData.fromString("\"{Image binary in base 64 format}\""); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("recognitionModel", "recognition_01"); + requestOptions.addQueryParam( + "returnFaceAttributes", + "age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise"); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceClient.detectWithStreamWithResponse(Image, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DetectWithUrlExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DetectWithUrlExampleTests.java new file mode 100644 index 000000000000..81b03cf81cf3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/DetectWithUrlExampleTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class DetectWithUrlExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testDetectWithUrlExampleTests() { + BinaryData ImageUrl = BinaryData.fromString("{\"url\":\"{Image Url here}\"}"); + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("detectionModel", "detection_01"); + requestOptions.addQueryParam("recognitionModel", "recognition_01"); + requestOptions.addQueryParam( + "returnFaceAttributes", + "age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise"); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceClient.detectWithUrlWithResponse(ImageUrl, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"faceAttributes\":{\"accessories\":[{\"type\":\"headWear\",\"confidence\":0.99},{\"type\":\"glasses\",\"confidence\":1},{\"type\":\"mask\",\"confidence\":0.87}],\"age\":71,\"blur\":{\"blurLevel\":\"Medium\",\"value\":0.51},\"emotion\":{\"anger\":0.575,\"contempt\":0,\"disgust\":0.006,\"fear\":0.008,\"happiness\":0.394,\"neutral\":0.013,\"sadness\":0,\"surprise\":0.004},\"exposure\":{\"exposureLevel\":\"GoodExposure\",\"value\":0.55},\"facialHair\":{\"beard\":0.1,\"moustache\":0.8,\"sideburns\":0.02},\"gender\":\"male\",\"glasses\":\"sunglasses\",\"hair\":{\"bald\":0,\"hairColor\":[{\"color\":\"brown\",\"confidence\":1},{\"color\":\"blond\",\"confidence\":0.88},{\"color\":\"black\",\"confidence\":0.48},{\"color\":\"other\",\"confidence\":0.11},{\"color\":\"gray\",\"confidence\":0.07},{\"color\":\"red\",\"confidence\":0.03}],\"invisible\":false},\"headPose\":{\"pitch\":1.6,\"roll\":2.1,\"yaw\":3},\"makeup\":{\"eyeMakeup\":true,\"lipMakeup\":false},\"noise\":{\"noiseLevel\":\"Low\",\"value\":0.12},\"occlusion\":{\"eyeOccluded\":false,\"foreheadOccluded\":false,\"mouthOccluded\":false},\"smile\":0.88},\"faceId\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"faceLandmarks\":{\"eyeLeftBottom\":{\"x\":413,\"y\":80.1},\"eyeLeftInner\":{\"x\":418.9,\"y\":78},\"eyeLeftOuter\":{\"x\":406.7,\"y\":80.6},\"eyeLeftTop\":{\"x\":412.2,\"y\":76.2},\"eyeRightBottom\":{\"x\":447,\"y\":75.3},\"eyeRightInner\":{\"x\":441.5,\"y\":75},\"eyeRightOuter\":{\"x\":451.7,\"y\":73.4},\"eyeRightTop\":{\"x\":446.4,\"y\":71.7},\"eyebrowLeftInner\":{\"x\":425.4,\"y\":70.5},\"eyebrowLeftOuter\":{\"x\":397.9,\"y\":78.5},\"eyebrowRightInner\":{\"x\":4.8,\"y\":69.7},\"eyebrowRightOuter\":{\"x\":5.5,\"y\":68.5},\"mouthLeft\":{\"x\":417.8,\"y\":114.4},\"mouthRight\":{\"x\":451.3,\"y\":109.3},\"noseLeftAlarOutTip\":{\"x\":424.3,\"y\":96.4},\"noseLeftAlarTop\":{\"x\":428.3,\"y\":89.7},\"noseRightAlarOutTip\":{\"x\":446.6,\"y\":92.5},\"noseRightAlarTop\":{\"x\":442.2,\"y\":87},\"noseRootLeft\":{\"x\":428,\"y\":77.1},\"noseRootRight\":{\"x\":435.8,\"y\":75.6},\"noseTip\":{\"x\":437.7,\"y\":92.4},\"pupilLeft\":{\"x\":412.7,\"y\":78.4},\"pupilRight\":{\"x\":446.8,\"y\":74.2},\"underLipBottom\":{\"x\":437.3,\"y\":114.5},\"underLipTop\":{\"x\":436.8,\"y\":111.4},\"upperLipBottom\":{\"x\":437.6,\"y\":108.2},\"upperLipTop\":{\"x\":437.6,\"y\":105.9}},\"faceRectangle\":{\"height\":78,\"left\":394,\"top\":54,\"width\":78},\"recognitionModel\":\"recognition_01\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/FaceClientTestBase.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/FaceClientTestBase.java new file mode 100644 index 000000000000..7187ce9c3e50 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/FaceClientTestBase.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.cognitiveservices.face.FaceClient; +import com.azure.cognitiveservices.face.FaceClientBuilder; +import com.azure.cognitiveservices.face.FaceListClient; +import com.azure.cognitiveservices.face.FaceListClientBuilder; +import com.azure.cognitiveservices.face.LargeFaceListClient; +import com.azure.cognitiveservices.face.LargeFaceListClientBuilder; +import com.azure.cognitiveservices.face.LargePersonGroupClient; +import com.azure.cognitiveservices.face.LargePersonGroupClientBuilder; +import com.azure.cognitiveservices.face.LargePersonGroupPersonClient; +import com.azure.cognitiveservices.face.LargePersonGroupPersonClientBuilder; +import com.azure.cognitiveservices.face.PersonDirectoryClient; +import com.azure.cognitiveservices.face.PersonDirectoryClientBuilder; +import com.azure.cognitiveservices.face.PersonGroupClient; +import com.azure.cognitiveservices.face.PersonGroupClientBuilder; +import com.azure.cognitiveservices.face.PersonGroupPersonClient; +import com.azure.cognitiveservices.face.PersonGroupPersonClientBuilder; +import com.azure.cognitiveservices.face.SnapshotClient; +import com.azure.cognitiveservices.face.SnapshotClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.Configuration; + +class FaceClientTestBase extends TestBase { + protected FaceClient faceClient; + + protected PersonGroupPersonClient personGroupPersonClient; + + protected PersonGroupClient personGroupClient; + + protected FaceListClient faceListClient; + + protected LargePersonGroupPersonClient largePersonGroupPersonClient; + + protected LargePersonGroupClient largePersonGroupClient; + + protected LargeFaceListClient largeFaceListClient; + + protected SnapshotClient snapshotClient; + + protected PersonDirectoryClient personDirectoryClient; + + @Override + protected void beforeTest() { + FaceClientBuilder faceClientbuilder = + new FaceClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + faceClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + faceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + faceClient = faceClientbuilder.buildClient(); + + PersonGroupPersonClientBuilder personGroupPersonClientbuilder = + new PersonGroupPersonClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + personGroupPersonClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + personGroupPersonClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + personGroupPersonClient = personGroupPersonClientbuilder.buildClient(); + + PersonGroupClientBuilder personGroupClientbuilder = + new PersonGroupClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + personGroupClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + personGroupClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + personGroupClient = personGroupClientbuilder.buildClient(); + + FaceListClientBuilder faceListClientbuilder = + new FaceListClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + faceListClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + faceListClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + faceListClient = faceListClientbuilder.buildClient(); + + LargePersonGroupPersonClientBuilder largePersonGroupPersonClientbuilder = + new LargePersonGroupPersonClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + largePersonGroupPersonClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + largePersonGroupPersonClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + largePersonGroupPersonClient = largePersonGroupPersonClientbuilder.buildClient(); + + LargePersonGroupClientBuilder largePersonGroupClientbuilder = + new LargePersonGroupClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + largePersonGroupClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + largePersonGroupClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + largePersonGroupClient = largePersonGroupClientbuilder.buildClient(); + + LargeFaceListClientBuilder largeFaceListClientbuilder = + new LargeFaceListClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + largeFaceListClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + largeFaceListClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + largeFaceListClient = largeFaceListClientbuilder.buildClient(); + + SnapshotClientBuilder snapshotClientbuilder = + new SnapshotClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + snapshotClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + snapshotClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + snapshotClient = snapshotClientbuilder.buildClient(); + + PersonDirectoryClientBuilder personDirectoryClientbuilder = + new PersonDirectoryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + personDirectoryClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + personDirectoryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + personDirectoryClient = personDirectoryClientbuilder.buildClient(); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/FindSimilarResultsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/FindSimilarResultsExampleTests.java new file mode 100644 index 000000000000..921457d42336 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/FindSimilarResultsExampleTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class FindSimilarResultsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testFindSimilarResultsExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"faceId\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"largeFaceListId\":\"sample_list\",\"maxNumOfCandidatesReturned\":1,\"mode\":\"matchPerson\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.findSimilarWithResponse(body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"confidence\":0.82,\"persistedFaceId\":\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetDynamicPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetDynamicPersonGroupExampleTests.java new file mode 100644 index 000000000000..bebed6e6aa08 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetDynamicPersonGroupExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetDynamicPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetDynamicPersonGroupExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.getDynamicPersonGroupWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"DynamicPersonGroup1\",\"dynamicPersonGroupId\":\"abc\",\"userData\":\"User-provided data attached to the dynamic person group.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetFaceListExampleTests.java new file mode 100644 index 000000000000..2a2169694017 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetFaceListExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetFaceListExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceListClient.getWithResponse("sample_face_list", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"list1\",\"faceListId\":\"sample_list\",\"persistedFaces\":[{\"persistedFaceId\":\"B8D802CF-DD8F-4E61-B15C-9E6C5844CCBD\",\"userData\":\"User-provided data attached to the face.\"}],\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the face list.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListExampleTests.java new file mode 100644 index 000000000000..2b9664c25100 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetLargeFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetLargeFaceListExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = + largeFaceListClient.getWithResponse("f92f6f1b-3258-4444-8fa2-c2df505cc7ac", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"large-face-list-name\",\"largeFaceListId\":\"f92f6f1b-3258-4444-8fa2-c2df505cc7ac\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large face list.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListSTrainingStatusExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListSTrainingStatusExampleTests.java new file mode 100644 index 000000000000..e145f7251af1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargeFaceListSTrainingStatusExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetLargeFaceListSTrainingStatusExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetLargeFaceListSTrainingStatusExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.getTrainingStatusWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"createdDateTime\":\"2017-12-21T12:57:27.00Z\",\"lastActionDateTime\":\"2017-12-21T12:57:30.00Z\",\"lastSuccessfulTrainingDateTime\":\"2017-12-21T12:57:30.00Z\",\"message\":null,\"status\":\"succeeded\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupExampleTests.java new file mode 100644 index 000000000000..7c3438a61324 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetLargePersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetLargePersonGroupExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = largePersonGroupClient.getWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"large-person-group-name\",\"largePersonGroupId\":\"d408cb4e-2f5f-4b4d-b99e-f0b72870e5b5\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large person group.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupSTrainingStatusExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupSTrainingStatusExampleTests.java new file mode 100644 index 000000000000..a2eb0059a166 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetLargePersonGroupSTrainingStatusExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetLargePersonGroupSTrainingStatusExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetLargePersonGroupSTrainingStatusExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.getTrainingStatusWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"createdDateTime\":\"2017-12-21T12:57:27.00Z\",\"lastActionDateTime\":\"2017-12-21T12:57:30.00Z\",\"lastSuccessfulTrainingDateTime\":\"2017-12-21T12:57:30.00Z\",\"message\":null,\"status\":\"succeeded\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersistedFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersistedFaceExampleTests.java new file mode 100644 index 000000000000..6bfdd2332a27 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersistedFaceExampleTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersistedFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersistedFaceExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.getFaceWithResponse( + "abc", + "B8D802CF-DD8F-4E61-B15C-9E6C5844CCBA", + "015839fb-fbd9-4f79-ace9-7675fc2f1dd9", + requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"persistedFaceId\":\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"userData\":\"User-provided data attached to the person face.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonFaceExampleTests.java new file mode 100644 index 000000000000..40e6429965f4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonFaceExampleTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonDirectoryPersonFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonDirectoryPersonFaceExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.getPersonFaceWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", + "recognition_02", + "6e04c175-219e-42a2-9d26-0e7b790e1ef4", + requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"persistedFaceId\":\"6e04c175-219e-42a2-9d26-0e7b790e1ef4\",\"userData\":\"User-provided data attached to the person face.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonsExampleTests.java new file mode 100644 index 000000000000..b6d97d040f13 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonDirectoryPersonsExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonDirectoryPersonsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonDirectoryPersonsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = personDirectoryClient.getPersonsWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"Ryan\",\"personId\":\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"userData\":\"User-provided data attached to the person.\"},{\"name\":\"David\",\"personId\":\"2ae4935b-9659-44c3-977f-61fac20d0538\",\"userData\":\"User-provided data attached to the person.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonExampleTests.java new file mode 100644 index 000000000000..d0dfb8c7e0c7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.getWithResponse("abc", "25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"Ryan\",\"persistedFaceIds\":[\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"fce92aed-d578-4d2e-8114-068f8af4492e\",\"b64d5e15-8257-4af2-b20a-5a750f8940e7\"],\"personId\":\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"userData\":\"User-provided data attached to the person.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonFaceInPersonDirectoryExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonFaceInPersonDirectoryExampleTests.java new file mode 100644 index 000000000000..ec4f5fe26ddf --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonFaceInPersonDirectoryExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonFaceInPersonDirectoryExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonFaceInPersonDirectoryExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.getPersonFacesWithResponse( + "4caa25ee-3bc6-4e88-adf8-12455ce7aab0", "recognition_02", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"persistedFaceIds\":[\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"fce92aed-d578-4d2e-8114-068f8af4492e\",\"b64d5e15-8257-4af2-b20a-5a750f8940e7\"],\"personId\":\"4caa25ee-3bc6-4e88-adf8-12455ce7aab0\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonFromPersonDirectoryExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonFromPersonDirectoryExampleTests.java new file mode 100644 index 000000000000..05b47a83a0fc --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonFromPersonDirectoryExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonFromPersonDirectoryExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonFromPersonDirectoryExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.getPersonWithResponse("25985303-c537-4467-b41d-bdb45cd95ca1", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"Ryan\",\"personId\":\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"userData\":\"User-provided data attached to the person.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonGroupExampleTests.java new file mode 100644 index 000000000000..0fb8afdb132c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonGroupExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonGroupExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = personGroupClient.getWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"name\":\"group1\",\"personGroupId\":\"sample_group\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the person group.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonGroupSTrainingStatusExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonGroupSTrainingStatusExampleTests.java new file mode 100644 index 000000000000..104047f38e28 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetPersonGroupSTrainingStatusExampleTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetPersonGroupSTrainingStatusExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetPersonGroupSTrainingStatusExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.getTrainingStatusWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"createdDateTime\":\"2017-12-21T12:57:27.00Z\",\"lastActionDateTime\":\"2017-12-21T12:57:30.00Z\",\"message\":null,\"status\":\"succeeded\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetSnapshotExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetSnapshotExampleTests.java new file mode 100644 index 000000000000..07b75e8efe51 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetSnapshotExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetSnapshotExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetSnapshotExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.getWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"type\":\"FaceList\",\"account\":\"/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/TestRG/providers/Microsoft.CognitiveServices/accounts/FaceTest01\",\"applyScope\":[\"35230F59-AA9C-45E0-AB5E-C859BF1A5429\",\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"createdTime\":\"2018-12-25T11:41:02.2331413Z\",\"id\":\"e58b3f08-1e8b-4165-81df-aa9858f233dc\",\"lastUpdateTime\":\"2018-12-25T11:51:27.8705696Z\",\"userData\":\"User-provided data attached to the snapshot.\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetSnapshotOperationStatusExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetSnapshotOperationStatusExampleTests.java new file mode 100644 index 000000000000..37804ac52f36 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GetSnapshotOperationStatusExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GetSnapshotOperationStatusExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGetSnapshotOperationStatusExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.getOperationStatusWithResponse("a63a3bdd-a1db-4d05-87b8-dbad6850062a", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"createdTime\":\"2018-12-25T11:41:02.2331413Z\",\"lastActionTime\":\"2018-12-25T11:51:27.8705696Z\",\"message\":null,\"resourceLocation\":\"/snapshots/e58b3f08-1e8b-4165-81df-aa9858f233dc\",\"status\":\"succeeded\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GroupExampleTests.java new file mode 100644 index 000000000000..94419142d54c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/GroupExampleTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class GroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"faceIds\":[\"c5c24a82-6845-4031-9d5d-978df9175426\",\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"65d083d4-9447-47d1-af30-b626144bf0fb\",\"fce92aed-d578-4d2e-8114-068f8af4492e\",\"30ea1073-cc9e-4652-b1e3-d08fb7b95315\",\"be386ab3-af91-4104-9e6d-4dae4c9fddb7\",\"fbd2a038-dbff-452c-8e79-2ee81b1aa84e\",\"b64d5e15-8257-4af2-b20a-5a750f8940e7\"]}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.groupWithResponse(body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"groups\":[[\"c5c24a82-6845-4031-9d5d-978df9175426\",\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"fce92aed-d578-4d2e-8114-068f8af4492e\",\"b64d5e15-8257-4af2-b20a-5a750f8940e7\"],[\"65d083d4-9447-47d1-af30-b626144bf0fb\",\"30ea1073-cc9e-4652-b1e3-d08fb7b95315\"]],\"messyGroup\":[\"be386ab3-af91-4104-9e6d-4dae4c9fddb7\"]}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/IdentifyExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/IdentifyExampleTests.java new file mode 100644 index 000000000000..ae381c90c6d4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/IdentifyExampleTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class IdentifyExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testIdentifyExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"confidenceThreshold\":0.5,\"faceIds\":[\"c5c24a82-6845-4031-9d5d-978df9175426\",\"65d083d4-9447-47d1-af30-b626144bf0fb\"],\"largePersonGroupId\":\"sample_group\",\"maxNumOfCandidatesReturned\":1}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.identifyWithResponse(body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"candidates\":[{\"confidence\":0.92,\"personId\":\"25985303-c537-4467-b41d-bdb45cd95ca1\"}],\"faceId\":\"c5c24a82-6845-4031-9d5d-978df9175426\"},{\"candidates\":[{\"confidence\":0.89,\"personId\":\"2ae4935b-9659-44c3-977f-61fac20d0538\"}],\"faceId\":\"65d083d4-9447-47d1-af30-b626144bf0fb\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupPersonsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupPersonsExampleTests.java new file mode 100644 index 000000000000..b1e27ef6c45a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupPersonsExampleTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListDynamicPersonGroupPersonsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListDynamicPersonGroupPersonsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "25985303-c537-4467-b41d-bdb45cd95ca1"); + requestOptions.addQueryParam("top", "2"); + Response response = + personDirectoryClient.listDynamicPersonGroupPersonsWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"personIds\":[\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"2ae4935b-9659-44c3-977f-61fac20d0538\"]}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupReferencesExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupReferencesExampleTests.java new file mode 100644 index 000000000000..9cdd8bb2fa2c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupReferencesExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListDynamicPersonGroupReferencesExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListDynamicPersonGroupReferencesExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.listDynamicPersonGroupPersonReferencesWithResponse( + "1d44651f-fadb-41f5-8918-c30609964489", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "{\"dynamicPersonGroupIds\":[\"dynamicPersonGroup1\",\"dynamicPersonGroup2\"],\"personId\":\"1d44651f-fadb-41f5-8918-c30609964489\"}") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupsExampleTests.java new file mode 100644 index 000000000000..67561bd555c1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListDynamicPersonGroupsExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListDynamicPersonGroupsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListDynamicPersonGroupsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "sample_group"); + requestOptions.addQueryParam("top", "2"); + Response response = personDirectoryClient.listDynamicPersonGroupsWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"name1\",\"dynamicPersonGroupId\":\"dynamicPersonGroup1\",\"userData\":\"User-provided data attached to the DynamicPersonGroup.\"},{\"name\":\"name2\",\"dynamicPersonGroupId\":\"dynamicPersonGroup2\",\"userData\":\"User-provided data attached to the DynamicPersonGroup.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListFaceListsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListFaceListsExampleTests.java new file mode 100644 index 000000000000..c2e4bc33a86a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListFaceListsExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListFaceListsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListFaceListsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = faceListClient.listWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"list1\",\"faceListId\":\"sample_face_list\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the face list.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListFacesInLargeFaceListTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListFacesInLargeFaceListTests.java new file mode 100644 index 000000000000..23389d64430e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListFacesInLargeFaceListTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListFacesInLargeFaceListTests extends FaceClientTestBase { + @Test + @Disabled + public void testListFacesInLargeFaceListTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "25985303-c537-4467-b41d-bdb45cd95ca1"); + requestOptions.addQueryParam("top", "2"); + Response response = largeFaceListClient.listFacesWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"persistedFaceId\":\"8a887ac2-53fd-4f55-9024-1ec77eecd08e\",\"userData\":\"User-provided data attached to the large face list face.\"},{\"persistedFaceId\":\"f92f6f1b-3258-4444-8fa2-c2df505cc7ac\",\"userData\":\"User-provided data attached to the large face list face.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListLargeFaceListsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListLargeFaceListsExampleTests.java new file mode 100644 index 000000000000..23a13d195975 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListLargeFaceListsExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListLargeFaceListsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListLargeFaceListsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + Response response = largeFaceListClient.listWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"large-face-list-name1\",\"largeFaceListId\":\"f92f6f1b-3258-4444-8fa2-c2df505cc7ac\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large face list.\"},{\"name\":\"large-face-list-name2\",\"largeFaceListId\":\"c76f7f13-0ed3-4d00-8a3e-2ad3d78f6c37\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large face list.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListLargePersonGroupsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListLargePersonGroupsExampleTests.java new file mode 100644 index 000000000000..bfcf53087d0f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListLargePersonGroupsExampleTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListLargePersonGroupsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListLargePersonGroupsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + requestOptions.addQueryParam("start", "sample_group"); + requestOptions.addQueryParam("top", "2"); + Response response = largePersonGroupClient.listWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"large-person-group-name1\",\"largePersonGroupId\":\"f92f6f1b-3258-4444-8fa2-c2df505cc7ac\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large person group.\"},{\"name\":\"large-person-group-name2\",\"largePersonGroupId\":\"c76f7f13-0ed3-4d00-8a3e-2ad3d78f6c37\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the large person group.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListPersonGroupsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListPersonGroupsExampleTests.java new file mode 100644 index 000000000000..6f10def4430e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListPersonGroupsExampleTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListPersonGroupsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListPersonGroupsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("returnRecognitionModel", "true"); + requestOptions.addQueryParam("start", "sample_group"); + requestOptions.addQueryParam("top", "2"); + Response response = personGroupClient.listWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"group1\",\"personGroupId\":\"sample_group\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the person group.\"},{\"name\":\"group2\",\"personGroupId\":\"sample_group2\",\"recognitionModel\":\"recognition_01\",\"userData\":\"User-provided data attached to the person group.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListPersonsInPersonGroupTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListPersonsInPersonGroupTests.java new file mode 100644 index 000000000000..ef948eb0fdc6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListPersonsInPersonGroupTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListPersonsInPersonGroupTests extends FaceClientTestBase { + @Test + @Disabled + public void testListPersonsInPersonGroupTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("start", "25985303-c537-4467-b41d-bdb45cd95ca1"); + requestOptions.addQueryParam("top", "2"); + Response response = personGroupPersonClient.listWithResponse("abc", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"name\":\"Ryan\",\"persistedFaceIds\":[\"015839fb-fbd9-4f79-ace9-7675fc2f1dd9\",\"fce92aed-d578-4d2e-8114-068f8af4492e\",\"b64d5e15-8257-4af2-b20a-5a750f8940e7\"],\"personId\":\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"userData\":\"User-provided data attached to the person\"},{\"name\":\"David\",\"persistedFaceIds\":[\"30ea1073-cc9e-4652-b1e3-d08fb7b95315\",\"fbd2a038-dbff-452c-8e79-2ee81b1aa84e\"],\"personId\":\"2ae4935b-9659-44c3-977f-61fac20d0538\",\"userData\":\"User-provided data attached to the person\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListSnapshotsExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListSnapshotsExampleTests.java new file mode 100644 index 000000000000..31ae02aa1a73 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/ListSnapshotsExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class ListSnapshotsExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testListSnapshotsExampleTests() { + RequestOptions requestOptions = new RequestOptions(); + requestOptions.addQueryParam("type", "FaceList"); + requestOptions.addQueryParam("applyScope", "64084E07-9B7F-4A98-BEA4-9986D3A1EDEB"); + Response response = snapshotClient.listWithResponse(requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString( + "[{\"type\":\"FaceList\",\"account\":\"/subscriptions/f9b96b36-1f5e-4021-8959-51527e26e6d3/resourceGroups/TestRG/providers/Microsoft.CognitiveServices/accounts/FaceTest01\",\"applyScope\":[\"35230F59-AA9C-45E0-AB5E-C859BF1A5429\",\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"createdTime\":\"2018-12-25T11:41:02.2331413Z\",\"id\":\"e58b3f08-1e8b-4165-81df-aa9858f233dc\",\"lastUpdateTime\":\"2018-12-25T11:51:27.8705696Z\",\"userData\":\"User-provided data attached to the snapshot1.\"},{\"type\":\"FaceList\",\"account\":\"/subscriptions/6622996e-0149-4b22-9703-4216dc948d52/resourceGroups/TestRG/providers/Microsoft.CognitiveServices/accounts/FaceTest01\",\"applyScope\":[\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"createdTime\":\"2018-12-29T17:09:32.3298483Z\",\"id\":\"a61e61e4-c3d1-4d33-8ae8-676e6104757d\",\"lastUpdateTime\":\"2018-12-29T17:14:34.5645877Z\",\"userData\":\"User-provided data attached to the snapshot2.\"}]") + .toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueueLargeFaceListTrainingTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueueLargeFaceListTrainingTests.java new file mode 100644 index 000000000000..f5e8518d34f8 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueueLargeFaceListTrainingTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class QueueLargeFaceListTrainingTests extends FaceClientTestBase { + @Test + @Disabled + public void testQueueLargeFaceListTrainingTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.trainWithResponse("abc", requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueueLargePersonGroupTrainingTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueueLargePersonGroupTrainingTests.java new file mode 100644 index 000000000000..2df0304f9b90 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueueLargePersonGroupTrainingTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class QueueLargePersonGroupTrainingTests extends FaceClientTestBase { + @Test + @Disabled + public void testQueueLargePersonGroupTrainingTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.trainWithResponse("abc", requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueuePersonGroupTrainingTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueuePersonGroupTrainingTests.java new file mode 100644 index 000000000000..fbaa776b4e69 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/QueuePersonGroupTrainingTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class QueuePersonGroupTrainingTests extends FaceClientTestBase { + @Test + @Disabled + public void testQueuePersonGroupTrainingTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.trainWithResponse("abc", requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/TakeASnapshotExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/TakeASnapshotExampleTests.java new file mode 100644 index 000000000000..bad9be2c5858 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/TakeASnapshotExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class TakeASnapshotExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testTakeASnapshotExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"type\":\"FaceList\",\"applyScope\":[\"35230F59-AA9C-45E0-AB5E-C859BF1A5429\",\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"objectId\":\"source-face-list-id\",\"userData\":\"User-provided data attached to the snapshot.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = snapshotClient.takeWithResponse(body, requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateDynamicPersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateDynamicPersonGroupExampleTests.java new file mode 100644 index 000000000000..d8b12e57bba9 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateDynamicPersonGroupExampleTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateDynamicPersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateDynamicPersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"Display Name of Dynamic Person Group\",\"addPersonIds\":[\"25985303-c537-4467-b41d-bdb45cd95ca1\",\"4caa25ee-3bc6-4e88-adf8-12455ce7aab0\"],\"removePersonIds\":[\"2ae4935b-9659-44c3-977f-61fac20d0538\"],\"userData\":\"User-provided data attached to the dynamic person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.updateDynamicPersonGroupWithResponse("abc", body, requestOptions); + Assertions.assertEquals(202, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceExampleTests.java new file mode 100644 index 000000000000..4e82cd33312a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateFaceExampleTests() { + BinaryData body = BinaryData.fromString("{\"userData\":\"User-provided data attached to the face.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + largeFaceListClient.updateFaceWithResponse( + "abc", "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceFromPersonDirectoryPersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceFromPersonDirectoryPersonExampleTests.java new file mode 100644 index 000000000000..7cfbe95a1644 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceFromPersonDirectoryPersonExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateFaceFromPersonDirectoryPersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateFaceFromPersonDirectoryPersonExampleTests() { + BinaryData body = BinaryData.fromString("{\"userData\":\"User-provided data attached to the face.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personDirectoryClient.updatePersonFaceWithResponse( + "25985303-c537-4467-b41d-bdb45cd95ca1", + "recognition_02", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + body, + requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceListExampleTests.java new file mode 100644 index 000000000000..506a81e49f6a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateFaceListExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateFaceListExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"list1\",\"userData\":\"User-provided data attached to the face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceListClient.updateWithResponse("sample_face_list", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateLargeFaceListExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateLargeFaceListExampleTests.java new file mode 100644 index 000000000000..39813092ae0a --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateLargeFaceListExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateLargeFaceListExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateLargeFaceListExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"large-face-list-name\",\"userData\":\"User-provided data attached to the large face list.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largeFaceListClient.updateWithResponse("sample_face_list", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateLargePersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateLargePersonGroupExampleTests.java new file mode 100644 index 000000000000..369dc08bb71f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateLargePersonGroupExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateLargePersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateLargePersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"userData\":\"user-provided data attached to the large person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = largePersonGroupClient.updateWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonExampleTests.java new file mode 100644 index 000000000000..7a6f7c40a010 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonExampleTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdatePersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdatePersonExampleTests() { + BinaryData body = + BinaryData.fromString("{\"name\":\"mike\",\"userData\":\"{additional data associated with mike}\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.updateWithResponse( + "abc", "25985303-c537-4467-b41d-bdb45cd95ca1", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonFaceExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonFaceExampleTests.java new file mode 100644 index 000000000000..6809a907dee7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonFaceExampleTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdatePersonFaceExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdatePersonFaceExampleTests() { + BinaryData body = BinaryData.fromString("{\"userData\":\"User-provided data attached to the face.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + personGroupPersonClient.updateFaceWithResponse( + "abc", + "25985303-c537-4467-b41d-bdb45cd95ca1", + "62004fa7-1ac0-478e-9d5a-b38f9e7fbc68", + body, + requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonGroupExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonGroupExampleTests.java new file mode 100644 index 000000000000..fa8a9f16c9dd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdatePersonGroupExampleTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdatePersonGroupExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdatePersonGroupExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"name\":\"group1\",\"userData\":\"user-provided data attached to the person group.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = personGroupClient.updateWithResponse("abc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateSnapshotExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateSnapshotExampleTests.java new file mode 100644 index 000000000000..fbe9e70d54e0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/UpdateSnapshotExampleTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class UpdateSnapshotExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testUpdateSnapshotExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"applyScope\":[\"64084E07-9B7F-4A98-BEA4-9986D3A1EDEB\"],\"userData\":\"User-provided data attached to the snapshot.\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + snapshotClient.updateWithResponse("e58b3f08-1e8b-4165-81df-aa9858f233dc", body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/VerifyFaceToPersonExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/VerifyFaceToPersonExampleTests.java new file mode 100644 index 000000000000..2b48a4d999f6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/VerifyFaceToPersonExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class VerifyFaceToPersonExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testVerifyFaceToPersonExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"faceId\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"largePersonGroupId\":\"sample_group\",\"personId\":\"815df99c-598f-4926-930a-a734b3fd651c\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.verifyFaceToPersonWithResponse(body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"confidence\":0.9,\"isIdentical\":true}").toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/VerifyFacesExampleTests.java b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/VerifyFacesExampleTests.java new file mode 100644 index 000000000000..0484db5e1fe1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/src/test/java/com/azure/cognitiveservices/face/generated/VerifyFacesExampleTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.cognitiveservices.face.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class VerifyFacesExampleTests extends FaceClientTestBase { + @Test + @Disabled + public void testVerifyFacesExampleTests() { + BinaryData body = + BinaryData.fromString( + "{\"faceId1\":\"c5c24a82-6845-4031-9d5d-978df9175426\",\"faceId2\":\"815df99c-598f-4926-930a-a734b3fd651c\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = faceClient.verifyFaceToFaceWithResponse(body, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals( + BinaryData.fromString("{\"confidence\":0.9,\"isIdentical\":true}").toObject(Object.class), + response.getValue().toObject(Object.class)); + } +} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-face/swagger/README_SPEC.md b/sdk/cognitiveservices/azure-cognitiveservices-face/swagger/README_SPEC.md new file mode 100644 index 000000000000..b35ac0e8973b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-face/swagger/README_SPEC.md @@ -0,0 +1,30 @@ +## Generate autorest code + +```yaml +input-file: +- /home/vsts/work/1/s/azure-rest-api-specs/specification/cognitiveservices/data-plane/Face/preview/v1.0-preview/Face.json +output-folder: ../ +java: true +regenerate-pom: false +partial-update: true +model-override-setter-from-superclass: true +use-default-http-status-code-to-exception-type-mapping: true +generate-sync-async-clients: true +generate-client-as-impl: true +models-subpackage: implementation.models +generate-client-interfaces: false +generate-builder-per-client: true +add-context-parameter: true +generate-tests: true +artifact-id: azure-cognitiveservices-face +low-level-client: true +sync-methods: all +generate-samples: true +license-header: MICROSOFT_MIT_SMALL +client-logger: true +namespace: com.azure.cognitiveservices.face +context-client-method-parameter: true +azure-arm: false +service-versions: +- 1.0-preview +``` diff --git a/sdk/cognitiveservices/ci.yml b/sdk/cognitiveservices/ci.yml index ffe9c9528358..721283fb4241 100644 --- a/sdk/cognitiveservices/ci.yml +++ b/sdk/cognitiveservices/ci.yml @@ -113,3 +113,6 @@ extends: - name: azure-resourcemanager-cognitiveservices groupId: com.azure.resourcemanager safeName: azureresourcemanagercognitiveservices + - name: azure-cognitiveservices-face + groupId: com.azure + safeName: azurecognitiveservicesface diff --git a/sdk/cognitiveservices/pom.xml b/sdk/cognitiveservices/pom.xml index 9cde2baccaea..e8fa3afd8c21 100644 --- a/sdk/cognitiveservices/pom.xml +++ b/sdk/cognitiveservices/pom.xml @@ -37,6 +37,7 @@ true + azure-cognitiveservices-face azure-resourcemanager-cognitiveservices ms-azure-cs-autosuggest ms-azure-cs-computervision