| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Vision.Face.Models |
| | 12 | | { |
| | 13 | | using Microsoft.Rest; |
| | 14 | | using Newtonsoft.Json; |
| | 15 | | using System.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Request body for identify face operation. |
| | 21 | | /// </summary> |
| | 22 | | public partial class IdentifyRequest |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the IdentifyRequest class. |
| | 26 | | /// </summary> |
| 4 | 27 | | public IdentifyRequest() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 4 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the IdentifyRequest class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="faceIds">Array of query faces faceIds, created by the |
| | 36 | | /// Face - Detect. Each of the faces are identified independently. The |
| | 37 | | /// valid number of faceIds is between [1, 10].</param> |
| | 38 | | /// <param name="personGroupId">PersonGroupId of the target person |
| | 39 | | /// group, created by PersonGroup - Create. Parameter personGroupId and |
| | 40 | | /// largePersonGroupId should not be provided at the same time.</param> |
| | 41 | | /// <param name="largePersonGroupId">LargePersonGroupId of the target |
| | 42 | | /// large person group, created by LargePersonGroup - Create. Parameter |
| | 43 | | /// personGroupId and largePersonGroupId should not be provided at the |
| | 44 | | /// same time.</param> |
| | 45 | | /// <param name="maxNumOfCandidatesReturned">The range of |
| | 46 | | /// maxNumOfCandidatesReturned is between 1 and 5 (default is |
| | 47 | | /// 1).</param> |
| | 48 | | /// <param name="confidenceThreshold">Confidence threshold of |
| | 49 | | /// identification, used to judge whether one face belong to one |
| | 50 | | /// person. The range of confidenceThreshold is [0, 1] (default |
| | 51 | | /// specified by algorithm).</param> |
| 0 | 52 | | public IdentifyRequest(IList<System.Guid> faceIds, string personGroupId = default(string), string largePersonGro |
| | 53 | | { |
| 0 | 54 | | FaceIds = faceIds; |
| 0 | 55 | | PersonGroupId = personGroupId; |
| 0 | 56 | | LargePersonGroupId = largePersonGroupId; |
| 0 | 57 | | MaxNumOfCandidatesReturned = maxNumOfCandidatesReturned; |
| 0 | 58 | | ConfidenceThreshold = confidenceThreshold; |
| | 59 | | CustomInit(); |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// An initialization method that performs custom operations like setting defaults |
| | 64 | | /// </summary> |
| | 65 | | partial void CustomInit(); |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets array of query faces faceIds, created by the Face - |
| | 69 | | /// Detect. Each of the faces are identified independently. The valid |
| | 70 | | /// number of faceIds is between [1, 10]. |
| | 71 | | /// </summary> |
| | 72 | | [JsonProperty(PropertyName = "faceIds")] |
| 8 | 73 | | public IList<System.Guid> FaceIds { get; set; } |
| | 74 | |
|
| | 75 | | /// <summary> |
| | 76 | | /// Gets or sets personGroupId of the target person group, created by |
| | 77 | | /// PersonGroup - Create. Parameter personGroupId and |
| | 78 | | /// largePersonGroupId should not be provided at the same time. |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "personGroupId")] |
| 8 | 81 | | public string PersonGroupId { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets or sets largePersonGroupId of the target large person group, |
| | 85 | | /// created by LargePersonGroup - Create. Parameter personGroupId and |
| | 86 | | /// largePersonGroupId should not be provided at the same time. |
| | 87 | | /// </summary> |
| | 88 | | [JsonProperty(PropertyName = "largePersonGroupId")] |
| 8 | 89 | | public string LargePersonGroupId { get; set; } |
| | 90 | |
|
| | 91 | | /// <summary> |
| | 92 | | /// Gets or sets the range of maxNumOfCandidatesReturned is between 1 |
| | 93 | | /// and 5 (default is 1). |
| | 94 | | /// </summary> |
| | 95 | | [JsonProperty(PropertyName = "maxNumOfCandidatesReturned")] |
| 8 | 96 | | public int? MaxNumOfCandidatesReturned { get; set; } |
| | 97 | |
|
| | 98 | | /// <summary> |
| | 99 | | /// Gets or sets confidence threshold of identification, used to judge |
| | 100 | | /// whether one face belong to one person. The range of |
| | 101 | | /// confidenceThreshold is [0, 1] (default specified by algorithm). |
| | 102 | | /// </summary> |
| | 103 | | [JsonProperty(PropertyName = "confidenceThreshold")] |
| 8 | 104 | | public double? ConfidenceThreshold { get; set; } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Validate the object. |
| | 108 | | /// </summary> |
| | 109 | | /// <exception cref="ValidationException"> |
| | 110 | | /// Thrown if validation fails |
| | 111 | | /// </exception> |
| | 112 | | public virtual void Validate() |
| | 113 | | { |
| 0 | 114 | | if (FaceIds == null) |
| | 115 | | { |
| 0 | 116 | | throw new ValidationException(ValidationRules.CannotBeNull, "FaceIds"); |
| | 117 | | } |
| 0 | 118 | | if (FaceIds != null) |
| | 119 | | { |
| 0 | 120 | | if (FaceIds.Count > 10) |
| | 121 | | { |
| 0 | 122 | | throw new ValidationException(ValidationRules.MaxItems, "FaceIds", 10); |
| | 123 | | } |
| | 124 | | } |
| 0 | 125 | | if (PersonGroupId != null) |
| | 126 | | { |
| 0 | 127 | | if (PersonGroupId.Length > 64) |
| | 128 | | { |
| 0 | 129 | | throw new ValidationException(ValidationRules.MaxLength, "PersonGroupId", 64); |
| | 130 | | } |
| 0 | 131 | | if (!System.Text.RegularExpressions.Regex.IsMatch(PersonGroupId, "^[a-z0-9-_]+$")) |
| | 132 | | { |
| 0 | 133 | | throw new ValidationException(ValidationRules.Pattern, "PersonGroupId", "^[a-z0-9-_]+$"); |
| | 134 | | } |
| | 135 | | } |
| 0 | 136 | | if (LargePersonGroupId != null) |
| | 137 | | { |
| 0 | 138 | | if (LargePersonGroupId.Length > 64) |
| | 139 | | { |
| 0 | 140 | | throw new ValidationException(ValidationRules.MaxLength, "LargePersonGroupId", 64); |
| | 141 | | } |
| 0 | 142 | | if (!System.Text.RegularExpressions.Regex.IsMatch(LargePersonGroupId, "^[a-z0-9-_]+$")) |
| | 143 | | { |
| 0 | 144 | | throw new ValidationException(ValidationRules.Pattern, "LargePersonGroupId", "^[a-z0-9-_]+$"); |
| | 145 | | } |
| | 146 | | } |
| 0 | 147 | | if (MaxNumOfCandidatesReturned > 5) |
| | 148 | | { |
| 0 | 149 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxNumOfCandidatesReturned", 5); |
| | 150 | | } |
| 0 | 151 | | if (MaxNumOfCandidatesReturned < 1) |
| | 152 | | { |
| 0 | 153 | | throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxNumOfCandidatesReturned", 1); |
| | 154 | | } |
| 0 | 155 | | } |
| | 156 | | } |
| | 157 | | } |