1package face 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "github.com/satori/go.uuid" 27 "io" 28 "net/http" 29) 30 31// PersonGroupPersonClient is the an API for face detection, verification, and identification. 32type PersonGroupPersonClient struct { 33 BaseClient 34} 35 36// NewPersonGroupPersonClient creates an instance of the PersonGroupPersonClient client. 37func NewPersonGroupPersonClient(endpoint string) PersonGroupPersonClient { 38 return PersonGroupPersonClient{New(endpoint)} 39} 40 41// AddFaceFromStream add a face to a person into a person group for face identification or verification. To deal with 42// an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a 43// persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored 44// on server until [PersonGroup PersonFace - 45// Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/deleteface), [PersonGroup 46// Person - Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/delete) or 47// [PersonGroup - Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroup/delete) is called. 48// <br /> Note persistedFaceId is different from faceId generated by [Face - 49// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl). 50// * Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, 51// clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. 52// * Each person entry can hold up to 248 faces. 53// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB. 54// * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the 55// provided "targetFace" rectangle is not returned from [Face - 56// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl), there’s no guarantee to 57// detect and add the face successfully. 58// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause 59// failures. 60// * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from 61// different persons are processed in parallel. 62// * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with 63// dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size. 64// * Different 'detectionModel' values can be provided. To use and compare different detection models, please refer to 65// [How to specify a detection 66// model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) 67// | Model | Recommended use-case(s) | 68// | ---------- | -------- | 69// | 'detection_01': | The default detection model for [PersonGroup Person - Add 70// Face](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/addfacefromurl). Recommend for 71// near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong 72// image orientation, the faces in such cases may not be detected. | 73// | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry 74// faces. | 75// Parameters: 76// personGroupID - id referencing a particular person group. 77// personID - id referencing a particular person. 78// imageParameter - an image stream. 79// userData - user-specified data about the face for any purpose. The maximum length is 1KB. 80// targetFace - a face rectangle to specify the target face to be added to a person in the format of 81// "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the 82// image, targetFace is required to specify which face to add. No targetFace means there is only one face 83// detected in the entire image. 84// detectionModel - name of detection model. Detection model is used to detect faces in the submitted image. A 85// detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or 86// (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please 87// explicitly specify it. 88func (client PersonGroupPersonClient) AddFaceFromStream(ctx context.Context, personGroupID string, personID uuid.UUID, imageParameter io.ReadCloser, userData string, targetFace []int32, detectionModel DetectionModel) (result PersistedFace, err error) { 89 if tracing.IsEnabled() { 90 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.AddFaceFromStream") 91 defer func() { 92 sc := -1 93 if result.Response.Response != nil { 94 sc = result.Response.Response.StatusCode 95 } 96 tracing.EndSpan(ctx, sc, err) 97 }() 98 } 99 if err := validation.Validate([]validation.Validation{ 100 {TargetValue: personGroupID, 101 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 102 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}, 103 {TargetValue: userData, 104 Constraints: []validation.Constraint{{Target: "userData", Name: validation.Empty, Rule: false, 105 Chain: []validation.Constraint{{Target: "userData", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}}}}); err != nil { 106 return result, validation.NewError("face.PersonGroupPersonClient", "AddFaceFromStream", err.Error()) 107 } 108 109 req, err := client.AddFaceFromStreamPreparer(ctx, personGroupID, personID, imageParameter, userData, targetFace, detectionModel) 110 if err != nil { 111 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "AddFaceFromStream", nil, "Failure preparing request") 112 return 113 } 114 115 resp, err := client.AddFaceFromStreamSender(req) 116 if err != nil { 117 result.Response = autorest.Response{Response: resp} 118 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "AddFaceFromStream", resp, "Failure sending request") 119 return 120 } 121 122 result, err = client.AddFaceFromStreamResponder(resp) 123 if err != nil { 124 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "AddFaceFromStream", resp, "Failure responding to request") 125 } 126 127 return 128} 129 130// AddFaceFromStreamPreparer prepares the AddFaceFromStream request. 131func (client PersonGroupPersonClient) AddFaceFromStreamPreparer(ctx context.Context, personGroupID string, personID uuid.UUID, imageParameter io.ReadCloser, userData string, targetFace []int32, detectionModel DetectionModel) (*http.Request, error) { 132 urlParameters := map[string]interface{}{ 133 "Endpoint": client.Endpoint, 134 } 135 136 pathParameters := map[string]interface{}{ 137 "personGroupId": autorest.Encode("path", personGroupID), 138 "personId": autorest.Encode("path", personID), 139 } 140 141 queryParameters := map[string]interface{}{} 142 if len(userData) > 0 { 143 queryParameters["userData"] = autorest.Encode("query", userData) 144 } 145 if targetFace != nil && len(targetFace) > 0 { 146 queryParameters["targetFace"] = autorest.Encode("query", targetFace, ",") 147 } 148 if len(string(detectionModel)) > 0 { 149 queryParameters["detectionModel"] = autorest.Encode("query", detectionModel) 150 } else { 151 queryParameters["detectionModel"] = autorest.Encode("query", "detection_01") 152 } 153 154 preparer := autorest.CreatePreparer( 155 autorest.AsContentType("application/octet-stream"), 156 autorest.AsPost(), 157 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 158 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}/persistedfaces", pathParameters), 159 autorest.WithFile(imageParameter), 160 autorest.WithQueryParameters(queryParameters)) 161 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 162} 163 164// AddFaceFromStreamSender sends the AddFaceFromStream request. The method will close the 165// http.Response Body if it receives an error. 166func (client PersonGroupPersonClient) AddFaceFromStreamSender(req *http.Request) (*http.Response, error) { 167 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 168} 169 170// AddFaceFromStreamResponder handles the response to the AddFaceFromStream request. The method always 171// closes the http.Response Body. 172func (client PersonGroupPersonClient) AddFaceFromStreamResponder(resp *http.Response) (result PersistedFace, err error) { 173 err = autorest.Respond( 174 resp, 175 client.ByInspecting(), 176 azure.WithErrorUnlessStatusCode(http.StatusOK), 177 autorest.ByUnmarshallingJSON(&result), 178 autorest.ByClosing()) 179 result.Response = autorest.Response{Response: resp} 180 return 181} 182 183// AddFaceFromURL add a face to a person into a person group for face identification or verification. To deal with an 184// image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a 185// persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored 186// on server until [PersonGroup PersonFace - 187// Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/deleteface), [PersonGroup 188// Person - Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/delete) or 189// [PersonGroup - Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroup/delete) is called. 190// <br /> Note persistedFaceId is different from faceId generated by [Face - 191// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl). 192// * Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, 193// clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. 194// * Each person entry can hold up to 248 faces. 195// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB. 196// * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the 197// provided "targetFace" rectangle is not returned from [Face - 198// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl), there’s no guarantee to 199// detect and add the face successfully. 200// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause 201// failures. 202// * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from 203// different persons are processed in parallel. 204// * The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with 205// dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size. 206// * Different 'detectionModel' values can be provided. To use and compare different detection models, please refer to 207// [How to specify a detection 208// model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) 209// | Model | Recommended use-case(s) | 210// | ---------- | -------- | 211// | 'detection_01': | The default detection model for [PersonGroup Person - Add 212// Face](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/addfacefromurl). Recommend for 213// near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong 214// image orientation, the faces in such cases may not be detected. | 215// | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry 216// faces. | 217// Parameters: 218// personGroupID - id referencing a particular person group. 219// personID - id referencing a particular person. 220// imageURL - a JSON document with a URL pointing to the image that is to be analyzed. 221// userData - user-specified data about the face for any purpose. The maximum length is 1KB. 222// targetFace - a face rectangle to specify the target face to be added to a person in the format of 223// "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the 224// image, targetFace is required to specify which face to add. No targetFace means there is only one face 225// detected in the entire image. 226// detectionModel - name of detection model. Detection model is used to detect faces in the submitted image. A 227// detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or 228// (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please 229// explicitly specify it. 230func (client PersonGroupPersonClient) AddFaceFromURL(ctx context.Context, personGroupID string, personID uuid.UUID, imageURL ImageURL, userData string, targetFace []int32, detectionModel DetectionModel) (result PersistedFace, err error) { 231 if tracing.IsEnabled() { 232 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.AddFaceFromURL") 233 defer func() { 234 sc := -1 235 if result.Response.Response != nil { 236 sc = result.Response.Response.StatusCode 237 } 238 tracing.EndSpan(ctx, sc, err) 239 }() 240 } 241 if err := validation.Validate([]validation.Validation{ 242 {TargetValue: personGroupID, 243 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 244 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}, 245 {TargetValue: userData, 246 Constraints: []validation.Constraint{{Target: "userData", Name: validation.Empty, Rule: false, 247 Chain: []validation.Constraint{{Target: "userData", Name: validation.MaxLength, Rule: 1024, Chain: nil}}}}}, 248 {TargetValue: imageURL, 249 Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { 250 return result, validation.NewError("face.PersonGroupPersonClient", "AddFaceFromURL", err.Error()) 251 } 252 253 req, err := client.AddFaceFromURLPreparer(ctx, personGroupID, personID, imageURL, userData, targetFace, detectionModel) 254 if err != nil { 255 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "AddFaceFromURL", nil, "Failure preparing request") 256 return 257 } 258 259 resp, err := client.AddFaceFromURLSender(req) 260 if err != nil { 261 result.Response = autorest.Response{Response: resp} 262 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "AddFaceFromURL", resp, "Failure sending request") 263 return 264 } 265 266 result, err = client.AddFaceFromURLResponder(resp) 267 if err != nil { 268 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "AddFaceFromURL", resp, "Failure responding to request") 269 } 270 271 return 272} 273 274// AddFaceFromURLPreparer prepares the AddFaceFromURL request. 275func (client PersonGroupPersonClient) AddFaceFromURLPreparer(ctx context.Context, personGroupID string, personID uuid.UUID, imageURL ImageURL, userData string, targetFace []int32, detectionModel DetectionModel) (*http.Request, error) { 276 urlParameters := map[string]interface{}{ 277 "Endpoint": client.Endpoint, 278 } 279 280 pathParameters := map[string]interface{}{ 281 "personGroupId": autorest.Encode("path", personGroupID), 282 "personId": autorest.Encode("path", personID), 283 } 284 285 queryParameters := map[string]interface{}{} 286 if len(userData) > 0 { 287 queryParameters["userData"] = autorest.Encode("query", userData) 288 } 289 if targetFace != nil && len(targetFace) > 0 { 290 queryParameters["targetFace"] = autorest.Encode("query", targetFace, ",") 291 } 292 if len(string(detectionModel)) > 0 { 293 queryParameters["detectionModel"] = autorest.Encode("query", detectionModel) 294 } else { 295 queryParameters["detectionModel"] = autorest.Encode("query", "detection_01") 296 } 297 298 preparer := autorest.CreatePreparer( 299 autorest.AsContentType("application/json; charset=utf-8"), 300 autorest.AsPost(), 301 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 302 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}/persistedfaces", pathParameters), 303 autorest.WithJSON(imageURL), 304 autorest.WithQueryParameters(queryParameters)) 305 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 306} 307 308// AddFaceFromURLSender sends the AddFaceFromURL request. The method will close the 309// http.Response Body if it receives an error. 310func (client PersonGroupPersonClient) AddFaceFromURLSender(req *http.Request) (*http.Response, error) { 311 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 312} 313 314// AddFaceFromURLResponder handles the response to the AddFaceFromURL request. The method always 315// closes the http.Response Body. 316func (client PersonGroupPersonClient) AddFaceFromURLResponder(resp *http.Response) (result PersistedFace, err error) { 317 err = autorest.Respond( 318 resp, 319 client.ByInspecting(), 320 azure.WithErrorUnlessStatusCode(http.StatusOK), 321 autorest.ByUnmarshallingJSON(&result), 322 autorest.ByClosing()) 323 result.Response = autorest.Response{Response: resp} 324 return 325} 326 327// Create create a new person in a specified person group. 328// Parameters: 329// personGroupID - id referencing a particular person group. 330// body - request body for creating new person. 331func (client PersonGroupPersonClient) Create(ctx context.Context, personGroupID string, body NameAndUserDataContract) (result Person, err error) { 332 if tracing.IsEnabled() { 333 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.Create") 334 defer func() { 335 sc := -1 336 if result.Response.Response != nil { 337 sc = result.Response.Response.StatusCode 338 } 339 tracing.EndSpan(ctx, sc, err) 340 }() 341 } 342 if err := validation.Validate([]validation.Validation{ 343 {TargetValue: personGroupID, 344 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 345 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}, 346 {TargetValue: body, 347 Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: false, 348 Chain: []validation.Constraint{{Target: "body.Name", Name: validation.MaxLength, Rule: 128, Chain: nil}}}, 349 {Target: "body.UserData", Name: validation.Null, Rule: false, 350 Chain: []validation.Constraint{{Target: "body.UserData", Name: validation.MaxLength, Rule: 16384, Chain: nil}}}}}}); err != nil { 351 return result, validation.NewError("face.PersonGroupPersonClient", "Create", err.Error()) 352 } 353 354 req, err := client.CreatePreparer(ctx, personGroupID, body) 355 if err != nil { 356 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Create", nil, "Failure preparing request") 357 return 358 } 359 360 resp, err := client.CreateSender(req) 361 if err != nil { 362 result.Response = autorest.Response{Response: resp} 363 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Create", resp, "Failure sending request") 364 return 365 } 366 367 result, err = client.CreateResponder(resp) 368 if err != nil { 369 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Create", resp, "Failure responding to request") 370 } 371 372 return 373} 374 375// CreatePreparer prepares the Create request. 376func (client PersonGroupPersonClient) CreatePreparer(ctx context.Context, personGroupID string, body NameAndUserDataContract) (*http.Request, error) { 377 urlParameters := map[string]interface{}{ 378 "Endpoint": client.Endpoint, 379 } 380 381 pathParameters := map[string]interface{}{ 382 "personGroupId": autorest.Encode("path", personGroupID), 383 } 384 385 preparer := autorest.CreatePreparer( 386 autorest.AsContentType("application/json; charset=utf-8"), 387 autorest.AsPost(), 388 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 389 autorest.WithPathParameters("/persongroups/{personGroupId}/persons", pathParameters), 390 autorest.WithJSON(body)) 391 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 392} 393 394// CreateSender sends the Create request. The method will close the 395// http.Response Body if it receives an error. 396func (client PersonGroupPersonClient) CreateSender(req *http.Request) (*http.Response, error) { 397 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 398} 399 400// CreateResponder handles the response to the Create request. The method always 401// closes the http.Response Body. 402func (client PersonGroupPersonClient) CreateResponder(resp *http.Response) (result Person, err error) { 403 err = autorest.Respond( 404 resp, 405 client.ByInspecting(), 406 azure.WithErrorUnlessStatusCode(http.StatusOK), 407 autorest.ByUnmarshallingJSON(&result), 408 autorest.ByClosing()) 409 result.Response = autorest.Response{Response: resp} 410 return 411} 412 413// Delete delete an existing person from a person group. The persistedFaceId, userData, person name and face feature in 414// the person entry will all be deleted. 415// Parameters: 416// personGroupID - id referencing a particular person group. 417// personID - id referencing a particular person. 418func (client PersonGroupPersonClient) Delete(ctx context.Context, personGroupID string, personID uuid.UUID) (result autorest.Response, err error) { 419 if tracing.IsEnabled() { 420 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.Delete") 421 defer func() { 422 sc := -1 423 if result.Response != nil { 424 sc = result.Response.StatusCode 425 } 426 tracing.EndSpan(ctx, sc, err) 427 }() 428 } 429 if err := validation.Validate([]validation.Validation{ 430 {TargetValue: personGroupID, 431 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 432 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}}); err != nil { 433 return result, validation.NewError("face.PersonGroupPersonClient", "Delete", err.Error()) 434 } 435 436 req, err := client.DeletePreparer(ctx, personGroupID, personID) 437 if err != nil { 438 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Delete", nil, "Failure preparing request") 439 return 440 } 441 442 resp, err := client.DeleteSender(req) 443 if err != nil { 444 result.Response = resp 445 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Delete", resp, "Failure sending request") 446 return 447 } 448 449 result, err = client.DeleteResponder(resp) 450 if err != nil { 451 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Delete", resp, "Failure responding to request") 452 } 453 454 return 455} 456 457// DeletePreparer prepares the Delete request. 458func (client PersonGroupPersonClient) DeletePreparer(ctx context.Context, personGroupID string, personID uuid.UUID) (*http.Request, error) { 459 urlParameters := map[string]interface{}{ 460 "Endpoint": client.Endpoint, 461 } 462 463 pathParameters := map[string]interface{}{ 464 "personGroupId": autorest.Encode("path", personGroupID), 465 "personId": autorest.Encode("path", personID), 466 } 467 468 preparer := autorest.CreatePreparer( 469 autorest.AsDelete(), 470 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 471 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}", pathParameters)) 472 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 473} 474 475// DeleteSender sends the Delete request. The method will close the 476// http.Response Body if it receives an error. 477func (client PersonGroupPersonClient) DeleteSender(req *http.Request) (*http.Response, error) { 478 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 479} 480 481// DeleteResponder handles the response to the Delete request. The method always 482// closes the http.Response Body. 483func (client PersonGroupPersonClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 484 err = autorest.Respond( 485 resp, 486 client.ByInspecting(), 487 azure.WithErrorUnlessStatusCode(http.StatusOK), 488 autorest.ByClosing()) 489 result.Response = resp 490 return 491} 492 493// DeleteFace delete a face from a person in a person group by specified personGroupId, personId and persistedFaceId. 494// <br /> Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from 495// different persons are processed in parallel. 496// Parameters: 497// personGroupID - id referencing a particular person group. 498// personID - id referencing a particular person. 499// persistedFaceID - id referencing a particular persistedFaceId of an existing face. 500func (client PersonGroupPersonClient) DeleteFace(ctx context.Context, personGroupID string, personID uuid.UUID, persistedFaceID uuid.UUID) (result autorest.Response, err error) { 501 if tracing.IsEnabled() { 502 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.DeleteFace") 503 defer func() { 504 sc := -1 505 if result.Response != nil { 506 sc = result.Response.StatusCode 507 } 508 tracing.EndSpan(ctx, sc, err) 509 }() 510 } 511 if err := validation.Validate([]validation.Validation{ 512 {TargetValue: personGroupID, 513 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 514 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}}); err != nil { 515 return result, validation.NewError("face.PersonGroupPersonClient", "DeleteFace", err.Error()) 516 } 517 518 req, err := client.DeleteFacePreparer(ctx, personGroupID, personID, persistedFaceID) 519 if err != nil { 520 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "DeleteFace", nil, "Failure preparing request") 521 return 522 } 523 524 resp, err := client.DeleteFaceSender(req) 525 if err != nil { 526 result.Response = resp 527 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "DeleteFace", resp, "Failure sending request") 528 return 529 } 530 531 result, err = client.DeleteFaceResponder(resp) 532 if err != nil { 533 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "DeleteFace", resp, "Failure responding to request") 534 } 535 536 return 537} 538 539// DeleteFacePreparer prepares the DeleteFace request. 540func (client PersonGroupPersonClient) DeleteFacePreparer(ctx context.Context, personGroupID string, personID uuid.UUID, persistedFaceID uuid.UUID) (*http.Request, error) { 541 urlParameters := map[string]interface{}{ 542 "Endpoint": client.Endpoint, 543 } 544 545 pathParameters := map[string]interface{}{ 546 "persistedFaceId": autorest.Encode("path", persistedFaceID), 547 "personGroupId": autorest.Encode("path", personGroupID), 548 "personId": autorest.Encode("path", personID), 549 } 550 551 preparer := autorest.CreatePreparer( 552 autorest.AsDelete(), 553 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 554 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", pathParameters)) 555 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 556} 557 558// DeleteFaceSender sends the DeleteFace request. The method will close the 559// http.Response Body if it receives an error. 560func (client PersonGroupPersonClient) DeleteFaceSender(req *http.Request) (*http.Response, error) { 561 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 562} 563 564// DeleteFaceResponder handles the response to the DeleteFace request. The method always 565// closes the http.Response Body. 566func (client PersonGroupPersonClient) DeleteFaceResponder(resp *http.Response) (result autorest.Response, err error) { 567 err = autorest.Respond( 568 resp, 569 client.ByInspecting(), 570 azure.WithErrorUnlessStatusCode(http.StatusOK), 571 autorest.ByClosing()) 572 result.Response = resp 573 return 574} 575 576// Get retrieve a person's information, including registered persisted faces, name and userData. 577// Parameters: 578// personGroupID - id referencing a particular person group. 579// personID - id referencing a particular person. 580func (client PersonGroupPersonClient) Get(ctx context.Context, personGroupID string, personID uuid.UUID) (result Person, err error) { 581 if tracing.IsEnabled() { 582 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.Get") 583 defer func() { 584 sc := -1 585 if result.Response.Response != nil { 586 sc = result.Response.Response.StatusCode 587 } 588 tracing.EndSpan(ctx, sc, err) 589 }() 590 } 591 if err := validation.Validate([]validation.Validation{ 592 {TargetValue: personGroupID, 593 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 594 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}}); err != nil { 595 return result, validation.NewError("face.PersonGroupPersonClient", "Get", err.Error()) 596 } 597 598 req, err := client.GetPreparer(ctx, personGroupID, personID) 599 if err != nil { 600 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Get", nil, "Failure preparing request") 601 return 602 } 603 604 resp, err := client.GetSender(req) 605 if err != nil { 606 result.Response = autorest.Response{Response: resp} 607 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Get", resp, "Failure sending request") 608 return 609 } 610 611 result, err = client.GetResponder(resp) 612 if err != nil { 613 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Get", resp, "Failure responding to request") 614 } 615 616 return 617} 618 619// GetPreparer prepares the Get request. 620func (client PersonGroupPersonClient) GetPreparer(ctx context.Context, personGroupID string, personID uuid.UUID) (*http.Request, error) { 621 urlParameters := map[string]interface{}{ 622 "Endpoint": client.Endpoint, 623 } 624 625 pathParameters := map[string]interface{}{ 626 "personGroupId": autorest.Encode("path", personGroupID), 627 "personId": autorest.Encode("path", personID), 628 } 629 630 preparer := autorest.CreatePreparer( 631 autorest.AsGet(), 632 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 633 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}", pathParameters)) 634 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 635} 636 637// GetSender sends the Get request. The method will close the 638// http.Response Body if it receives an error. 639func (client PersonGroupPersonClient) GetSender(req *http.Request) (*http.Response, error) { 640 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 641} 642 643// GetResponder handles the response to the Get request. The method always 644// closes the http.Response Body. 645func (client PersonGroupPersonClient) GetResponder(resp *http.Response) (result Person, err error) { 646 err = autorest.Respond( 647 resp, 648 client.ByInspecting(), 649 azure.WithErrorUnlessStatusCode(http.StatusOK), 650 autorest.ByUnmarshallingJSON(&result), 651 autorest.ByClosing()) 652 result.Response = autorest.Response{Response: resp} 653 return 654} 655 656// GetFace retrieve information about a persisted face (specified by persistedFaceId, personId and its belonging 657// personGroupId). 658// Parameters: 659// personGroupID - id referencing a particular person group. 660// personID - id referencing a particular person. 661// persistedFaceID - id referencing a particular persistedFaceId of an existing face. 662func (client PersonGroupPersonClient) GetFace(ctx context.Context, personGroupID string, personID uuid.UUID, persistedFaceID uuid.UUID) (result PersistedFace, err error) { 663 if tracing.IsEnabled() { 664 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.GetFace") 665 defer func() { 666 sc := -1 667 if result.Response.Response != nil { 668 sc = result.Response.Response.StatusCode 669 } 670 tracing.EndSpan(ctx, sc, err) 671 }() 672 } 673 if err := validation.Validate([]validation.Validation{ 674 {TargetValue: personGroupID, 675 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 676 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}}); err != nil { 677 return result, validation.NewError("face.PersonGroupPersonClient", "GetFace", err.Error()) 678 } 679 680 req, err := client.GetFacePreparer(ctx, personGroupID, personID, persistedFaceID) 681 if err != nil { 682 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "GetFace", nil, "Failure preparing request") 683 return 684 } 685 686 resp, err := client.GetFaceSender(req) 687 if err != nil { 688 result.Response = autorest.Response{Response: resp} 689 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "GetFace", resp, "Failure sending request") 690 return 691 } 692 693 result, err = client.GetFaceResponder(resp) 694 if err != nil { 695 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "GetFace", resp, "Failure responding to request") 696 } 697 698 return 699} 700 701// GetFacePreparer prepares the GetFace request. 702func (client PersonGroupPersonClient) GetFacePreparer(ctx context.Context, personGroupID string, personID uuid.UUID, persistedFaceID uuid.UUID) (*http.Request, error) { 703 urlParameters := map[string]interface{}{ 704 "Endpoint": client.Endpoint, 705 } 706 707 pathParameters := map[string]interface{}{ 708 "persistedFaceId": autorest.Encode("path", persistedFaceID), 709 "personGroupId": autorest.Encode("path", personGroupID), 710 "personId": autorest.Encode("path", personID), 711 } 712 713 preparer := autorest.CreatePreparer( 714 autorest.AsGet(), 715 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 716 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", pathParameters)) 717 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 718} 719 720// GetFaceSender sends the GetFace request. The method will close the 721// http.Response Body if it receives an error. 722func (client PersonGroupPersonClient) GetFaceSender(req *http.Request) (*http.Response, error) { 723 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 724} 725 726// GetFaceResponder handles the response to the GetFace request. The method always 727// closes the http.Response Body. 728func (client PersonGroupPersonClient) GetFaceResponder(resp *http.Response) (result PersistedFace, err error) { 729 err = autorest.Respond( 730 resp, 731 client.ByInspecting(), 732 azure.WithErrorUnlessStatusCode(http.StatusOK), 733 autorest.ByUnmarshallingJSON(&result), 734 autorest.ByClosing()) 735 result.Response = autorest.Response{Response: resp} 736 return 737} 738 739// List list all persons in a person group, and retrieve person information (including personId, name, userData and 740// persistedFaceIds of registered faces of the person). 741// Parameters: 742// personGroupID - id referencing a particular person group. 743// start - starting person id to return (used to list a range of persons). 744// top - number of persons to return starting with the person id indicated by the 'start' parameter. 745func (client PersonGroupPersonClient) List(ctx context.Context, personGroupID string, start string, top *int32) (result ListPerson, err error) { 746 if tracing.IsEnabled() { 747 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.List") 748 defer func() { 749 sc := -1 750 if result.Response.Response != nil { 751 sc = result.Response.Response.StatusCode 752 } 753 tracing.EndSpan(ctx, sc, err) 754 }() 755 } 756 if err := validation.Validate([]validation.Validation{ 757 {TargetValue: personGroupID, 758 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 759 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}, 760 {TargetValue: top, 761 Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, 762 Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, 763 {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, 764 }}}}}); err != nil { 765 return result, validation.NewError("face.PersonGroupPersonClient", "List", err.Error()) 766 } 767 768 req, err := client.ListPreparer(ctx, personGroupID, start, top) 769 if err != nil { 770 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "List", nil, "Failure preparing request") 771 return 772 } 773 774 resp, err := client.ListSender(req) 775 if err != nil { 776 result.Response = autorest.Response{Response: resp} 777 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "List", resp, "Failure sending request") 778 return 779 } 780 781 result, err = client.ListResponder(resp) 782 if err != nil { 783 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "List", resp, "Failure responding to request") 784 } 785 786 return 787} 788 789// ListPreparer prepares the List request. 790func (client PersonGroupPersonClient) ListPreparer(ctx context.Context, personGroupID string, start string, top *int32) (*http.Request, error) { 791 urlParameters := map[string]interface{}{ 792 "Endpoint": client.Endpoint, 793 } 794 795 pathParameters := map[string]interface{}{ 796 "personGroupId": autorest.Encode("path", personGroupID), 797 } 798 799 queryParameters := map[string]interface{}{} 800 if len(start) > 0 { 801 queryParameters["start"] = autorest.Encode("query", start) 802 } 803 if top != nil { 804 queryParameters["top"] = autorest.Encode("query", *top) 805 } 806 807 preparer := autorest.CreatePreparer( 808 autorest.AsGet(), 809 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 810 autorest.WithPathParameters("/persongroups/{personGroupId}/persons", pathParameters), 811 autorest.WithQueryParameters(queryParameters)) 812 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 813} 814 815// ListSender sends the List request. The method will close the 816// http.Response Body if it receives an error. 817func (client PersonGroupPersonClient) ListSender(req *http.Request) (*http.Response, error) { 818 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 819} 820 821// ListResponder handles the response to the List request. The method always 822// closes the http.Response Body. 823func (client PersonGroupPersonClient) ListResponder(resp *http.Response) (result ListPerson, err error) { 824 err = autorest.Respond( 825 resp, 826 client.ByInspecting(), 827 azure.WithErrorUnlessStatusCode(http.StatusOK), 828 autorest.ByUnmarshallingJSON(&result.Value), 829 autorest.ByClosing()) 830 result.Response = autorest.Response{Response: resp} 831 return 832} 833 834// Update update name or userData of a person. 835// Parameters: 836// personGroupID - id referencing a particular person group. 837// personID - id referencing a particular person. 838// body - request body for person update operation. 839func (client PersonGroupPersonClient) Update(ctx context.Context, personGroupID string, personID uuid.UUID, body NameAndUserDataContract) (result autorest.Response, err error) { 840 if tracing.IsEnabled() { 841 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.Update") 842 defer func() { 843 sc := -1 844 if result.Response != nil { 845 sc = result.Response.StatusCode 846 } 847 tracing.EndSpan(ctx, sc, err) 848 }() 849 } 850 if err := validation.Validate([]validation.Validation{ 851 {TargetValue: personGroupID, 852 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 853 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}}); err != nil { 854 return result, validation.NewError("face.PersonGroupPersonClient", "Update", err.Error()) 855 } 856 857 req, err := client.UpdatePreparer(ctx, personGroupID, personID, body) 858 if err != nil { 859 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Update", nil, "Failure preparing request") 860 return 861 } 862 863 resp, err := client.UpdateSender(req) 864 if err != nil { 865 result.Response = resp 866 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Update", resp, "Failure sending request") 867 return 868 } 869 870 result, err = client.UpdateResponder(resp) 871 if err != nil { 872 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "Update", resp, "Failure responding to request") 873 } 874 875 return 876} 877 878// UpdatePreparer prepares the Update request. 879func (client PersonGroupPersonClient) UpdatePreparer(ctx context.Context, personGroupID string, personID uuid.UUID, body NameAndUserDataContract) (*http.Request, error) { 880 urlParameters := map[string]interface{}{ 881 "Endpoint": client.Endpoint, 882 } 883 884 pathParameters := map[string]interface{}{ 885 "personGroupId": autorest.Encode("path", personGroupID), 886 "personId": autorest.Encode("path", personID), 887 } 888 889 preparer := autorest.CreatePreparer( 890 autorest.AsContentType("application/json; charset=utf-8"), 891 autorest.AsPatch(), 892 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 893 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}", pathParameters), 894 autorest.WithJSON(body)) 895 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 896} 897 898// UpdateSender sends the Update request. The method will close the 899// http.Response Body if it receives an error. 900func (client PersonGroupPersonClient) UpdateSender(req *http.Request) (*http.Response, error) { 901 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 902} 903 904// UpdateResponder handles the response to the Update request. The method always 905// closes the http.Response Body. 906func (client PersonGroupPersonClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { 907 err = autorest.Respond( 908 resp, 909 client.ByInspecting(), 910 azure.WithErrorUnlessStatusCode(http.StatusOK), 911 autorest.ByClosing()) 912 result.Response = resp 913 return 914} 915 916// UpdateFace add a face to a person into a person group for face identification or verification. To deal with an image 917// contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a 918// persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored 919// on server until [PersonGroup PersonFace - 920// Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/deleteface), [PersonGroup 921// Person - Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroupperson/delete) or 922// [PersonGroup - Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/persongroup/delete) is called. 923// <br /> Note persistedFaceId is different from faceId generated by [Face - 924// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl). 925// * Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, clear, 926// and face size is 200x200 pixels (100 pixels between eyes) or bigger. 927// * Each person entry can hold up to 248 faces. 928// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB. 929// * "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the 930// provided "targetFace" rectangle is not returned from [Face - 931// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl), there’s no guarantee to 932// detect and add the face successfully. 933// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause failures. 934// * Adding/deleting faces to/from a same person will be processed sequentially. Adding/deleting faces to/from 935// different persons are processed in parallel. 936// Parameters: 937// personGroupID - id referencing a particular person group. 938// personID - id referencing a particular person. 939// persistedFaceID - id referencing a particular persistedFaceId of an existing face. 940// body - request body for updating persisted face. 941func (client PersonGroupPersonClient) UpdateFace(ctx context.Context, personGroupID string, personID uuid.UUID, persistedFaceID uuid.UUID, body UpdateFaceRequest) (result autorest.Response, err error) { 942 if tracing.IsEnabled() { 943 ctx = tracing.StartSpan(ctx, fqdn+"/PersonGroupPersonClient.UpdateFace") 944 defer func() { 945 sc := -1 946 if result.Response != nil { 947 sc = result.Response.StatusCode 948 } 949 tracing.EndSpan(ctx, sc, err) 950 }() 951 } 952 if err := validation.Validate([]validation.Validation{ 953 {TargetValue: personGroupID, 954 Constraints: []validation.Constraint{{Target: "personGroupID", Name: validation.MaxLength, Rule: 64, Chain: nil}, 955 {Target: "personGroupID", Name: validation.Pattern, Rule: `^[a-z0-9-_]+$`, Chain: nil}}}}); err != nil { 956 return result, validation.NewError("face.PersonGroupPersonClient", "UpdateFace", err.Error()) 957 } 958 959 req, err := client.UpdateFacePreparer(ctx, personGroupID, personID, persistedFaceID, body) 960 if err != nil { 961 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "UpdateFace", nil, "Failure preparing request") 962 return 963 } 964 965 resp, err := client.UpdateFaceSender(req) 966 if err != nil { 967 result.Response = resp 968 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "UpdateFace", resp, "Failure sending request") 969 return 970 } 971 972 result, err = client.UpdateFaceResponder(resp) 973 if err != nil { 974 err = autorest.NewErrorWithError(err, "face.PersonGroupPersonClient", "UpdateFace", resp, "Failure responding to request") 975 } 976 977 return 978} 979 980// UpdateFacePreparer prepares the UpdateFace request. 981func (client PersonGroupPersonClient) UpdateFacePreparer(ctx context.Context, personGroupID string, personID uuid.UUID, persistedFaceID uuid.UUID, body UpdateFaceRequest) (*http.Request, error) { 982 urlParameters := map[string]interface{}{ 983 "Endpoint": client.Endpoint, 984 } 985 986 pathParameters := map[string]interface{}{ 987 "persistedFaceId": autorest.Encode("path", persistedFaceID), 988 "personGroupId": autorest.Encode("path", personGroupID), 989 "personId": autorest.Encode("path", personID), 990 } 991 992 preparer := autorest.CreatePreparer( 993 autorest.AsContentType("application/json; charset=utf-8"), 994 autorest.AsPatch(), 995 autorest.WithCustomBaseURL("{Endpoint}/face/v1.0", urlParameters), 996 autorest.WithPathParameters("/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}", pathParameters), 997 autorest.WithJSON(body)) 998 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 999} 1000 1001// UpdateFaceSender sends the UpdateFace request. The method will close the 1002// http.Response Body if it receives an error. 1003func (client PersonGroupPersonClient) UpdateFaceSender(req *http.Request) (*http.Response, error) { 1004 return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1005} 1006 1007// UpdateFaceResponder handles the response to the UpdateFace request. The method always 1008// closes the http.Response Body. 1009func (client PersonGroupPersonClient) UpdateFaceResponder(resp *http.Response) (result autorest.Response, err error) { 1010 err = autorest.Respond( 1011 resp, 1012 client.ByInspecting(), 1013 azure.WithErrorUnlessStatusCode(http.StatusOK), 1014 autorest.ByClosing()) 1015 result.Response = resp 1016 return 1017} 1018