From 736dccd6f0bb73f0570fa9390fe9c1001440bde8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 31 Jul 2018 04:58:57 +0000 Subject: [PATCH 1/5] Generated from 9b4c21a58071bdaf26a5ced0fa4a283077617af1 Nit fix documentation. --- .../vision/faceapi/FaceClient.java | 24 + .../vision/faceapi/Faces.java | 170 +- .../vision/faceapi/LargeFaceListFaces.java | 110 ++ .../vision/faceapi/LargeFaceLists.java | 741 ++++++++ .../faceapi/LargePersonGroupPersons.java | 763 +++++++++ .../vision/faceapi/LargePersonGroups.java | 423 +++++ .../vision/faceapi/PersonGroupPersons.java | 16 +- .../vision/faceapi/PersonGroups.java | 8 +- .../implementation/FaceClientImpl.java | 60 + .../faceapi/implementation/FacesImpl.java | 255 ++- .../LargeFaceListFacesImpl.java | 221 +++ .../implementation/LargeFaceListsImpl.java | 1509 ++++++++++++++++ .../LargePersonGroupPersonsImpl.java | 1519 +++++++++++++++++ .../implementation/LargePersonGroupsImpl.java | 866 ++++++++++ .../PersonGroupPersonsImpl.java | 24 +- .../implementation/PersonGroupsImpl.java | 8 +- .../faceapi/models/FindSimilarRequest.java | 46 +- .../faceapi/models/IdentifyRequest.java | 63 +- .../vision/faceapi/models/LargeFaceList.java | 43 + .../faceapi/models/LargePersonGroup.java | 43 + .../models/NameAndUserDataContract.java | 2 +- .../vision/faceapi/models/PersonGroup.java | 6 +- .../vision/faceapi/models/TrainingStatus.java | 57 +- .../faceapi/models/UpdateFaceRequest.java | 43 + .../models/VerifyFaceToFaceRequest.java | 2 +- .../models/VerifyFaceToPersonRequest.java | 56 +- 26 files changed, 6854 insertions(+), 224 deletions(-) create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceListFaces.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroups.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupsImpl.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargeFaceList.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargePersonGroup.java create mode 100644 cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/UpdateFaceRequest.java diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java index aae5e308b8dee..0a8249f5b1981 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java @@ -119,4 +119,28 @@ public interface FaceClient { */ FaceLists faceLists(); + /** + * Gets the LargePersonGroupPersons object to access its operations. + * @return the LargePersonGroupPersons object. + */ + LargePersonGroupPersons largePersonGroupPersons(); + + /** + * Gets the LargePersonGroups object to access its operations. + * @return the LargePersonGroups object. + */ + LargePersonGroups largePersonGroups(); + + /** + * Gets the LargeFaceLists object to access its operations. + * @return the LargeFaceLists object. + */ + LargeFaceLists largeFaceLists(); + + /** + * Gets the LargeFaceListFaces object to access its operations. + * @return the LargeFaceListFaces object. + */ + LargeFaceListFaces largeFaceListFaces(); + } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/Faces.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/Faces.java index 2e9ef5128c01c..bc3e05ba1d151 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/Faces.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/Faces.java @@ -30,7 +30,7 @@ */ public interface Faces { /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @throws IllegalArgumentException thrown if parameters fail the validation @@ -41,7 +41,7 @@ public interface Faces { List findSimilar(UUID faceId); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -51,7 +51,7 @@ public interface Faces { ServiceFuture> findSimilarAsync(UUID faceId, final ServiceCallback> serviceCallback); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @throws IllegalArgumentException thrown if parameters fail the validation @@ -60,7 +60,7 @@ public interface Faces { Observable> findSimilarAsync(UUID faceId); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @throws IllegalArgumentException thrown if parameters fail the validation @@ -68,11 +68,12 @@ public interface Faces { */ Observable>> findSimilarWithServiceResponseAsync(UUID faceId); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @throws IllegalArgumentException thrown if parameters fail the validation @@ -80,47 +81,50 @@ public interface Faces { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<SimilarFace> object if successful. */ - List findSimilar(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode); + List findSimilar(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture> findSimilarAsync(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode, final ServiceCallback> serviceCallback); + ServiceFuture> findSimilarAsync(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode, final ServiceCallback> serviceCallback); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<SimilarFace> object */ - Observable> findSimilarAsync(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode); + Observable> findSimilarAsync(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode); /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<SimilarFace> object */ - Observable>> findSimilarWithServiceResponseAsync(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode); + Observable>> findSimilarWithServiceResponseAsync(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode); /** * Divide candidate faces into groups based on face similarity. @@ -162,52 +166,49 @@ public interface Faces { Observable> groupWithServiceResponseAsync(List faceIds); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws APIErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<IdentifyResult> object if successful. */ - List identify(String personGroupId, List faceIds); + List identify(List faceIds); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture> identifyAsync(String personGroupId, List faceIds, final ServiceCallback> serviceCallback); + ServiceFuture> identifyAsync(List faceIds, final ServiceCallback> serviceCallback); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - Observable> identifyAsync(String personGroupId, List faceIds); + Observable> identifyAsync(List faceIds); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - Observable>> identifyWithServiceResponseAsync(String personGroupId, List faceIds); + Observable>> identifyWithServiceResponseAsync(List faceIds); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @throws IllegalArgumentException thrown if parameters fail the validation @@ -215,44 +216,47 @@ public interface Faces { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<IdentifyResult> object if successful. */ - List identify(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold); + List identify(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture> identifyAsync(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold, final ServiceCallback> serviceCallback); + ServiceFuture> identifyAsync(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold, final ServiceCallback> serviceCallback); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - Observable> identifyAsync(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold); + Observable> identifyAsync(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold); /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - Observable>> identifyWithServiceResponseAsync(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold); + Observable>> identifyWithServiceResponseAsync(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold); /** * Verify whether two faces belong to a same person or whether one face belongs to a person. @@ -389,49 +393,95 @@ public interface Faces { /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. * - * @param faceId FaceId the face, comes from Face - Detect - * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. - * @param personId Specify a certain person in a person group. personId is created in Persons.Create. + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws APIErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the VerifyResult object if successful. */ - VerifyResult verifyFaceToPerson(UUID faceId, String personGroupId, UUID personId); + VerifyResult verifyFaceToPerson(UUID faceId, UUID personId); /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. * - * @param faceId FaceId the face, comes from Face - Detect - * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. - * @param personId Specify a certain person in a person group. personId is created in Persons.Create. + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture verifyFaceToPersonAsync(UUID faceId, String personGroupId, UUID personId, final ServiceCallback serviceCallback); + ServiceFuture verifyFaceToPersonAsync(UUID faceId, UUID personId, final ServiceCallback serviceCallback); /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. * - * @param faceId FaceId the face, comes from Face - Detect - * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. - * @param personId Specify a certain person in a person group. personId is created in Persons.Create. + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VerifyResult object */ - Observable verifyFaceToPersonAsync(UUID faceId, String personGroupId, UUID personId); + Observable verifyFaceToPersonAsync(UUID faceId, UUID personId); /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. * - * @param faceId FaceId the face, comes from Face - Detect - * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. - * @param personId Specify a certain person in a person group. personId is created in Persons.Create. + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VerifyResult object */ - Observable> verifyFaceToPersonWithServiceResponseAsync(UUID faceId, String personGroupId, UUID personId); + Observable> verifyFaceToPersonWithServiceResponseAsync(UUID faceId, UUID personId); + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VerifyResult object if successful. + */ + VerifyResult verifyFaceToPerson(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId); + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture verifyFaceToPersonAsync(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerifyResult object + */ + Observable verifyFaceToPersonAsync(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId); + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerifyResult object + */ + Observable> verifyFaceToPersonWithServiceResponseAsync(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId); /** * Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceListFaces.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceListFaces.java new file mode 100644 index 0000000000000..2e518ca0a5d89 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceListFaces.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi; + +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargeFaceListFaces. + */ +public interface LargeFaceListFaces { + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + List list(String largeFaceListId); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(String largeFaceListId, final ServiceCallback> serviceCallback); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable> listAsync(String largeFaceListId); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable>> listWithServiceResponseAsync(String largeFaceListId); + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + List list(String largeFaceListId, String start, Integer top); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(String largeFaceListId, String start, Integer top, final ServiceCallback> serviceCallback); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable> listAsync(String largeFaceListId, String start, Integer top); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable>> listWithServiceResponseAsync(String largeFaceListId, String start, Integer top); + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java new file mode 100644 index 0000000000000..d59e6b422dceb --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java @@ -0,0 +1,741 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi; + +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.LargeFaceList; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.TrainingStatus; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargeFaceLists. + */ +public interface LargeFaceLists { + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void create(String largeFaceListId); + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(String largeFaceListId, final ServiceCallback serviceCallback); + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable createAsync(String largeFaceListId); + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> createWithServiceResponseAsync(String largeFaceListId); + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void create(String largeFaceListId, String name, String userData); + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(String largeFaceListId, String name, String userData, final ServiceCallback serviceCallback); + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable createAsync(String largeFaceListId, String name, String userData); + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> createWithServiceResponseAsync(String largeFaceListId, String name, String userData); + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LargeFaceList object if successful. + */ + LargeFaceList get(String largeFaceListId); + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String largeFaceListId, final ServiceCallback serviceCallback); + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargeFaceList object + */ + Observable getAsync(String largeFaceListId); + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargeFaceList object + */ + Observable> getWithServiceResponseAsync(String largeFaceListId); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String largeFaceListId); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String largeFaceListId, final ServiceCallback serviceCallback); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateAsync(String largeFaceListId); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateWithServiceResponseAsync(String largeFaceListId); + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String largeFaceListId, String name, String userData); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String largeFaceListId, String name, String userData, final ServiceCallback serviceCallback); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateAsync(String largeFaceListId, String name, String userData); + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateWithServiceResponseAsync(String largeFaceListId, String name, String userData); + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String largeFaceListId); + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String largeFaceListId, final ServiceCallback serviceCallback); + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteAsync(String largeFaceListId); + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String largeFaceListId); + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TrainingStatus object if successful. + */ + TrainingStatus getTrainingStatus(String largeFaceListId); + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getTrainingStatusAsync(String largeFaceListId, final ServiceCallback serviceCallback); + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + Observable getTrainingStatusAsync(String largeFaceListId); + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + Observable> getTrainingStatusWithServiceResponseAsync(String largeFaceListId); + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LargeFaceList> object if successful. + */ + List list(); + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final ServiceCallback> serviceCallback); + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargeFaceList> object + */ + Observable> listAsync(); + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargeFaceList> object + */ + Observable>> listWithServiceResponseAsync(); + + /** + * Queue a large face list training task, the training task may not be started immediately. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void train(String largeFaceListId); + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture trainAsync(String largeFaceListId, final ServiceCallback serviceCallback); + + /** + * Queue a large face list training task, the training task may not be started immediately. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable trainAsync(String largeFaceListId); + + /** + * Queue a large face list training task, the training task may not be started immediately. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> trainWithServiceResponseAsync(String largeFaceListId); + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteFace(String largeFaceListId, UUID persistedFaceId); + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteFaceAsync(String largeFaceListId, UUID persistedFaceId, final ServiceCallback serviceCallback); + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteFaceAsync(String largeFaceListId, UUID persistedFaceId); + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace getFace(String largeFaceListId, UUID persistedFaceId); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getFaceAsync(String largeFaceListId, UUID persistedFaceId, final ServiceCallback serviceCallback); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable getFaceAsync(String largeFaceListId, UUID persistedFaceId); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> getFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateFace(String largeFaceListId, UUID persistedFaceId); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateFaceAsync(String largeFaceListId, UUID persistedFaceId, final ServiceCallback serviceCallback); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateFaceAsync(String largeFaceListId, UUID persistedFaceId); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId); + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateFace(String largeFaceListId, UUID persistedFaceId, String userData); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateFaceAsync(String largeFaceListId, UUID persistedFaceId, String userData, final ServiceCallback serviceCallback); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateFaceAsync(String largeFaceListId, UUID persistedFaceId, String userData); + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId, String userData); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addFaceFromUrl(String largeFaceListId, String url); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addFaceFromUrlAsync(String largeFaceListId, String url, final ServiceCallback serviceCallback); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addFaceFromUrlAsync(String largeFaceListId, String url); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addFaceFromUrlWithServiceResponseAsync(String largeFaceListId, String url); + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addFaceFromUrl(String largeFaceListId, String url, String userData, List targetFace); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addFaceFromUrlAsync(String largeFaceListId, String url, String userData, List targetFace, final ServiceCallback serviceCallback); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addFaceFromUrlAsync(String largeFaceListId, String url, String userData, List targetFace); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addFaceFromUrlWithServiceResponseAsync(String largeFaceListId, String url, String userData, List targetFace); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addFaceFromStream(String largeFaceListId, byte[] image); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addFaceFromStreamAsync(String largeFaceListId, byte[] image, final ServiceCallback serviceCallback); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addFaceFromStreamAsync(String largeFaceListId, byte[] image); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addFaceFromStreamWithServiceResponseAsync(String largeFaceListId, byte[] image); + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addFaceFromStream(String largeFaceListId, byte[] image, String userData, List targetFace); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addFaceFromStreamAsync(String largeFaceListId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addFaceFromStreamAsync(String largeFaceListId, byte[] image, String userData, List targetFace); + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addFaceFromStreamWithServiceResponseAsync(String largeFaceListId, byte[] image, String userData, List targetFace); + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java new file mode 100644 index 0000000000000..77b1ee374570f --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java @@ -0,0 +1,763 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi; + +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.Person; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargePersonGroupPersons. + */ +public interface LargePersonGroupPersons { + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Person object if successful. + */ + Person create(String largePersonGroupId); + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + Observable createAsync(String largePersonGroupId); + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + Observable> createWithServiceResponseAsync(String largePersonGroupId); + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Person object if successful. + */ + Person create(String largePersonGroupId, String name, String userData); + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(String largePersonGroupId, String name, String userData, final ServiceCallback serviceCallback); + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + Observable createAsync(String largePersonGroupId, String name, String userData); + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + Observable> createWithServiceResponseAsync(String largePersonGroupId, String name, String userData); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Person> object if successful. + */ + List list(String largePersonGroupId); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(String largePersonGroupId, final ServiceCallback> serviceCallback); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + Observable> listAsync(String largePersonGroupId); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + Observable>> listWithServiceResponseAsync(String largePersonGroupId); + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Person> object if successful. + */ + List list(String largePersonGroupId, String start, Integer top); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(String largePersonGroupId, String start, Integer top, final ServiceCallback> serviceCallback); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + Observable> listAsync(String largePersonGroupId, String start, Integer top); + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + Observable>> listWithServiceResponseAsync(String largePersonGroupId, String start, Integer top); + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String largePersonGroupId, UUID personId); + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String largePersonGroupId, UUID personId, final ServiceCallback serviceCallback); + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteAsync(String largePersonGroupId, UUID personId); + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String largePersonGroupId, UUID personId); + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Person object if successful. + */ + Person get(String largePersonGroupId, UUID personId); + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String largePersonGroupId, UUID personId, final ServiceCallback serviceCallback); + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + Observable getAsync(String largePersonGroupId, UUID personId); + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + Observable> getWithServiceResponseAsync(String largePersonGroupId, UUID personId); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String largePersonGroupId, UUID personId); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String largePersonGroupId, UUID personId, final ServiceCallback serviceCallback); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateAsync(String largePersonGroupId, UUID personId); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateWithServiceResponseAsync(String largePersonGroupId, UUID personId); + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String largePersonGroupId, UUID personId, String name, String userData); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String largePersonGroupId, UUID personId, String name, String userData, final ServiceCallback serviceCallback); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateAsync(String largePersonGroupId, UUID personId, String name, String userData); + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateWithServiceResponseAsync(String largePersonGroupId, UUID personId, String name, String userData); + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteFace(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback); + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace getFace(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable getFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> getFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateFace(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId); + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void updateFace(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData, final ServiceCallback serviceCallback); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData); + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, final ServiceCallback serviceCallback); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url); + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image); + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroups.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroups.java new file mode 100644 index 0000000000000..aff5d58905561 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroups.java @@ -0,0 +1,423 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi; + +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.LargePersonGroup; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.TrainingStatus; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargePersonGroups. + */ +public interface LargePersonGroups { + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void create(String largePersonGroupId); + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable createAsync(String largePersonGroupId); + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> createWithServiceResponseAsync(String largePersonGroupId); + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void create(String largePersonGroupId, String name, String userData); + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(String largePersonGroupId, String name, String userData, final ServiceCallback serviceCallback); + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable createAsync(String largePersonGroupId, String name, String userData); + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> createWithServiceResponseAsync(String largePersonGroupId, String name, String userData); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String largePersonGroupId); + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteAsync(String largePersonGroupId); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String largePersonGroupId); + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LargePersonGroup object if successful. + */ + LargePersonGroup get(String largePersonGroupId); + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargePersonGroup object + */ + Observable getAsync(String largePersonGroupId); + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargePersonGroup object + */ + Observable> getWithServiceResponseAsync(String largePersonGroupId); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String largePersonGroupId); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateAsync(String largePersonGroupId); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateWithServiceResponseAsync(String largePersonGroupId); + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void update(String largePersonGroupId, String name, String userData); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String largePersonGroupId, String name, String userData, final ServiceCallback serviceCallback); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable updateAsync(String largePersonGroupId, String name, String userData); + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> updateWithServiceResponseAsync(String largePersonGroupId, String name, String userData); + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TrainingStatus object if successful. + */ + TrainingStatus getTrainingStatus(String largePersonGroupId); + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getTrainingStatusAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + Observable getTrainingStatusAsync(String largePersonGroupId); + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + Observable> getTrainingStatusWithServiceResponseAsync(String largePersonGroupId); + + /** + * List large person groups and their information. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LargePersonGroup> object if successful. + */ + List list(); + + /** + * List large person groups and their information. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(final ServiceCallback> serviceCallback); + + /** + * List large person groups and their information. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + Observable> listAsync(); + + /** + * List large person groups and their information. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + Observable>> listWithServiceResponseAsync(); + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LargePersonGroup> object if successful. + */ + List list(String start, Integer top); + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listAsync(String start, Integer top, final ServiceCallback> serviceCallback); + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + Observable> listAsync(String start, Integer top); + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + Observable>> listWithServiceResponseAsync(String start, Integer top); + + /** + * Queue a large person group training task, the training task may not be started immediately. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void train(String largePersonGroupId); + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture trainAsync(String largePersonGroupId, final ServiceCallback serviceCallback); + + /** + * Queue a large person group training task, the training task may not be started immediately. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable trainAsync(String largePersonGroupId); + + /** + * Queue a large person group training task, the training task may not be started immediately. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> trainWithServiceResponseAsync(String largePersonGroupId); + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java index df1480ab2a015..a5fc95181927a 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java @@ -195,7 +195,7 @@ public interface PersonGroupPersons { Observable>> listWithServiceResponseAsync(String personGroupId, String start, Integer top); /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -206,7 +206,7 @@ public interface PersonGroupPersons { void delete(String personGroupId, UUID personId); /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -217,7 +217,7 @@ public interface PersonGroupPersons { ServiceFuture deleteAsync(String personGroupId, UUID personId, final ServiceCallback serviceCallback); /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -227,7 +227,7 @@ public interface PersonGroupPersons { Observable deleteAsync(String personGroupId, UUID personId); /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -371,7 +371,7 @@ public interface PersonGroupPersons { Observable> updateWithServiceResponseAsync(String personGroupId, UUID personId, String name, String userData); /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -383,7 +383,7 @@ public interface PersonGroupPersons { void deleteFace(String personGroupId, UUID personId, UUID persistedFaceId); /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -395,7 +395,7 @@ public interface PersonGroupPersons { ServiceFuture deleteFaceAsync(String personGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback); /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -406,7 +406,7 @@ public interface PersonGroupPersons { Observable deleteFaceAsync(String personGroupId, UUID personId, UUID persistedFaceId); /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroups.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroups.java index ce6c8c622147f..d6464459900d1 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroups.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroups.java @@ -107,7 +107,7 @@ public interface PersonGroups { Observable> createWithServiceResponseAsync(String personGroupId, String name, String userData); /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -117,7 +117,7 @@ public interface PersonGroups { void delete(String personGroupId); /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -127,7 +127,7 @@ public interface PersonGroups { ServiceFuture deleteAsync(String personGroupId, final ServiceCallback serviceCallback); /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -136,7 +136,7 @@ public interface PersonGroups { Observable deleteAsync(String personGroupId); /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java index bb753dde56497..90d26a8e9a114 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java @@ -13,6 +13,10 @@ import com.microsoft.azure.cognitiveservices.vision.faceapi.FaceClient; import com.microsoft.azure.cognitiveservices.vision.faceapi.FaceLists; import com.microsoft.azure.cognitiveservices.vision.faceapi.Faces; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceListFaces; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups; import com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons; import com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroups; import com.microsoft.rest.credentials.ServiceClientCredentials; @@ -177,6 +181,58 @@ public FaceLists faceLists() { return this.faceLists; } + /** + * The LargePersonGroupPersons object to access its operations. + */ + private LargePersonGroupPersons largePersonGroupPersons; + + /** + * Gets the LargePersonGroupPersons object to access its operations. + * @return the LargePersonGroupPersons object. + */ + public LargePersonGroupPersons largePersonGroupPersons() { + return this.largePersonGroupPersons; + } + + /** + * The LargePersonGroups object to access its operations. + */ + private LargePersonGroups largePersonGroups; + + /** + * Gets the LargePersonGroups object to access its operations. + * @return the LargePersonGroups object. + */ + public LargePersonGroups largePersonGroups() { + return this.largePersonGroups; + } + + /** + * The LargeFaceLists object to access its operations. + */ + private LargeFaceLists largeFaceLists; + + /** + * Gets the LargeFaceLists object to access its operations. + * @return the LargeFaceLists object. + */ + public LargeFaceLists largeFaceLists() { + return this.largeFaceLists; + } + + /** + * The LargeFaceListFaces object to access its operations. + */ + private LargeFaceListFaces largeFaceListFaces; + + /** + * Gets the LargeFaceListFaces object to access its operations. + * @return the LargeFaceListFaces object. + */ + public LargeFaceListFaces largeFaceListFaces() { + return this.largeFaceListFaces; + } + /** * Initializes an instance of FaceClient client. * @@ -215,6 +271,10 @@ protected void initialize() { this.personGroupPersons = new PersonGroupPersonsImpl(restClient().retrofit(), this); this.personGroups = new PersonGroupsImpl(restClient().retrofit(), this); this.faceLists = new FaceListsImpl(restClient().retrofit(), this); + this.largePersonGroupPersons = new LargePersonGroupPersonsImpl(restClient().retrofit(), this); + this.largePersonGroups = new LargePersonGroupsImpl(restClient().retrofit(), this); + this.largeFaceLists = new LargeFaceListsImpl(restClient().retrofit(), this); + this.largeFaceListFaces = new LargeFaceListFacesImpl(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java index 5450e1d4b0a6f..13b366f1fbb75 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java @@ -104,7 +104,7 @@ interface FacesService { } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @throws IllegalArgumentException thrown if parameters fail the validation @@ -117,7 +117,7 @@ public List findSimilar(UUID faceId) { } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -129,7 +129,7 @@ public ServiceFuture> findSimilarAsync(UUID faceId, final Serv } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @throws IllegalArgumentException thrown if parameters fail the validation @@ -145,7 +145,7 @@ public List call(ServiceResponse> response) { } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call * @throws IllegalArgumentException thrown if parameters fail the validation @@ -159,12 +159,14 @@ public Observable>> findSimilarWithServiceResp throw new IllegalArgumentException("Parameter faceId is required and cannot be null."); } final String faceListId = null; + final String largeFaceListId = null; final List faceIds = null; final Integer maxNumOfCandidatesReturned = null; final FindSimilarMatchMode mode = null; FindSimilarRequest body = new FindSimilarRequest(); body.withFaceId(faceId); body.withFaceListId(null); + body.withLargeFaceListId(null); body.withFaceIds(null); body.withMaxNumOfCandidatesReturned(null); body.withMode(null); @@ -184,11 +186,12 @@ public Observable>> call(Response>> call(Response findSimilar(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode) { - return findSimilarWithServiceResponseAsync(faceId, faceListId, faceIds, maxNumOfCandidatesReturned, mode).toBlocking().single().body(); + public List findSimilar(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode) { + return findSimilarWithServiceResponseAsync(faceId, faceListId, largeFaceListId, faceIds, maxNumOfCandidatesReturned, mode).toBlocking().single().body(); } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> findSimilarAsync(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(findSimilarWithServiceResponseAsync(faceId, faceListId, faceIds, maxNumOfCandidatesReturned, mode), serviceCallback); + public ServiceFuture> findSimilarAsync(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(findSimilarWithServiceResponseAsync(faceId, faceListId, largeFaceListId, faceIds, maxNumOfCandidatesReturned, mode), serviceCallback); } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<SimilarFace> object */ - public Observable> findSimilarAsync(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode) { - return findSimilarWithServiceResponseAsync(faceId, faceListId, faceIds, maxNumOfCandidatesReturned, mode).map(new Func1>, List>() { + public Observable> findSimilarAsync(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode) { + return findSimilarWithServiceResponseAsync(faceId, faceListId, largeFaceListId, faceIds, maxNumOfCandidatesReturned, mode).map(new Func1>, List>() { @Override public List call(ServiceResponse> response) { return response.body(); @@ -237,17 +242,18 @@ public List call(ServiceResponse> response) { } /** - * Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. + * Given query face's faceId, find the similar-looking faces from a faceId array, a face list or a large face list. * * @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call - * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time - * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * @param faceListId An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。 + * @param largeFaceListId An existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * @param faceIds An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * @param maxNumOfCandidatesReturned The number of top similar faces returned. The valid range is [1, 1000]. * @param mode Similar face searching mode. It can be "matchPerson" or "matchFace". Possible values include: 'matchPerson', 'matchFace' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<SimilarFace> object */ - public Observable>> findSimilarWithServiceResponseAsync(UUID faceId, String faceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode) { + public Observable>> findSimilarWithServiceResponseAsync(UUID faceId, String faceListId, String largeFaceListId, List faceIds, Integer maxNumOfCandidatesReturned, FindSimilarMatchMode mode) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -258,6 +264,7 @@ public Observable>> findSimilarWithServiceResp FindSimilarRequest body = new FindSimilarRequest(); body.withFaceId(faceId); body.withFaceListId(faceListId); + body.withLargeFaceListId(largeFaceListId); body.withFaceIds(faceIds); body.withMaxNumOfCandidatesReturned(maxNumOfCandidatesReturned); body.withMode(mode); @@ -364,42 +371,39 @@ private ServiceResponse groupDelegate(Response respon } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws APIErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<IdentifyResult> object if successful. */ - public List identify(String personGroupId, List faceIds) { - return identifyWithServiceResponseAsync(personGroupId, faceIds).toBlocking().single().body(); + public List identify(List faceIds) { + return identifyWithServiceResponseAsync(faceIds).toBlocking().single().body(); } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> identifyAsync(String personGroupId, List faceIds, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(identifyWithServiceResponseAsync(personGroupId, faceIds), serviceCallback); + public ServiceFuture> identifyAsync(List faceIds, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(identifyWithServiceResponseAsync(faceIds), serviceCallback); } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - public Observable> identifyAsync(String personGroupId, List faceIds) { - return identifyWithServiceResponseAsync(personGroupId, faceIds).map(new Func1>, List>() { + public Observable> identifyAsync(List faceIds) { + return identifyWithServiceResponseAsync(faceIds).map(new Func1>, List>() { @Override public List call(ServiceResponse> response) { return response.body(); @@ -408,29 +412,28 @@ public List call(ServiceResponse> response) } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - public Observable>> identifyWithServiceResponseAsync(String personGroupId, List faceIds) { + public Observable>> identifyWithServiceResponseAsync(List faceIds) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } - if (personGroupId == null) { - throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); - } if (faceIds == null) { throw new IllegalArgumentException("Parameter faceIds is required and cannot be null."); } Validator.validate(faceIds); + final String personGroupId = null; + final String largePersonGroupId = null; final Integer maxNumOfCandidatesReturned = null; final Double confidenceThreshold = null; IdentifyRequest body = new IdentifyRequest(); - body.withPersonGroupId(personGroupId); body.withFaceIds(faceIds); + body.withPersonGroupId(null); + body.withLargePersonGroupId(null); body.withMaxNumOfCandidatesReturned(null); body.withConfidenceThreshold(null); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); @@ -449,10 +452,11 @@ public Observable>> call(Response>> call(Response identify(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold) { - return identifyWithServiceResponseAsync(personGroupId, faceIds, maxNumOfCandidatesReturned, confidenceThreshold).toBlocking().single().body(); + public List identify(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold) { + return identifyWithServiceResponseAsync(faceIds, personGroupId, largePersonGroupId, maxNumOfCandidatesReturned, confidenceThreshold).toBlocking().single().body(); } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> identifyAsync(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(identifyWithServiceResponseAsync(personGroupId, faceIds, maxNumOfCandidatesReturned, confidenceThreshold), serviceCallback); + public ServiceFuture> identifyAsync(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(identifyWithServiceResponseAsync(faceIds, personGroupId, largePersonGroupId, maxNumOfCandidatesReturned, confidenceThreshold), serviceCallback); } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - public Observable> identifyAsync(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold) { - return identifyWithServiceResponseAsync(personGroupId, faceIds, maxNumOfCandidatesReturned, confidenceThreshold).map(new Func1>, List>() { + public Observable> identifyAsync(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold) { + return identifyWithServiceResponseAsync(faceIds, personGroupId, largePersonGroupId, maxNumOfCandidatesReturned, confidenceThreshold).map(new Func1>, List>() { @Override public List call(ServiceResponse> response) { return response.body(); @@ -499,29 +505,28 @@ public List call(ServiceResponse> response) } /** - * Identify unknown faces from a person group. + * 1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. * - * @param personGroupId PersonGroupId of the target person group, created by PersonGroups.Create * @param faceIds Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * @param personGroupId PersonGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId LargePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * @param maxNumOfCandidatesReturned The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). * @param confidenceThreshold Confidence threshold of identification, used to judge whether one face belong to one person. The range of confidenceThreshold is [0, 1] (default specified by algorithm). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<IdentifyResult> object */ - public Observable>> identifyWithServiceResponseAsync(String personGroupId, List faceIds, Integer maxNumOfCandidatesReturned, Double confidenceThreshold) { + public Observable>> identifyWithServiceResponseAsync(List faceIds, String personGroupId, String largePersonGroupId, Integer maxNumOfCandidatesReturned, Double confidenceThreshold) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } - if (personGroupId == null) { - throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); - } if (faceIds == null) { throw new IllegalArgumentException("Parameter faceIds is required and cannot be null."); } Validator.validate(faceIds); IdentifyRequest body = new IdentifyRequest(); - body.withPersonGroupId(personGroupId); body.withFaceIds(faceIds); + body.withPersonGroupId(personGroupId); + body.withLargePersonGroupId(largePersonGroupId); body.withMaxNumOfCandidatesReturned(maxNumOfCandidatesReturned); body.withConfidenceThreshold(confidenceThreshold); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); @@ -805,43 +810,40 @@ private ServiceResponse> detectWithUrlDelegate(Response verifyFaceToPersonAsync(UUID faceId, String personGroupId, UUID personId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(verifyFaceToPersonWithServiceResponseAsync(faceId, personGroupId, personId), serviceCallback); + public ServiceFuture verifyFaceToPersonAsync(UUID faceId, UUID personId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(verifyFaceToPersonWithServiceResponseAsync(faceId, personId), serviceCallback); } /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. * - * @param faceId FaceId the face, comes from Face - Detect - * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. - * @param personId Specify a certain person in a person group. personId is created in Persons.Create. + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VerifyResult object */ - public Observable verifyFaceToPersonAsync(UUID faceId, String personGroupId, UUID personId) { - return verifyFaceToPersonWithServiceResponseAsync(faceId, personGroupId, personId).map(new Func1, VerifyResult>() { + public Observable verifyFaceToPersonAsync(UUID faceId, UUID personId) { + return verifyFaceToPersonWithServiceResponseAsync(faceId, personId).map(new Func1, VerifyResult>() { @Override public VerifyResult call(ServiceResponse response) { return response.body(); @@ -852,21 +854,109 @@ public VerifyResult call(ServiceResponse response) { /** * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. * - * @param faceId FaceId the face, comes from Face - Detect - * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. - * @param personId Specify a certain person in a person group. personId is created in Persons.Create. + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VerifyResult object */ - public Observable> verifyFaceToPersonWithServiceResponseAsync(UUID faceId, String personGroupId, UUID personId) { + public Observable> verifyFaceToPersonWithServiceResponseAsync(UUID faceId, UUID personId) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (faceId == null) { throw new IllegalArgumentException("Parameter faceId is required and cannot be null."); } - if (personGroupId == null) { - throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + final String personGroupId = null; + final String largePersonGroupId = null; + VerifyFaceToPersonRequest body = new VerifyFaceToPersonRequest(); + body.withFaceId(faceId); + body.withPersonGroupId(null); + body.withLargePersonGroupId(null); + body.withPersonId(personId); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.verifyFaceToPerson(this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = verifyFaceToPersonDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VerifyResult object if successful. + */ + public VerifyResult verifyFaceToPerson(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId) { + return verifyFaceToPersonWithServiceResponseAsync(faceId, personId, personGroupId, largePersonGroupId).toBlocking().single().body(); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture verifyFaceToPersonAsync(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(verifyFaceToPersonWithServiceResponseAsync(faceId, personId, personGroupId, largePersonGroupId), serviceCallback); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerifyResult object + */ + public Observable verifyFaceToPersonAsync(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId) { + return verifyFaceToPersonWithServiceResponseAsync(faceId, personId, personGroupId, largePersonGroupId).map(new Func1, VerifyResult>() { + @Override + public VerifyResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Verify whether two faces belong to a same person. Compares a face Id with a Person Id. + * + * @param faceId FaceId of the face, comes from Face - Detect + * @param personId Specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. + * @param personGroupId Using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @param largePersonGroupId Using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VerifyResult object + */ + public Observable> verifyFaceToPersonWithServiceResponseAsync(UUID faceId, UUID personId, String personGroupId, String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (faceId == null) { + throw new IllegalArgumentException("Parameter faceId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); @@ -874,6 +964,7 @@ public Observable> verifyFaceToPersonWithServiceRe VerifyFaceToPersonRequest body = new VerifyFaceToPersonRequest(); body.withFaceId(faceId); body.withPersonGroupId(personGroupId); + body.withLargePersonGroupId(largePersonGroupId); body.withPersonId(personId); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.verifyFaceToPerson(this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java new file mode 100644 index 0000000000000..530ed7a477063 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java @@ -0,0 +1,221 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceListFaces; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargeFaceListFaces. + */ +public class LargeFaceListFacesImpl implements LargeFaceListFaces { + /** The Retrofit service to perform REST calls. */ + private LargeFaceListFacesService service; + /** The service client containing this operation class. */ + private FaceClientImpl client; + + /** + * Initializes an instance of LargeFaceListFacesImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LargeFaceListFacesImpl(Retrofit retrofit, FaceClientImpl client) { + this.service = retrofit.create(LargeFaceListFacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LargeFaceListFaces to be + * used by Retrofit to perform actually REST calls. + */ + interface LargeFaceListFacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceListFaces list" }) + @GET("largefacelists/{largeFaceListId}/persistedFaces") + Observable> list(@Path("largeFaceListId") String largeFaceListId, @Query("start") String start, @Query("top") Integer top, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + public List list(String largeFaceListId) { + return listWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String largeFaceListId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable> listAsync(String largeFaceListId) { + return listWithServiceResponseAsync(largeFaceListId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable>> listWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + final String start = null; + final Integer top = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(largeFaceListId, start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + public List list(String largeFaceListId, String start, Integer top) { + return listWithServiceResponseAsync(largeFaceListId, start, top).toBlocking().single().body(); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String largeFaceListId, String start, Integer top, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(largeFaceListId, start, top), serviceCallback); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable> listAsync(String largeFaceListId, String start, Integer top) { + return listWithServiceResponseAsync(largeFaceListId, start, top).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable>> listWithServiceResponseAsync(String largeFaceListId, String start, Integer top) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(largeFaceListId, start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., APIErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java new file mode 100644 index 0000000000000..a05e9a939f362 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java @@ -0,0 +1,1509 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.ImageUrl; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.LargeFaceList; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.NameAndUserDataContract; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.TrainingStatus; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.UpdateFaceRequest; +import com.microsoft.rest.CollectionFormat; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargeFaceLists. + */ +public class LargeFaceListsImpl implements LargeFaceLists { + /** The Retrofit service to perform REST calls. */ + private LargeFaceListsService service; + /** The service client containing this operation class. */ + private FaceClientImpl client; + + /** + * Initializes an instance of LargeFaceListsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LargeFaceListsImpl(Retrofit retrofit, FaceClientImpl client) { + this.service = retrofit.create(LargeFaceListsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LargeFaceLists to be + * used by Retrofit to perform actually REST calls. + */ + interface LargeFaceListsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists create" }) + @PUT("largefacelists/{largeFaceListId}") + Observable> create(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists get" }) + @GET("largefacelists/{largeFaceListId}") + Observable> get(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists update" }) + @PATCH("largefacelists/{largeFaceListId}") + Observable> update(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists delete" }) + @HTTP(path = "largefacelists/{largeFaceListId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists getTrainingStatus" }) + @GET("largefacelists/{largeFaceListId}/training") + Observable> getTrainingStatus(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists list" }) + @GET("largefacelists") + Observable> list(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists train" }) + @POST("largefacelists/{largeFaceListId}/train") + Observable> train(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists deleteFace" }) + @HTTP(path = "largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}", method = "DELETE", hasBody = true) + Observable> deleteFace(@Path("largeFaceListId") String largeFaceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists getFace" }) + @GET("largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}") + Observable> getFace(@Path("largeFaceListId") String largeFaceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists updateFace" }) + @PATCH("largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}") + Observable> updateFace(@Path("largeFaceListId") String largeFaceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists addFaceFromUrl" }) + @POST("largefacelists/{largeFaceListId}/persistedFaces") + Observable> addFaceFromUrl(@Path("largeFaceListId") String largeFaceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists addFaceFromStream" }) + @POST("largefacelists/{largeFaceListId}/persistedFaces") + Observable> addFaceFromStream(@Path("largeFaceListId") String largeFaceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void create(String largeFaceListId) { + createWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String largeFaceListId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable createAsync(String largeFaceListId) { + return createWithServiceResponseAsync(largeFaceListId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> createWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + final String name = null; + final String userData = null; + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(null); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(largeFaceListId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void create(String largeFaceListId, String name, String userData) { + createWithServiceResponseAsync(largeFaceListId, name, userData).toBlocking().single().body(); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String largeFaceListId, String name, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(largeFaceListId, name, userData), serviceCallback); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable createAsync(String largeFaceListId, String name, String userData) { + return createWithServiceResponseAsync(largeFaceListId, name, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> createWithServiceResponseAsync(String largeFaceListId, String name, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(name); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(largeFaceListId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LargeFaceList object if successful. + */ + public LargeFaceList get(String largeFaceListId) { + return getWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String largeFaceListId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargeFaceList object + */ + public Observable getAsync(String largeFaceListId) { + return getWithServiceResponseAsync(largeFaceListId).map(new Func1, LargeFaceList>() { + @Override + public LargeFaceList call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve a large face list's information. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargeFaceList object + */ + public Observable> getWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.get(largeFaceListId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String largeFaceListId) { + updateWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String largeFaceListId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String largeFaceListId) { + return updateWithServiceResponseAsync(largeFaceListId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + final String name = null; + final String userData = null; + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(null); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(largeFaceListId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String largeFaceListId, String name, String userData) { + updateWithServiceResponseAsync(largeFaceListId, name, userData).toBlocking().single().body(); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String largeFaceListId, String name, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(largeFaceListId, name, userData), serviceCallback); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String largeFaceListId, String name, String userData) { + return updateWithServiceResponseAsync(largeFaceListId, name, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update information of a large face list. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String largeFaceListId, String name, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(name); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(largeFaceListId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String largeFaceListId) { + deleteWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String largeFaceListId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String largeFaceListId) { + return deleteWithServiceResponseAsync(largeFaceListId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.delete(largeFaceListId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TrainingStatus object if successful. + */ + public TrainingStatus getTrainingStatus(String largeFaceListId) { + return getTrainingStatusWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getTrainingStatusAsync(String largeFaceListId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getTrainingStatusWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + public Observable getTrainingStatusAsync(String largeFaceListId) { + return getTrainingStatusWithServiceResponseAsync(largeFaceListId).map(new Func1, TrainingStatus>() { + @Override + public TrainingStatus call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve the training status of a large face list (completed or ongoing). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + public Observable> getTrainingStatusWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getTrainingStatus(largeFaceListId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getTrainingStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getTrainingStatusDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LargeFaceList> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargeFaceList> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargeFaceList> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., APIErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Queue a large face list training task, the training task may not be started immediately. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void train(String largeFaceListId) { + trainWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture trainAsync(String largeFaceListId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(trainWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * Queue a large face list training task, the training task may not be started immediately. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable trainAsync(String largeFaceListId) { + return trainWithServiceResponseAsync(largeFaceListId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queue a large face list training task, the training task may not be started immediately. + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> trainWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.train(largeFaceListId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = trainDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse trainDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteFace(String largeFaceListId, UUID persistedFaceId) { + deleteFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId).toBlocking().single().body(); + } + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteFaceAsync(String largeFaceListId, UUID persistedFaceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId), serviceCallback); + } + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteFaceAsync(String largeFaceListId, UUID persistedFaceId) { + return deleteFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.deleteFace(largeFaceListId, persistedFaceId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteFaceDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace getFace(String largeFaceListId, UUID persistedFaceId) { + return getFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId).toBlocking().single().body(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getFaceAsync(String largeFaceListId, UUID persistedFaceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId), serviceCallback); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable getFaceAsync(String largeFaceListId, UUID persistedFaceId) { + return getFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> getFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getFace(largeFaceListId, persistedFaceId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getFaceDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateFace(String largeFaceListId, UUID persistedFaceId) { + updateFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId).toBlocking().single().body(); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateFaceAsync(String largeFaceListId, UUID persistedFaceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId), serviceCallback); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateFaceAsync(String largeFaceListId, UUID persistedFaceId) { + return updateFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + final String userData = null; + UpdateFaceRequest body = new UpdateFaceRequest(); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateFace(largeFaceListId, persistedFaceId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateFace(String largeFaceListId, UUID persistedFaceId, String userData) { + updateFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId, userData).toBlocking().single().body(); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateFaceAsync(String largeFaceListId, UUID persistedFaceId, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId, userData), serviceCallback); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateFaceAsync(String largeFaceListId, UUID persistedFaceId, String userData) { + return updateFaceWithServiceResponseAsync(largeFaceListId, persistedFaceId, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a persisted face's userData field. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateFaceWithServiceResponseAsync(String largeFaceListId, UUID persistedFaceId, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + UpdateFaceRequest body = new UpdateFaceRequest(); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateFace(largeFaceListId, persistedFaceId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateFaceDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addFaceFromUrl(String largeFaceListId, String url) { + return addFaceFromUrlWithServiceResponseAsync(largeFaceListId, url).toBlocking().single().body(); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addFaceFromUrlAsync(String largeFaceListId, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromUrlWithServiceResponseAsync(largeFaceListId, url), serviceCallback); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addFaceFromUrlAsync(String largeFaceListId, String url) { + return addFaceFromUrlWithServiceResponseAsync(largeFaceListId, url).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addFaceFromUrlWithServiceResponseAsync(String largeFaceListId, String url) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + final String userData = null; + final List targetFace = null; + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); + return service.addFaceFromUrl(largeFaceListId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addFaceFromUrlDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addFaceFromUrl(String largeFaceListId, String url, String userData, List targetFace) { + return addFaceFromUrlWithServiceResponseAsync(largeFaceListId, url, userData, targetFace).toBlocking().single().body(); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addFaceFromUrlAsync(String largeFaceListId, String url, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromUrlWithServiceResponseAsync(largeFaceListId, url, userData, targetFace), serviceCallback); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addFaceFromUrlAsync(String largeFaceListId, String url, String userData, List targetFace) { + return addFaceFromUrlWithServiceResponseAsync(largeFaceListId, url, userData, targetFace).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addFaceFromUrlWithServiceResponseAsync(String largeFaceListId, String url, String userData, List targetFace) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + Validator.validate(targetFace); + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); + return service.addFaceFromUrl(largeFaceListId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addFaceFromUrlDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addFaceFromUrlDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addFaceFromStream(String largeFaceListId, byte[] image) { + return addFaceFromStreamWithServiceResponseAsync(largeFaceListId, image).toBlocking().single().body(); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addFaceFromStreamAsync(String largeFaceListId, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromStreamWithServiceResponseAsync(largeFaceListId, image), serviceCallback); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addFaceFromStreamAsync(String largeFaceListId, byte[] image) { + return addFaceFromStreamWithServiceResponseAsync(largeFaceListId, image).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addFaceFromStreamWithServiceResponseAsync(String largeFaceListId, byte[] image) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); + } + final String userData = null; + final List targetFace = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.addFaceFromStream(largeFaceListId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addFaceFromStreamDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addFaceFromStream(String largeFaceListId, byte[] image, String userData, List targetFace) { + return addFaceFromStreamWithServiceResponseAsync(largeFaceListId, image, userData, targetFace).toBlocking().single().body(); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addFaceFromStreamAsync(String largeFaceListId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromStreamWithServiceResponseAsync(largeFaceListId, image, userData, targetFace), serviceCallback); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addFaceFromStreamAsync(String largeFaceListId, byte[] image, String userData, List targetFace) { + return addFaceFromStreamWithServiceResponseAsync(largeFaceListId, image, userData, targetFace).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. + * + * @param largeFaceListId Id referencing a particular large face list. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addFaceFromStreamWithServiceResponseAsync(String largeFaceListId, byte[] image, String userData, List targetFace) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); + } + Validator.validate(targetFace); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.addFaceFromStream(largeFaceListId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addFaceFromStreamDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addFaceFromStreamDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java new file mode 100644 index 0000000000000..d69a29b3599e4 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java @@ -0,0 +1,1519 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.ImageUrl; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.NameAndUserDataContract; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.Person; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.UpdateFaceRequest; +import com.microsoft.rest.CollectionFormat; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargePersonGroupPersons. + */ +public class LargePersonGroupPersonsImpl implements LargePersonGroupPersons { + /** The Retrofit service to perform REST calls. */ + private LargePersonGroupPersonsService service; + /** The service client containing this operation class. */ + private FaceClientImpl client; + + /** + * Initializes an instance of LargePersonGroupPersonsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LargePersonGroupPersonsImpl(Retrofit retrofit, FaceClientImpl client) { + this.service = retrofit.create(LargePersonGroupPersonsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LargePersonGroupPersons to be + * used by Retrofit to perform actually REST calls. + */ + interface LargePersonGroupPersonsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons create" }) + @POST("largepersongroups/{largePersonGroupId}/persons") + Observable> create(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons list" }) + @GET("largepersongroups/{largePersonGroupId}/persons") + Observable> list(@Path("largePersonGroupId") String largePersonGroupId, @Query("start") String start, @Query("top") Integer top, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons delete" }) + @HTTP(path = "largepersongroups/{largePersonGroupId}/persons/{personId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons get" }) + @GET("largepersongroups/{largePersonGroupId}/persons/{personId}") + Observable> get(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons update" }) + @PATCH("largepersongroups/{largePersonGroupId}/persons/{personId}") + Observable> update(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons deleteFace" }) + @HTTP(path = "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}", method = "DELETE", hasBody = true) + Observable> deleteFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons getFace" }) + @GET("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") + Observable> getFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons updateFace" }) + @PATCH("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") + Observable> updateFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromUrl" }) + @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces") + Observable> addPersonFaceFromUrl(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromStream" }) + @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces") + Observable> addPersonFaceFromStream(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Person object if successful. + */ + public Person create(String largePersonGroupId) { + return createWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + public Observable createAsync(String largePersonGroupId) { + return createWithServiceResponseAsync(largePersonGroupId).map(new Func1, Person>() { + @Override + public Person call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + public Observable> createWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + final String name = null; + final String userData = null; + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(null); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(largePersonGroupId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Person object if successful. + */ + public Person create(String largePersonGroupId, String name, String userData) { + return createWithServiceResponseAsync(largePersonGroupId, name, userData).toBlocking().single().body(); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String largePersonGroupId, String name, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(largePersonGroupId, name, userData), serviceCallback); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + public Observable createAsync(String largePersonGroupId, String name, String userData) { + return createWithServiceResponseAsync(largePersonGroupId, name, userData).map(new Func1, Person>() { + @Override + public Person call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new person in a specified large person group. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + public Observable> createWithServiceResponseAsync(String largePersonGroupId, String name, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(name); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(largePersonGroupId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Person> object if successful. + */ + public List list(String largePersonGroupId) { + return listWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String largePersonGroupId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + public Observable> listAsync(String largePersonGroupId) { + return listWithServiceResponseAsync(largePersonGroupId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + public Observable>> listWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + final String start = null; + final Integer top = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(largePersonGroupId, start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Person> object if successful. + */ + public List list(String largePersonGroupId, String start, Integer top) { + return listWithServiceResponseAsync(largePersonGroupId, start, top).toBlocking().single().body(); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String largePersonGroupId, String start, Integer top, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(largePersonGroupId, start, top), serviceCallback); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + public Observable> listAsync(String largePersonGroupId, String start, Integer top) { + return listWithServiceResponseAsync(largePersonGroupId, start, top).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all persons in a large person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param start Starting person id to return (used to list a range of persons). + * @param top Number of persons to return starting with the person id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Person> object + */ + public Observable>> listWithServiceResponseAsync(String largePersonGroupId, String start, Integer top) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(largePersonGroupId, start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., APIErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String largePersonGroupId, UUID personId) { + deleteWithServiceResponseAsync(largePersonGroupId, personId).toBlocking().single().body(); + } + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String largePersonGroupId, UUID personId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(largePersonGroupId, personId), serviceCallback); + } + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String largePersonGroupId, UUID personId) { + return deleteWithServiceResponseAsync(largePersonGroupId, personId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an existing person from a large person group. All stored person data, and face features in the person entry will be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String largePersonGroupId, UUID personId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.delete(largePersonGroupId, personId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Person object if successful. + */ + public Person get(String largePersonGroupId, UUID personId) { + return getWithServiceResponseAsync(largePersonGroupId, personId).toBlocking().single().body(); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String largePersonGroupId, UUID personId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(largePersonGroupId, personId), serviceCallback); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + public Observable getAsync(String largePersonGroupId, UUID personId) { + return getWithServiceResponseAsync(largePersonGroupId, personId).map(new Func1, Person>() { + @Override + public Person call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve a person's information, including registered persisted faces, name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Person object + */ + public Observable> getWithServiceResponseAsync(String largePersonGroupId, UUID personId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.get(largePersonGroupId, personId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String largePersonGroupId, UUID personId) { + updateWithServiceResponseAsync(largePersonGroupId, personId).toBlocking().single().body(); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String largePersonGroupId, UUID personId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(largePersonGroupId, personId), serviceCallback); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String largePersonGroupId, UUID personId) { + return updateWithServiceResponseAsync(largePersonGroupId, personId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String largePersonGroupId, UUID personId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + final String name = null; + final String userData = null; + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(null); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(largePersonGroupId, personId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String largePersonGroupId, UUID personId, String name, String userData) { + updateWithServiceResponseAsync(largePersonGroupId, personId, name, userData).toBlocking().single().body(); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String largePersonGroupId, UUID personId, String name, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(largePersonGroupId, personId, name, userData), serviceCallback); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String largePersonGroupId, UUID personId, String name, String userData) { + return updateWithServiceResponseAsync(largePersonGroupId, personId, name, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update name or userData of a person. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String largePersonGroupId, UUID personId, String name, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(name); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(largePersonGroupId, personId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteFace(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + deleteFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId).toBlocking().single().body(); + } + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId), serviceCallback); + } + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + return deleteFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a face from a person. Relative feature for the persisted face will also be deleted. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.deleteFace(largePersonGroupId, personId, persistedFaceId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteFaceDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace getFace(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + return getFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId).toBlocking().single().body(); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId), serviceCallback); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable getFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + return getFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging largePersonGroupId). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> getFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getFace(largePersonGroupId, personId, persistedFaceId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getFaceDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateFace(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + updateFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId).toBlocking().single().body(); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId), serviceCallback); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + return updateFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + final String userData = null; + UpdateFaceRequest body = new UpdateFaceRequest(); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateFace(largePersonGroupId, personId, persistedFaceId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void updateFace(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData) { + updateFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId, userData).toBlocking().single().body(); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId, userData), serviceCallback); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateFaceAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData) { + return updateFaceWithServiceResponseAsync(largePersonGroupId, personId, persistedFaceId, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a person persisted face's userData field. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. + * @param userData User-provided data attached to the face. The size limit is 1KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateFaceWithServiceResponseAsync(String largePersonGroupId, UUID personId, UUID persistedFaceId, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (persistedFaceId == null) { + throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); + } + UpdateFaceRequest body = new UpdateFaceRequest(); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateFace(largePersonGroupId, personId, persistedFaceId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateFaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateFaceDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url) { + return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url).toBlocking().single().body(); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url), serviceCallback); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url) { + return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + final String userData = null; + final List targetFace = null; + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); + return service.addPersonFaceFromUrl(largePersonGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addPersonFaceFromUrlDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { + return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace).toBlocking().single().body(); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace), serviceCallback); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { + return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param url Publicly reachable URL of an image + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + Validator.validate(targetFace); + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); + return service.addPersonFaceFromUrl(largePersonGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addPersonFaceFromUrlDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addPersonFaceFromUrlDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image) { + return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image).toBlocking().single().body(); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image), serviceCallback); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image) { + return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); + } + final String userData = null; + final List targetFace = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.addPersonFaceFromStream(largePersonGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addPersonFaceFromStreamDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PersistedFace object if successful. + */ + public PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { + return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace).toBlocking().single().body(); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace), serviceCallback); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { + return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace).map(new Func1, PersistedFace>() { + @Override + public PersistedFace call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param personId Id referencing a particular person. + * @param image An image stream. + * @param userData User-specified data about the face for any purpose. The maximum length is 1KB. + * @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PersistedFace object + */ + public Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + if (personId == null) { + throw new IllegalArgumentException("Parameter personId is required and cannot be null."); + } + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); + } + Validator.validate(targetFace); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.addPersonFaceFromStream(largePersonGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addPersonFaceFromStreamDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addPersonFaceFromStreamDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupsImpl.java new file mode 100644 index 0000000000000..d58352d8e80cf --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupsImpl.java @@ -0,0 +1,866 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.APIErrorException; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.LargePersonGroup; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.NameAndUserDataContract; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.TrainingStatus; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LargePersonGroups. + */ +public class LargePersonGroupsImpl implements LargePersonGroups { + /** The Retrofit service to perform REST calls. */ + private LargePersonGroupsService service; + /** The service client containing this operation class. */ + private FaceClientImpl client; + + /** + * Initializes an instance of LargePersonGroupsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LargePersonGroupsImpl(Retrofit retrofit, FaceClientImpl client) { + this.service = retrofit.create(LargePersonGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LargePersonGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface LargePersonGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups create" }) + @PUT("largepersongroups/{largePersonGroupId}") + Observable> create(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups delete" }) + @HTTP(path = "largepersongroups/{largePersonGroupId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups get" }) + @GET("largepersongroups/{largePersonGroupId}") + Observable> get(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups update" }) + @PATCH("largepersongroups/{largePersonGroupId}") + Observable> update(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups getTrainingStatus" }) + @GET("largepersongroups/{largePersonGroupId}/training") + Observable> getTrainingStatus(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups list" }) + @GET("largepersongroups") + Observable> list(@Query("start") String start, @Query("top") Integer top, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups train" }) + @POST("largepersongroups/{largePersonGroupId}/train") + Observable> train(@Path("largePersonGroupId") String largePersonGroupId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void create(String largePersonGroupId) { + createWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable createAsync(String largePersonGroupId) { + return createWithServiceResponseAsync(largePersonGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> createWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + final String name = null; + final String userData = null; + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(null); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(largePersonGroupId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void create(String largePersonGroupId, String name, String userData) { + createWithServiceResponseAsync(largePersonGroupId, name, userData).toBlocking().single().body(); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String largePersonGroupId, String name, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(largePersonGroupId, name, userData), serviceCallback); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable createAsync(String largePersonGroupId, String name, String userData) { + return createWithServiceResponseAsync(largePersonGroupId, name, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new large person group with specified largePersonGroupId, name and user-provided userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> createWithServiceResponseAsync(String largePersonGroupId, String name, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(name); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(largePersonGroupId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String largePersonGroupId) { + deleteWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String largePersonGroupId) { + return deleteWithServiceResponseAsync(largePersonGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.delete(largePersonGroupId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LargePersonGroup object if successful. + */ + public LargePersonGroup get(String largePersonGroupId) { + return getWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargePersonGroup object + */ + public Observable getAsync(String largePersonGroupId) { + return getWithServiceResponseAsync(largePersonGroupId).map(new Func1, LargePersonGroup>() { + @Override + public LargePersonGroup call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve the information of a large person group, including its name and userData. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LargePersonGroup object + */ + public Observable> getWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.get(largePersonGroupId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String largePersonGroupId) { + updateWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String largePersonGroupId) { + return updateWithServiceResponseAsync(largePersonGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + final String name = null; + final String userData = null; + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(null); + body.withUserData(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(largePersonGroupId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void update(String largePersonGroupId, String name, String userData) { + updateWithServiceResponseAsync(largePersonGroupId, name, userData).toBlocking().single().body(); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String largePersonGroupId, String name, String userData, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(largePersonGroupId, name, userData), serviceCallback); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable updateAsync(String largePersonGroupId, String name, String userData) { + return updateWithServiceResponseAsync(largePersonGroupId, name, userData).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param name User defined name, maximum length is 128. + * @param userData User specified data. Length should not exceed 16KB. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> updateWithServiceResponseAsync(String largePersonGroupId, String name, String userData) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + NameAndUserDataContract body = new NameAndUserDataContract(); + body.withName(name); + body.withUserData(userData); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(largePersonGroupId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TrainingStatus object if successful. + */ + public TrainingStatus getTrainingStatus(String largePersonGroupId) { + return getTrainingStatusWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getTrainingStatusAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getTrainingStatusWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + public Observable getTrainingStatusAsync(String largePersonGroupId) { + return getTrainingStatusWithServiceResponseAsync(largePersonGroupId).map(new Func1, TrainingStatus>() { + @Override + public TrainingStatus call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve the training status of a large person group (completed or ongoing). + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainingStatus object + */ + public Observable> getTrainingStatusWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getTrainingStatus(largePersonGroupId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getTrainingStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getTrainingStatusDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * List large person groups and their information. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LargePersonGroup> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * List large person groups and their information. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List large person groups and their information. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List large person groups and their information. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + final String start = null; + final Integer top = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LargePersonGroup> object if successful. + */ + public List list(String start, Integer top) { + return listWithServiceResponseAsync(start, top).toBlocking().single().body(); + } + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String start, Integer top, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(start, top), serviceCallback); + } + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + public Observable> listAsync(String start, Integer top) { + return listWithServiceResponseAsync(start, top).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List large person groups and their information. + * + * @param start List large person groups from the least largePersonGroupId greater than the "start". + * @param top The number of large person groups to list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LargePersonGroup> object + */ + public Observable>> listWithServiceResponseAsync(String start, Integer top) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.list(start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., APIErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + + /** + * Queue a large person group training task, the training task may not be started immediately. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void train(String largePersonGroupId) { + trainWithServiceResponseAsync(largePersonGroupId).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture trainAsync(String largePersonGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(trainWithServiceResponseAsync(largePersonGroupId), serviceCallback); + } + + /** + * Queue a large person group training task, the training task may not be started immediately. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable trainAsync(String largePersonGroupId) { + return trainWithServiceResponseAsync(largePersonGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queue a large person group training task, the training task may not be started immediately. + * + * @param largePersonGroupId Id referencing a particular large person group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> trainWithServiceResponseAsync(String largePersonGroupId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largePersonGroupId == null) { + throw new IllegalArgumentException("Parameter largePersonGroupId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.train(largePersonGroupId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = trainDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse trainDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java index 120ee2a44160a..2ad89ff472826 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java @@ -17,7 +17,7 @@ import com.microsoft.azure.cognitiveservices.vision.faceapi.models.NameAndUserDataContract; import com.microsoft.azure.cognitiveservices.vision.faceapi.models.PersistedFace; import com.microsoft.azure.cognitiveservices.vision.faceapi.models.Person; -import com.microsoft.azure.cognitiveservices.vision.faceapi.models.UpdatePersonFaceRequest; +import com.microsoft.azure.cognitiveservices.vision.faceapi.models.UpdateFaceRequest; import com.microsoft.rest.CollectionFormat; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; @@ -99,7 +99,7 @@ interface PersonGroupPersonsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons updateFace" }) @PATCH("persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") - Observable> updateFace(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdatePersonFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> updateFace(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addPersonFaceFromUrl" }) @POST("persongroups/{personGroupId}/persons/{personId}/persistedFaces") @@ -432,7 +432,7 @@ private ServiceResponse> listDelegate(Response respon } /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -445,7 +445,7 @@ public void delete(String personGroupId, UUID personId) { } /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -458,7 +458,7 @@ public ServiceFuture deleteAsync(String personGroupId, UUID personId, fina } /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -475,7 +475,7 @@ public Void call(ServiceResponse response) { } /** - * Delete an existing person from a person group. Persisted face images of the person will also be deleted. + * Delete an existing person from a person group. All stored person data, and face features in the person entry will be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -774,7 +774,7 @@ private ServiceResponse updateDelegate(Response response) th } /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -788,7 +788,7 @@ public void deleteFace(String personGroupId, UUID personId, UUID persistedFaceId } /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -802,7 +802,7 @@ public ServiceFuture deleteFaceAsync(String personGroupId, UUID personId, } /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -820,7 +820,7 @@ public Void call(ServiceResponse response) { } /** - * Delete a face from a person. Relative image for the persisted face will also be deleted. + * Delete a face from a person. Relative feature for the persisted face will also be deleted. * * @param personGroupId Id referencing a particular person group. * @param personId Id referencing a particular person. @@ -1023,7 +1023,7 @@ public Observable> updateFaceWithServiceResponseAsync(Stri throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); } final String userData = null; - UpdatePersonFaceRequest body = new UpdatePersonFaceRequest(); + UpdateFaceRequest body = new UpdateFaceRequest(); body.withUserData(null); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.updateFace(personGroupId, personId, persistedFaceId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) @@ -1112,7 +1112,7 @@ public Observable> updateFaceWithServiceResponseAsync(Stri if (persistedFaceId == null) { throw new IllegalArgumentException("Parameter persistedFaceId is required and cannot be null."); } - UpdatePersonFaceRequest body = new UpdatePersonFaceRequest(); + UpdateFaceRequest body = new UpdateFaceRequest(); body.withUserData(userData); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); return service.updateFace(personGroupId, personId, persistedFaceId, this.client.acceptLanguage(), body, parameterizedHost, this.client.userAgent()) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java index 4b7f316d8e12c..b19b05797bec6 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java @@ -254,7 +254,7 @@ private ServiceResponse createDelegate(Response response) th } /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -266,7 +266,7 @@ public void delete(String personGroupId) { } /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -278,7 +278,7 @@ public ServiceFuture deleteAsync(String personGroupId, final ServiceCallba } /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -294,7 +294,7 @@ public Void call(ServiceResponse response) { } /** - * Delete an existing person group. Persisted face images of all people in the person group will also be deleted. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/FindSimilarRequest.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/FindSimilarRequest.java index d8fa63517085b..c6c3d8464005c 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/FindSimilarRequest.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/FindSimilarRequest.java @@ -27,15 +27,27 @@ public class FindSimilarRequest { /** * An existing user-specified unique candidate face list, created in Face * List - Create a Face List. Face list contains a set of persistedFaceIds - * which are persisted and will never expire. Parameter faceListId and - * faceIds should not be provided at the same time. + * which are persisted and will never expire. Parameter faceListId, + * largeFaceListId and faceIds should not be provided at the same time。. */ @JsonProperty(value = "faceListId") private String faceListId; + /** + * An existing user-specified unique candidate large face list, created in + * LargeFaceList - Create. Large face list contains a set of + * persistedFaceIds which are persisted and will never expire. Parameter + * faceListId, largeFaceListId and faceIds should not be provided at the + * same time. + */ + @JsonProperty(value = "largeFaceListId") + private String largeFaceListId; + /** * An array of candidate faceIds. All of them are created by Face - Detect - * and the faceIds will expire 24 hours after the detection call. + * and the faceIds will expire 24 hours after the detection call. The + * number of faceIds is limited to 1000. Parameter faceListId, + * largeFaceListId and faceIds should not be provided at the same time. */ @JsonProperty(value = "faceIds") private List faceIds; @@ -74,7 +86,7 @@ public FindSimilarRequest withFaceId(UUID faceId) { } /** - * Get an existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time. + * Get an existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。. * * @return the faceListId value */ @@ -83,7 +95,7 @@ public String faceListId() { } /** - * Set an existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId and faceIds should not be provided at the same time. + * Set an existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time。. * * @param faceListId the faceListId value to set * @return the FindSimilarRequest object itself. @@ -94,7 +106,27 @@ public FindSimilarRequest withFaceListId(String faceListId) { } /** - * Get an array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * Get an existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * + * @return the largeFaceListId value + */ + public String largeFaceListId() { + return this.largeFaceListId; + } + + /** + * Set an existing user-specified unique candidate large face list, created in LargeFaceList - Create. Large face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. + * + * @param largeFaceListId the largeFaceListId value to set + * @return the FindSimilarRequest object itself. + */ + public FindSimilarRequest withLargeFaceListId(String largeFaceListId) { + this.largeFaceListId = largeFaceListId; + return this; + } + + /** + * Get an array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * * @return the faceIds value */ @@ -103,7 +135,7 @@ public List faceIds() { } /** - * Set an array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. + * Set an array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection call. The number of faceIds is limited to 1000. Parameter faceListId, largeFaceListId and faceIds should not be provided at the same time. * * @param faceIds the faceIds value to set * @return the FindSimilarRequest object itself. diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/IdentifyRequest.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/IdentifyRequest.java index f7dbccf94643e..ea62ca005dc7f 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/IdentifyRequest.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/IdentifyRequest.java @@ -16,13 +16,6 @@ * Request body for identify face operation. */ public class IdentifyRequest { - /** - * PersonGroupId of the target person group, created by - * PersonGroups.Create. - */ - @JsonProperty(value = "personGroupId", required = true) - private String personGroupId; - /** * Array of query faces faceIds, created by the Face - Detect. Each of the * faces are identified independently. The valid number of faceIds is @@ -31,6 +24,22 @@ public class IdentifyRequest { @JsonProperty(value = "faceIds", required = true) private List faceIds; + /** + * PersonGroupId of the target person group, created by PersonGroup - + * Create. Parameter personGroupId and largePersonGroupId should not be + * provided at the same time. + */ + @JsonProperty(value = "personGroupId") + private String personGroupId; + + /** + * LargePersonGroupId of the target large person group, created by + * LargePersonGroup - Create. Parameter personGroupId and + * largePersonGroupId should not be provided at the same time. + */ + @JsonProperty(value = "largePersonGroupId") + private String largePersonGroupId; + /** * The range of maxNumOfCandidatesReturned is between 1 and 5 (default is * 1). @@ -47,7 +56,27 @@ public class IdentifyRequest { private Double confidenceThreshold; /** - * Get personGroupId of the target person group, created by PersonGroups.Create. + * Get array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * + * @return the faceIds value + */ + public List faceIds() { + return this.faceIds; + } + + /** + * Set array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * + * @param faceIds the faceIds value to set + * @return the IdentifyRequest object itself. + */ + public IdentifyRequest withFaceIds(List faceIds) { + this.faceIds = faceIds; + return this; + } + + /** + * Get personGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * * @return the personGroupId value */ @@ -56,7 +85,7 @@ public String personGroupId() { } /** - * Set personGroupId of the target person group, created by PersonGroups.Create. + * Set personGroupId of the target person group, created by PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * * @param personGroupId the personGroupId value to set * @return the IdentifyRequest object itself. @@ -67,22 +96,22 @@ public IdentifyRequest withPersonGroupId(String personGroupId) { } /** - * Get array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * Get largePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * - * @return the faceIds value + * @return the largePersonGroupId value */ - public List faceIds() { - return this.faceIds; + public String largePersonGroupId() { + return this.largePersonGroupId; } /** - * Set array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. + * Set largePersonGroupId of the target large person group, created by LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * - * @param faceIds the faceIds value to set + * @param largePersonGroupId the largePersonGroupId value to set * @return the IdentifyRequest object itself. */ - public IdentifyRequest withFaceIds(List faceIds) { - this.faceIds = faceIds; + public IdentifyRequest withLargePersonGroupId(String largePersonGroupId) { + this.largePersonGroupId = largePersonGroupId; return this; } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargeFaceList.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargeFaceList.java new file mode 100644 index 0000000000000..9ec1098cc50fc --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargeFaceList.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Large face list object. + */ +public class LargeFaceList extends NameAndUserDataContract { + /** + * LargeFaceListId of the target large face list. + */ + @JsonProperty(value = "largeFaceListId", required = true) + private String largeFaceListId; + + /** + * Get largeFaceListId of the target large face list. + * + * @return the largeFaceListId value + */ + public String largeFaceListId() { + return this.largeFaceListId; + } + + /** + * Set largeFaceListId of the target large face list. + * + * @param largeFaceListId the largeFaceListId value to set + * @return the LargeFaceList object itself. + */ + public LargeFaceList withLargeFaceListId(String largeFaceListId) { + this.largeFaceListId = largeFaceListId; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargePersonGroup.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargePersonGroup.java new file mode 100644 index 0000000000000..972a8bcd79111 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/LargePersonGroup.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Large person group object. + */ +public class LargePersonGroup extends NameAndUserDataContract { + /** + * LargePersonGroupId of the target large person groups. + */ + @JsonProperty(value = "largePersonGroupId", required = true) + private String largePersonGroupId; + + /** + * Get largePersonGroupId of the target large person groups. + * + * @return the largePersonGroupId value + */ + public String largePersonGroupId() { + return this.largePersonGroupId; + } + + /** + * Set largePersonGroupId of the target large person groups. + * + * @param largePersonGroupId the largePersonGroupId value to set + * @return the LargePersonGroup object itself. + */ + public LargePersonGroup withLargePersonGroupId(String largePersonGroupId) { + this.largePersonGroupId = largePersonGroupId; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/NameAndUserDataContract.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/NameAndUserDataContract.java index fe757e8e831bd..f6c31c6e1f359 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/NameAndUserDataContract.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/NameAndUserDataContract.java @@ -12,7 +12,7 @@ /** * A combination of user defined name and user specified data for the person, - * personGroup, and faceList. + * largePersonGroup/personGroup, and largeFaceList/faceList. */ public class NameAndUserDataContract { /** diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/PersonGroup.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/PersonGroup.java index c69251a7bb600..4d54a0106cfd7 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/PersonGroup.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/PersonGroup.java @@ -15,13 +15,13 @@ */ public class PersonGroup extends NameAndUserDataContract { /** - * PersonGroupId of the existing person groups. + * PersonGroupId of the target person group. */ @JsonProperty(value = "personGroupId", required = true) private String personGroupId; /** - * Get personGroupId of the existing person groups. + * Get personGroupId of the target person group. * * @return the personGroupId value */ @@ -30,7 +30,7 @@ public String personGroupId() { } /** - * Set personGroupId of the existing person groups. + * Set personGroupId of the target person group. * * @param personGroupId the personGroupId value to set * @return the PersonGroup object itself. diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/TrainingStatus.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/TrainingStatus.java index 1df0d9167c8cf..9c0ff492b7a01 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/TrainingStatus.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/TrainingStatus.java @@ -19,27 +19,38 @@ public class TrainingStatus { * Training status: notstarted, running, succeeded, failed. If the training * process is waiting to perform, the status is notstarted. If the training * is ongoing, the status is running. Status succeed means this person - * group is ready for Face - Identify. Status failed is often caused by no - * person or no persisted face exist in the person group. Possible values - * include: 'nonstarted', 'running', 'succeeded', 'failed'. + * group or large person group is ready for Face - Identify, or this large + * face list is ready for Face - Find Similar. Status failed is often + * caused by no person or no persisted face exist in the person group or + * large person group, or no persisted face exist in the large face list. + * Possible values include: 'nonstarted', 'running', 'succeeded', 'failed'. */ @JsonProperty(value = "status", required = true) private TrainingStatusType status; /** - * A combined UTC date and time string that describes person group created - * time. + * A combined UTC date and time string that describes the created time of + * the person group, large person group or large face list. */ @JsonProperty(value = "createdDateTime", required = true) private DateTime created; /** - * Person group last modify time in the UTC, could be null value when the - * person group is not successfully trained. + * A combined UTC date and time string that describes the last modify time + * of the person group, large person group or large face list, could be + * null value when the group is not successfully trained. */ @JsonProperty(value = "lastActionDateTime") private DateTime lastAction; + /** + * A combined UTC date and time string that describes the last successful + * training time of the person group, large person group or large face + * list. + */ + @JsonProperty(value = "lastSuccessfulTrainingDateTime") + private DateTime lastSuccessfulTraining; + /** * Show failure message when training failed (omitted when training * succeed). @@ -48,7 +59,7 @@ public class TrainingStatus { private String message; /** - * Get training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status succeed means this person group is ready for Face - Identify. Status failed is often caused by no person or no persisted face exist in the person group. Possible values include: 'nonstarted', 'running', 'succeeded', 'failed'. + * Get training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status succeed means this person group or large person group is ready for Face - Identify, or this large face list is ready for Face - Find Similar. Status failed is often caused by no person or no persisted face exist in the person group or large person group, or no persisted face exist in the large face list. Possible values include: 'nonstarted', 'running', 'succeeded', 'failed'. * * @return the status value */ @@ -57,7 +68,7 @@ public TrainingStatusType status() { } /** - * Set training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status succeed means this person group is ready for Face - Identify. Status failed is often caused by no person or no persisted face exist in the person group. Possible values include: 'nonstarted', 'running', 'succeeded', 'failed'. + * Set training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status succeed means this person group or large person group is ready for Face - Identify, or this large face list is ready for Face - Find Similar. Status failed is often caused by no person or no persisted face exist in the person group or large person group, or no persisted face exist in the large face list. Possible values include: 'nonstarted', 'running', 'succeeded', 'failed'. * * @param status the status value to set * @return the TrainingStatus object itself. @@ -68,7 +79,7 @@ public TrainingStatus withStatus(TrainingStatusType status) { } /** - * Get a combined UTC date and time string that describes person group created time. + * Get a combined UTC date and time string that describes the created time of the person group, large person group or large face list. * * @return the created value */ @@ -77,7 +88,7 @@ public DateTime created() { } /** - * Set a combined UTC date and time string that describes person group created time. + * Set a combined UTC date and time string that describes the created time of the person group, large person group or large face list. * * @param created the created value to set * @return the TrainingStatus object itself. @@ -88,7 +99,7 @@ public TrainingStatus withCreated(DateTime created) { } /** - * Get person group last modify time in the UTC, could be null value when the person group is not successfully trained. + * Get a combined UTC date and time string that describes the last modify time of the person group, large person group or large face list, could be null value when the group is not successfully trained. * * @return the lastAction value */ @@ -97,7 +108,7 @@ public DateTime lastAction() { } /** - * Set person group last modify time in the UTC, could be null value when the person group is not successfully trained. + * Set a combined UTC date and time string that describes the last modify time of the person group, large person group or large face list, could be null value when the group is not successfully trained. * * @param lastAction the lastAction value to set * @return the TrainingStatus object itself. @@ -107,6 +118,26 @@ public TrainingStatus withLastAction(DateTime lastAction) { return this; } + /** + * Get a combined UTC date and time string that describes the last successful training time of the person group, large person group or large face list. + * + * @return the lastSuccessfulTraining value + */ + public DateTime lastSuccessfulTraining() { + return this.lastSuccessfulTraining; + } + + /** + * Set a combined UTC date and time string that describes the last successful training time of the person group, large person group or large face list. + * + * @param lastSuccessfulTraining the lastSuccessfulTraining value to set + * @return the TrainingStatus object itself. + */ + public TrainingStatus withLastSuccessfulTraining(DateTime lastSuccessfulTraining) { + this.lastSuccessfulTraining = lastSuccessfulTraining; + return this; + } + /** * Get show failure message when training failed (omitted when training succeed). * diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/UpdateFaceRequest.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/UpdateFaceRequest.java new file mode 100644 index 0000000000000..94b1020f33b95 --- /dev/null +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/UpdateFaceRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.faceapi.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request to update face data. + */ +public class UpdateFaceRequest { + /** + * User-provided data attached to the face. The size limit is 1KB. + */ + @JsonProperty(value = "userData") + private String userData; + + /** + * Get user-provided data attached to the face. The size limit is 1KB. + * + * @return the userData value + */ + public String userData() { + return this.userData; + } + + /** + * Set user-provided data attached to the face. The size limit is 1KB. + * + * @param userData the userData value to set + * @return the UpdateFaceRequest object itself. + */ + public UpdateFaceRequest withUserData(String userData) { + this.userData = userData; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToFaceRequest.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToFaceRequest.java index 3bf44626a0d0d..5696325adf75c 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToFaceRequest.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToFaceRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Request body for verify operation. + * Request body for face to face verification. */ public class VerifyFaceToFaceRequest { /** diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToPersonRequest.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToPersonRequest.java index 064c67e118ac3..5758d82d4a93a 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToPersonRequest.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/models/VerifyFaceToPersonRequest.java @@ -12,31 +12,43 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Request body for verify operation. + * Request body for face to person verification. */ public class VerifyFaceToPersonRequest { /** - * FaceId the face, comes from Face - Detect. + * FaceId of the face, comes from Face - Detect. */ @JsonProperty(value = "faceId", required = true) private UUID faceId; /** * Using existing personGroupId and personId for fast loading a specified - * person. personGroupId is created in Person Groups.Create. + * person. personGroupId is created in PersonGroup - Create. Parameter + * personGroupId and largePersonGroupId should not be provided at the same + * time. */ - @JsonProperty(value = "personGroupId", required = true) + @JsonProperty(value = "personGroupId") private String personGroupId; /** - * Specify a certain person in a person group. personId is created in - * Persons.Create. + * Using existing largePersonGroupId and personId for fast loading a + * specified person. largePersonGroupId is created in LargePersonGroup - + * Create. Parameter personGroupId and largePersonGroupId should not be + * provided at the same time. + */ + @JsonProperty(value = "largePersonGroupId") + private String largePersonGroupId; + + /** + * Specify a certain person in a person group or a large person group. + * personId is created in PersonGroup Person - Create or LargePersonGroup + * Person - Create. */ @JsonProperty(value = "personId", required = true) private UUID personId; /** - * Get faceId the face, comes from Face - Detect. + * Get faceId of the face, comes from Face - Detect. * * @return the faceId value */ @@ -45,7 +57,7 @@ public UUID faceId() { } /** - * Set faceId the face, comes from Face - Detect. + * Set faceId of the face, comes from Face - Detect. * * @param faceId the faceId value to set * @return the VerifyFaceToPersonRequest object itself. @@ -56,7 +68,7 @@ public VerifyFaceToPersonRequest withFaceId(UUID faceId) { } /** - * Get using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. + * Get using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * * @return the personGroupId value */ @@ -65,7 +77,7 @@ public String personGroupId() { } /** - * Set using existing personGroupId and personId for fast loading a specified person. personGroupId is created in Person Groups.Create. + * Set using existing personGroupId and personId for fast loading a specified person. personGroupId is created in PersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. * * @param personGroupId the personGroupId value to set * @return the VerifyFaceToPersonRequest object itself. @@ -76,7 +88,27 @@ public VerifyFaceToPersonRequest withPersonGroupId(String personGroupId) { } /** - * Get specify a certain person in a person group. personId is created in Persons.Create. + * Get using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * + * @return the largePersonGroupId value + */ + public String largePersonGroupId() { + return this.largePersonGroupId; + } + + /** + * Set using existing largePersonGroupId and personId for fast loading a specified person. largePersonGroupId is created in LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId should not be provided at the same time. + * + * @param largePersonGroupId the largePersonGroupId value to set + * @return the VerifyFaceToPersonRequest object itself. + */ + public VerifyFaceToPersonRequest withLargePersonGroupId(String largePersonGroupId) { + this.largePersonGroupId = largePersonGroupId; + return this; + } + + /** + * Get specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * * @return the personId value */ @@ -85,7 +117,7 @@ public UUID personId() { } /** - * Set specify a certain person in a person group. personId is created in Persons.Create. + * Set specify a certain person in a person group or a large person group. personId is created in PersonGroup Person - Create or LargePersonGroup Person - Create. * * @param personId the personId value to set * @return the VerifyFaceToPersonRequest object itself. From 637157924000d2bc5345a75ae67c3451df548adb Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 31 Jul 2018 06:59:16 +0000 Subject: [PATCH 2/5] Generated from a2c9e881121ab738c6142713fd66d08629b7a475 Nit path case refinement. --- .../vision/faceapi/implementation/FaceListsImpl.java | 6 +++--- .../faceapi/implementation/LargeFaceListFacesImpl.java | 2 +- .../faceapi/implementation/LargeFaceListsImpl.java | 10 +++++----- .../implementation/LargePersonGroupPersonsImpl.java | 10 +++++----- .../faceapi/implementation/PersonGroupPersonsImpl.java | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java index 75b62d84a5545..719454401ecd2 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java @@ -90,15 +90,15 @@ interface FaceListsService { Observable> list(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.FaceLists deleteFace" }) - @HTTP(path = "facelists/{faceListId}/persistedFaces/{persistedFaceId}", method = "DELETE", hasBody = true) + @HTTP(path = "facelists/{faceListId}/persistedfaces/{persistedFaceId}", method = "DELETE", hasBody = true) Observable> deleteFace(@Path("faceListId") String faceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.FaceLists addFaceFromUrl" }) - @POST("facelists/{faceListId}/persistedFaces") + @POST("facelists/{faceListId}/persistedfaces") Observable> addFaceFromUrl(@Path("faceListId") String faceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.FaceLists addFaceFromStream" }) - @POST("facelists/{faceListId}/persistedFaces") + @POST("facelists/{faceListId}/persistedfaces") Observable> addFaceFromStream(@Path("faceListId") String faceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java index 530ed7a477063..bf89b10ca0476 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListFacesImpl.java @@ -56,7 +56,7 @@ public LargeFaceListFacesImpl(Retrofit retrofit, FaceClientImpl client) { */ interface LargeFaceListFacesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceListFaces list" }) - @GET("largefacelists/{largeFaceListId}/persistedFaces") + @GET("largefacelists/{largeFaceListId}/persistedfaces") Observable> list(@Path("largeFaceListId") String largeFaceListId, @Query("start") String start, @Query("top") Integer top, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java index a05e9a939f362..7975424c937c1 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java @@ -100,23 +100,23 @@ interface LargeFaceListsService { Observable> train(@Path("largeFaceListId") String largeFaceListId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists deleteFace" }) - @HTTP(path = "largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}", method = "DELETE", hasBody = true) + @HTTP(path = "largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}", method = "DELETE", hasBody = true) Observable> deleteFace(@Path("largeFaceListId") String largeFaceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists getFace" }) - @GET("largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}") + @GET("largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}") Observable> getFace(@Path("largeFaceListId") String largeFaceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists updateFace" }) - @PATCH("largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}") + @PATCH("largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}") Observable> updateFace(@Path("largeFaceListId") String largeFaceListId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists addFaceFromUrl" }) - @POST("largefacelists/{largeFaceListId}/persistedFaces") + @POST("largefacelists/{largeFaceListId}/persistedfaces") Observable> addFaceFromUrl(@Path("largeFaceListId") String largeFaceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists addFaceFromStream" }) - @POST("largefacelists/{largeFaceListId}/persistedFaces") + @POST("largefacelists/{largeFaceListId}/persistedfaces") Observable> addFaceFromStream(@Path("largeFaceListId") String largeFaceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java index d69a29b3599e4..1c57f7d95a413 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java @@ -90,23 +90,23 @@ interface LargePersonGroupPersonsService { Observable> update(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons deleteFace" }) - @HTTP(path = "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}", method = "DELETE", hasBody = true) + @HTTP(path = "largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", method = "DELETE", hasBody = true) Observable> deleteFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons getFace" }) - @GET("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") + @GET("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") Observable> getFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons updateFace" }) - @PATCH("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") + @PATCH("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") Observable> updateFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromUrl" }) - @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces") + @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") Observable> addPersonFaceFromUrl(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromStream" }) - @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces") + @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") Observable> addPersonFaceFromStream(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java index 2ad89ff472826..6d5df822d6581 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java @@ -90,23 +90,23 @@ interface PersonGroupPersonsService { Observable> update(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Header("accept-language") String acceptLanguage, @Body NameAndUserDataContract body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons deleteFace" }) - @HTTP(path = "persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}", method = "DELETE", hasBody = true) + @HTTP(path = "persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", method = "DELETE", hasBody = true) Observable> deleteFace(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons getFace" }) - @GET("persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") + @GET("persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") Observable> getFace(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons updateFace" }) - @PATCH("persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}") + @PATCH("persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") Observable> updateFace(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addPersonFaceFromUrl" }) - @POST("persongroups/{personGroupId}/persons/{personId}/persistedFaces") + @POST("persongroups/{personGroupId}/persons/{personId}/persistedfaces") Observable> addPersonFaceFromUrl(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addPersonFaceFromStream" }) - @POST("persongroups/{personGroupId}/persons/{personId}/persistedFaces") + @POST("persongroups/{personGroupId}/persons/{personId}/persistedfaces") Observable> addPersonFaceFromStream(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } From a32c47d86efd9f01d2df3a416c42bcfd1ed2060a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 1 Aug 2018 00:36:11 +0000 Subject: [PATCH 3/5] Generated from 40abfc7205d1bf373e19dca40394598fa9da4843 Fix LargeFaceListFace_List to LargeFaceList_ListFaces and refine example naming. --- .../vision/faceapi/FaceClient.java | 6 - .../vision/faceapi/LargeFaceLists.java | 85 +++++++++ .../implementation/FaceClientImpl.java | 15 -- .../implementation/LargeFaceListsImpl.java | 161 ++++++++++++++++++ 4 files changed, 246 insertions(+), 21 deletions(-) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java index 0a8249f5b1981..389c74a4585f7 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/FaceClient.java @@ -137,10 +137,4 @@ public interface FaceClient { */ LargeFaceLists largeFaceLists(); - /** - * Gets the LargeFaceListFaces object to access its operations. - * @return the LargeFaceListFaces object. - */ - LargeFaceListFaces largeFaceListFaces(); - } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java index d59e6b422dceb..4256b37daf136 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargeFaceLists.java @@ -645,6 +645,91 @@ public interface LargeFaceLists { */ Observable> addFaceFromUrlWithServiceResponseAsync(String largeFaceListId, String url, String userData, List targetFace); + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + List listFaces(String largeFaceListId); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listFacesAsync(String largeFaceListId, final ServiceCallback> serviceCallback); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable> listFacesAsync(String largeFaceListId); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable>> listFacesWithServiceResponseAsync(String largeFaceListId); + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + List listFaces(String largeFaceListId, String start, Integer top); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture> listFacesAsync(String largeFaceListId, String start, Integer top, final ServiceCallback> serviceCallback); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable> listFacesAsync(String largeFaceListId, String start, Integer top); + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + Observable>> listFacesWithServiceResponseAsync(String largeFaceListId, String start, Integer top); + /** * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. * diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java index 90d26a8e9a114..8da3d678fc2bd 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceClientImpl.java @@ -13,7 +13,6 @@ import com.microsoft.azure.cognitiveservices.vision.faceapi.FaceClient; import com.microsoft.azure.cognitiveservices.vision.faceapi.FaceLists; import com.microsoft.azure.cognitiveservices.vision.faceapi.Faces; -import com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceListFaces; import com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists; import com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons; import com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroups; @@ -220,19 +219,6 @@ public LargeFaceLists largeFaceLists() { return this.largeFaceLists; } - /** - * The LargeFaceListFaces object to access its operations. - */ - private LargeFaceListFaces largeFaceListFaces; - - /** - * Gets the LargeFaceListFaces object to access its operations. - * @return the LargeFaceListFaces object. - */ - public LargeFaceListFaces largeFaceListFaces() { - return this.largeFaceListFaces; - } - /** * Initializes an instance of FaceClient client. * @@ -274,7 +260,6 @@ protected void initialize() { this.largePersonGroupPersons = new LargePersonGroupPersonsImpl(restClient().retrofit(), this); this.largePersonGroups = new LargePersonGroupsImpl(restClient().retrofit(), this); this.largeFaceLists = new LargeFaceListsImpl(restClient().retrofit(), this); - this.largeFaceListFaces = new LargeFaceListFacesImpl(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java index 7975424c937c1..8b5c0383566a6 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargeFaceListsImpl.java @@ -115,6 +115,10 @@ interface LargeFaceListsService { @POST("largefacelists/{largeFaceListId}/persistedfaces") Observable> addFaceFromUrl(@Path("largeFaceListId") String largeFaceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists listFaces" }) + @GET("largefacelists/{largeFaceListId}/persistedfaces") + Observable> listFaces(@Path("largeFaceListId") String largeFaceListId, @Query("start") String start, @Query("top") Integer top, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargeFaceLists addFaceFromStream" }) @POST("largefacelists/{largeFaceListId}/persistedfaces") Observable> addFaceFromStream(@Path("largeFaceListId") String largeFaceListId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @@ -1332,6 +1336,163 @@ private ServiceResponse addFaceFromUrlDelegate(Response listFaces(String largeFaceListId) { + return listFacesWithServiceResponseAsync(largeFaceListId).toBlocking().single().body(); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listFacesAsync(String largeFaceListId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listFacesWithServiceResponseAsync(largeFaceListId), serviceCallback); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable> listFacesAsync(String largeFaceListId) { + return listFacesWithServiceResponseAsync(largeFaceListId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable>> listFacesWithServiceResponseAsync(String largeFaceListId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + final String start = null; + final Integer top = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.listFaces(largeFaceListId, start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listFacesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws APIErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<PersistedFace> object if successful. + */ + public List listFaces(String largeFaceListId, String start, Integer top) { + return listFacesWithServiceResponseAsync(largeFaceListId, start, top).toBlocking().single().body(); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listFacesAsync(String largeFaceListId, String start, Integer top, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listFacesWithServiceResponseAsync(largeFaceListId, start, top), serviceCallback); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable> listFacesAsync(String largeFaceListId, String start, Integer top) { + return listFacesWithServiceResponseAsync(largeFaceListId, start, top).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face). + * + * @param largeFaceListId Id referencing a particular large face list. + * @param start Starting face id to return (used to list a range of faces). + * @param top Number of faces to return starting with the face id indicated by the 'start' parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PersistedFace> object + */ + public Observable>> listFacesWithServiceResponseAsync(String largeFaceListId, String start, Integer top) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (largeFaceListId == null) { + throw new IllegalArgumentException("Parameter largeFaceListId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.listFaces(largeFaceListId, start, top, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listFacesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listFacesDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., APIErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(APIErrorException.class) + .build(response); + } + /** * Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. * From d5151b0b9652968b2cbf250fd0ec355e6798531b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 1 Aug 2018 08:16:22 +0000 Subject: [PATCH 4/5] Generated from 6019c551df19f24b8a70a2c9d8f691b43cf7f195 [Minor] Person_AddPersonFace to Person_AddFace. --- .../faceapi/LargePersonGroupPersons.java | 16 +++---- .../vision/faceapi/PersonGroupPersons.java | 16 +++---- .../LargePersonGroupPersonsImpl.java | 42 +++++++++---------- .../PersonGroupPersonsImpl.java | 42 +++++++++---------- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java index 77b1ee374570f..d3bab7935e03e 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java @@ -569,7 +569,7 @@ public interface LargePersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url); + PersistedFace addFaceFromUrl(String largePersonGroupId, UUID personId, String url); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -581,7 +581,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -592,7 +592,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url); + Observable addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -603,7 +603,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url); + Observable> addFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. * @@ -617,7 +617,7 @@ public interface LargePersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); + PersistedFace addFaceFromUrl(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -631,7 +631,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -644,7 +644,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); + Observable addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -657,7 +657,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); + Observable> addFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java index a5fc95181927a..f8519485678aa 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java @@ -569,7 +569,7 @@ public interface PersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, String url); + PersistedFace addFaceFromUrl(String personGroupId, UUID personId, String url); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -581,7 +581,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromUrlAsync(String personGroupId, UUID personId, String url, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -592,7 +592,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url); + Observable addFaceFromUrlAsync(String personGroupId, UUID personId, String url); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -603,7 +603,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url); + Observable> addFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. * @@ -617,7 +617,7 @@ public interface PersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, String url, String userData, List targetFace); + PersistedFace addFaceFromUrl(String personGroupId, UUID personId, String url, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -631,7 +631,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -644,7 +644,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace); + Observable addFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -657,7 +657,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, String userData, List targetFace); + Observable> addFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java index 1c57f7d95a413..177309f2ccadb 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java @@ -101,9 +101,9 @@ interface LargePersonGroupPersonsService { @PATCH("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") Observable> updateFace(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromUrl" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addFaceFromUrl" }) @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") - Observable> addPersonFaceFromUrl(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> addFaceFromUrl(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromStream" }) @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") @@ -1147,8 +1147,8 @@ private ServiceResponse updateFaceDelegate(Response response * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - public PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url) { - return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url).toBlocking().single().body(); + public PersistedFace addFaceFromUrl(String largePersonGroupId, UUID personId, String url) { + return addFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url).toBlocking().single().body(); } /** @@ -1161,8 +1161,8 @@ public PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID person * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url), serviceCallback); + public ServiceFuture addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url), serviceCallback); } /** @@ -1174,8 +1174,8 @@ public ServiceFuture addPersonFaceFromUrlAsync(String largePerson * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url) { - return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url).map(new Func1, PersistedFace>() { + public Observable addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url) { + return addFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1192,7 +1192,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url) { + public Observable> addFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1211,12 +1211,12 @@ public Observable> addPersonFaceFromUrlWithServic imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); - return service.addPersonFaceFromUrl(largePersonGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + return service.addFaceFromUrl(largePersonGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromUrlDelegate(response); + ServiceResponse clientResponse = addFaceFromUrlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1238,8 +1238,8 @@ public Observable> call(Response re * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - public PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { - return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace).toBlocking().single().body(); + public PersistedFace addFaceFromUrl(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { + return addFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace).toBlocking().single().body(); } /** @@ -1254,8 +1254,8 @@ public PersistedFace addPersonFaceFromUrl(String largePersonGroupId, UUID person * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace), serviceCallback); + public ServiceFuture addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace), serviceCallback); } /** @@ -1269,8 +1269,8 @@ public ServiceFuture addPersonFaceFromUrlAsync(String largePerson * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { - return addPersonFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace).map(new Func1, PersistedFace>() { + public Observable addFaceFromUrlAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { + return addFaceFromUrlWithServiceResponseAsync(largePersonGroupId, personId, url, userData, targetFace).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1289,7 +1289,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { + public Observable> addFaceFromUrlWithServiceResponseAsync(String largePersonGroupId, UUID personId, String url, String userData, List targetFace) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1307,12 +1307,12 @@ public Observable> addPersonFaceFromUrlWithServic imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); - return service.addPersonFaceFromUrl(largePersonGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + return service.addFaceFromUrl(largePersonGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromUrlDelegate(response); + ServiceResponse clientResponse = addFaceFromUrlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1321,7 +1321,7 @@ public Observable> call(Response re }); } - private ServiceResponse addPersonFaceFromUrlDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + private ServiceResponse addFaceFromUrlDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(APIErrorException.class) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java index 6d5df822d6581..cdc8124a74deb 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java @@ -101,9 +101,9 @@ interface PersonGroupPersonsService { @PATCH("persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}") Observable> updateFace(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Path("persistedFaceId") UUID persistedFaceId, @Header("accept-language") String acceptLanguage, @Body UpdateFaceRequest body, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addPersonFaceFromUrl" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addFaceFromUrl" }) @POST("persongroups/{personGroupId}/persons/{personId}/persistedfaces") - Observable> addPersonFaceFromUrl(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> addFaceFromUrl(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addPersonFaceFromStream" }) @POST("persongroups/{personGroupId}/persons/{personId}/persistedfaces") @@ -1147,8 +1147,8 @@ private ServiceResponse updateFaceDelegate(Response response * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - public PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, String url) { - return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url).toBlocking().single().body(); + public PersistedFace addFaceFromUrl(String personGroupId, UUID personId, String url) { + return addFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url).toBlocking().single().body(); } /** @@ -1161,8 +1161,8 @@ public PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, S * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url), serviceCallback); + public ServiceFuture addFaceFromUrlAsync(String personGroupId, UUID personId, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url), serviceCallback); } /** @@ -1174,8 +1174,8 @@ public ServiceFuture addPersonFaceFromUrlAsync(String personGroup * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url) { - return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url).map(new Func1, PersistedFace>() { + public Observable addFaceFromUrlAsync(String personGroupId, UUID personId, String url) { + return addFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1192,7 +1192,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url) { + public Observable> addFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1211,12 +1211,12 @@ public Observable> addPersonFaceFromUrlWithServic imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); - return service.addPersonFaceFromUrl(personGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + return service.addFaceFromUrl(personGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromUrlDelegate(response); + ServiceResponse clientResponse = addFaceFromUrlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1238,8 +1238,8 @@ public Observable> call(Response re * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - public PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, String url, String userData, List targetFace) { - return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace).toBlocking().single().body(); + public PersistedFace addFaceFromUrl(String personGroupId, UUID personId, String url, String userData, List targetFace) { + return addFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace).toBlocking().single().body(); } /** @@ -1254,8 +1254,8 @@ public PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, S * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace), serviceCallback); + public ServiceFuture addFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace), serviceCallback); } /** @@ -1269,8 +1269,8 @@ public ServiceFuture addPersonFaceFromUrlAsync(String personGroup * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace) { - return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace).map(new Func1, PersistedFace>() { + public Observable addFaceFromUrlAsync(String personGroupId, UUID personId, String url, String userData, List targetFace) { + return addFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1289,7 +1289,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, String userData, List targetFace) { + public Observable> addFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, String userData, List targetFace) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1307,12 +1307,12 @@ public Observable> addPersonFaceFromUrlWithServic imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); - return service.addPersonFaceFromUrl(personGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + return service.addFaceFromUrl(personGroupId, personId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromUrlDelegate(response); + ServiceResponse clientResponse = addFaceFromUrlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1321,7 +1321,7 @@ public Observable> call(Response re }); } - private ServiceResponse addPersonFaceFromUrlDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + private ServiceResponse addFaceFromUrlDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(APIErrorException.class) From 0d232f3a76f9e1d5224ac6b708fb797e880a4e7d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 1 Aug 2018 08:21:42 +0000 Subject: [PATCH 5/5] Generated from a43b96d1f8ebea7d96449c4fa459519b0c48335e [Minor] Amend last commit of Person_AddPersonFace to Person_AddFace. --- .../faceapi/LargePersonGroupPersons.java | 16 +++---- .../vision/faceapi/PersonGroupPersons.java | 16 +++---- .../LargePersonGroupPersonsImpl.java | 42 +++++++++---------- .../PersonGroupPersonsImpl.java | 42 +++++++++---------- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java index d3bab7935e03e..42c58b38b6284 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/LargePersonGroupPersons.java @@ -670,7 +670,7 @@ public interface LargePersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image); + PersistedFace addFaceFromStream(String largePersonGroupId, UUID personId, byte[] image); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -682,7 +682,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -693,7 +693,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image); + Observable addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -704,7 +704,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image); + Observable> addFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. * @@ -718,7 +718,7 @@ public interface LargePersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); + PersistedFace addFaceFromStream(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -732,7 +732,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -745,7 +745,7 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); + Observable addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -758,6 +758,6 @@ public interface LargePersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); + Observable> addFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java index f8519485678aa..22ab0c2391e0b 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/PersonGroupPersons.java @@ -670,7 +670,7 @@ public interface PersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromStream(String personGroupId, UUID personId, byte[] image); + PersistedFace addFaceFromStream(String personGroupId, UUID personId, byte[] image); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -682,7 +682,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -693,7 +693,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image); + Observable addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -704,7 +704,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image); + Observable> addFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. * @@ -718,7 +718,7 @@ public interface PersonGroupPersons { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - PersistedFace addPersonFaceFromStream(String personGroupId, UUID personId, byte[] image, String userData, List targetFace); + PersistedFace addFaceFromStream(String personGroupId, UUID personId, byte[] image, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -732,7 +732,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback); + ServiceFuture addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -745,7 +745,7 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace); + Observable addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace); /** * Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -758,6 +758,6 @@ public interface PersonGroupPersons { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - Observable> addPersonFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace); + Observable> addFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace); } diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java index 177309f2ccadb..b0eeb13a2c9cf 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/LargePersonGroupPersonsImpl.java @@ -105,9 +105,9 @@ interface LargePersonGroupPersonsService { @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") Observable> addFaceFromUrl(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addPersonFaceFromStream" }) + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.LargePersonGroupPersons addFaceFromStream" }) @POST("largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces") - Observable> addPersonFaceFromStream(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> addFaceFromStream(@Path("largePersonGroupId") String largePersonGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } @@ -1339,8 +1339,8 @@ private ServiceResponse addFaceFromUrlDelegate(Response addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image), serviceCallback); + public ServiceFuture addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image), serviceCallback); } /** @@ -1366,8 +1366,8 @@ public ServiceFuture addPersonFaceFromStreamAsync(String largePer * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image) { - return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image).map(new Func1, PersistedFace>() { + public Observable addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image) { + return addFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1384,7 +1384,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image) { + public Observable> addFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1401,12 +1401,12 @@ public Observable> addPersonFaceFromStreamWithSer final List targetFace = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.addPersonFaceFromStream(largePersonGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + return service.addFaceFromStream(largePersonGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromStreamDelegate(response); + ServiceResponse clientResponse = addFaceFromStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1428,8 +1428,8 @@ public Observable> call(Response re * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - public PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { - return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace).toBlocking().single().body(); + public PersistedFace addFaceFromStream(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { + return addFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace).toBlocking().single().body(); } /** @@ -1444,8 +1444,8 @@ public PersistedFace addPersonFaceFromStream(String largePersonGroupId, UUID per * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace), serviceCallback); + public ServiceFuture addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace), serviceCallback); } /** @@ -1459,8 +1459,8 @@ public ServiceFuture addPersonFaceFromStreamAsync(String largePer * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { - return addPersonFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace).map(new Func1, PersistedFace>() { + public Observable addFaceFromStreamAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { + return addFaceFromStreamWithServiceResponseAsync(largePersonGroupId, personId, image, userData, targetFace).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1479,7 +1479,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { + public Observable> addFaceFromStreamWithServiceResponseAsync(String largePersonGroupId, UUID personId, byte[] image, String userData, List targetFace) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1495,12 +1495,12 @@ public Observable> addPersonFaceFromStreamWithSer Validator.validate(targetFace); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.addPersonFaceFromStream(largePersonGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + return service.addFaceFromStream(largePersonGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromStreamDelegate(response); + ServiceResponse clientResponse = addFaceFromStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1509,7 +1509,7 @@ public Observable> call(Response re }); } - private ServiceResponse addPersonFaceFromStreamDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + private ServiceResponse addFaceFromStreamDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(APIErrorException.class) diff --git a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java index cdc8124a74deb..a811c75958313 100644 --- a/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java +++ b/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java @@ -105,9 +105,9 @@ interface PersonGroupPersonsService { @POST("persongroups/{personGroupId}/persons/{personId}/persistedfaces") Observable> addFaceFromUrl(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addPersonFaceFromStream" }) + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.faceapi.PersonGroupPersons addFaceFromStream" }) @POST("persongroups/{personGroupId}/persons/{personId}/persistedfaces") - Observable> addPersonFaceFromStream(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> addFaceFromStream(@Path("personGroupId") String personGroupId, @Path("personId") UUID personId, @Query("userData") String userData, @Query("targetFace") String targetFace, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } @@ -1339,8 +1339,8 @@ private ServiceResponse addFaceFromUrlDelegate(Response addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image), serviceCallback); + public ServiceFuture addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image), serviceCallback); } /** @@ -1366,8 +1366,8 @@ public ServiceFuture addPersonFaceFromStreamAsync(String personGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image) { - return addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image).map(new Func1, PersistedFace>() { + public Observable addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image) { + return addFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1384,7 +1384,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image) { + public Observable> addFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1401,12 +1401,12 @@ public Observable> addPersonFaceFromStreamWithSer final List targetFace = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.addPersonFaceFromStream(personGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + return service.addFaceFromStream(personGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromStreamDelegate(response); + ServiceResponse clientResponse = addFaceFromStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1428,8 +1428,8 @@ public Observable> call(Response re * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PersistedFace object if successful. */ - public PersistedFace addPersonFaceFromStream(String personGroupId, UUID personId, byte[] image, String userData, List targetFace) { - return addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, userData, targetFace).toBlocking().single().body(); + public PersistedFace addFaceFromStream(String personGroupId, UUID personId, byte[] image, String userData, List targetFace) { + return addFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, userData, targetFace).toBlocking().single().body(); } /** @@ -1444,8 +1444,8 @@ public PersistedFace addPersonFaceFromStream(String personGroupId, UUID personId * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, userData, targetFace), serviceCallback); + public ServiceFuture addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, userData, targetFace), serviceCallback); } /** @@ -1459,8 +1459,8 @@ public ServiceFuture addPersonFaceFromStreamAsync(String personGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable addPersonFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace) { - return addPersonFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, userData, targetFace).map(new Func1, PersistedFace>() { + public Observable addFaceFromStreamAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace) { + return addFaceFromStreamWithServiceResponseAsync(personGroupId, personId, image, userData, targetFace).map(new Func1, PersistedFace>() { @Override public PersistedFace call(ServiceResponse response) { return response.body(); @@ -1479,7 +1479,7 @@ public PersistedFace call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PersistedFace object */ - public Observable> addPersonFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace) { + public Observable> addFaceFromStreamWithServiceResponseAsync(String personGroupId, UUID personId, byte[] image, String userData, List targetFace) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } @@ -1495,12 +1495,12 @@ public Observable> addPersonFaceFromStreamWithSer Validator.validate(targetFace); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.addPersonFaceFromStream(personGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + return service.addFaceFromStream(personGroupId, personId, userData, targetFaceConverted, imageConverted, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addPersonFaceFromStreamDelegate(response); + ServiceResponse clientResponse = addFaceFromStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1509,7 +1509,7 @@ public Observable> call(Response re }); } - private ServiceResponse addPersonFaceFromStreamDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { + private ServiceResponse addFaceFromStreamDelegate(Response response) throws APIErrorException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(APIErrorException.class)