| | 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 find similar operation. |
| | 21 | | /// </summary> |
| | 22 | | public partial class FindSimilarRequest |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the FindSimilarRequest class. |
| | 26 | | /// </summary> |
| 6 | 27 | | public FindSimilarRequest() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 6 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the FindSimilarRequest class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="faceId">FaceId of the query face. User needs to call |
| | 36 | | /// Face - Detect first to get a valid faceId. Note that this faceId is |
| | 37 | | /// not persisted and will expire 24 hours after the detection |
| | 38 | | /// call</param> |
| | 39 | | /// <param name="faceListId">An existing user-specified unique |
| | 40 | | /// candidate face list, created in Face List - Create a Face List. |
| | 41 | | /// Face list contains a set of persistedFaceIds which are persisted |
| | 42 | | /// and will never expire. Parameter faceListId, largeFaceListId and |
| | 43 | | /// faceIds should not be provided at the same time.</param> |
| | 44 | | /// <param name="largeFaceListId">An existing user-specified unique |
| | 45 | | /// candidate large face list, created in LargeFaceList - Create. Large |
| | 46 | | /// face list contains a set of persistedFaceIds which are persisted |
| | 47 | | /// and will never expire. Parameter faceListId, largeFaceListId and |
| | 48 | | /// faceIds should not be provided at the same time.</param> |
| | 49 | | /// <param name="faceIds">An array of candidate faceIds. All of them |
| | 50 | | /// are created by Face - Detect and the faceIds will expire 24 hours |
| | 51 | | /// after the detection call. The number of faceIds is limited to 1000. |
| | 52 | | /// Parameter faceListId, largeFaceListId and faceIds should not be |
| | 53 | | /// provided at the same time.</param> |
| | 54 | | /// <param name="maxNumOfCandidatesReturned">The number of top similar |
| | 55 | | /// faces returned. The valid range is [1, 1000].</param> |
| | 56 | | /// <param name="mode">Similar face searching mode. It can be |
| | 57 | | /// "matchPerson" or "matchFace". Possible values include: |
| | 58 | | /// 'matchPerson', 'matchFace'</param> |
| 0 | 59 | | public FindSimilarRequest(System.Guid faceId, string faceListId = default(string), string largeFaceListId = defa |
| | 60 | | { |
| 0 | 61 | | FaceId = faceId; |
| 0 | 62 | | FaceListId = faceListId; |
| 0 | 63 | | LargeFaceListId = largeFaceListId; |
| 0 | 64 | | FaceIds = faceIds; |
| 0 | 65 | | MaxNumOfCandidatesReturned = maxNumOfCandidatesReturned; |
| 0 | 66 | | Mode = mode; |
| | 67 | | CustomInit(); |
| 0 | 68 | | } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// An initialization method that performs custom operations like setting defaults |
| | 72 | | /// </summary> |
| | 73 | | partial void CustomInit(); |
| | 74 | |
|
| | 75 | | /// <summary> |
| | 76 | | /// Gets or sets faceId of the query face. User needs to call Face - |
| | 77 | | /// Detect first to get a valid faceId. Note that this faceId is not |
| | 78 | | /// persisted and will expire 24 hours after the detection call |
| | 79 | | /// </summary> |
| | 80 | | [JsonProperty(PropertyName = "faceId")] |
| 12 | 81 | | public System.Guid FaceId { get; set; } |
| | 82 | |
|
| | 83 | | /// <summary> |
| | 84 | | /// Gets or sets an existing user-specified unique candidate face list, |
| | 85 | | /// created in Face List - Create a Face List. Face list contains a set |
| | 86 | | /// of persistedFaceIds which are persisted and will never expire. |
| | 87 | | /// Parameter faceListId, largeFaceListId and faceIds should not be |
| | 88 | | /// provided at the same time. |
| | 89 | | /// </summary> |
| | 90 | | [JsonProperty(PropertyName = "faceListId")] |
| 12 | 91 | | public string FaceListId { get; set; } |
| | 92 | |
|
| | 93 | | /// <summary> |
| | 94 | | /// Gets or sets an existing user-specified unique candidate large face |
| | 95 | | /// list, created in LargeFaceList - Create. Large face list contains a |
| | 96 | | /// set of persistedFaceIds which are persisted and will never expire. |
| | 97 | | /// Parameter faceListId, largeFaceListId and faceIds should not be |
| | 98 | | /// provided at the same time. |
| | 99 | | /// </summary> |
| | 100 | | [JsonProperty(PropertyName = "largeFaceListId")] |
| 12 | 101 | | public string LargeFaceListId { get; set; } |
| | 102 | |
|
| | 103 | | /// <summary> |
| | 104 | | /// Gets or sets an array of candidate faceIds. All of them are created |
| | 105 | | /// by Face - Detect and the faceIds will expire 24 hours after the |
| | 106 | | /// detection call. The number of faceIds is limited to 1000. Parameter |
| | 107 | | /// faceListId, largeFaceListId and faceIds should not be provided at |
| | 108 | | /// the same time. |
| | 109 | | /// </summary> |
| | 110 | | [JsonProperty(PropertyName = "faceIds")] |
| 12 | 111 | | public IList<System.Guid?> FaceIds { get; set; } |
| | 112 | |
|
| | 113 | | /// <summary> |
| | 114 | | /// Gets or sets the number of top similar faces returned. The valid |
| | 115 | | /// range is [1, 1000]. |
| | 116 | | /// </summary> |
| | 117 | | [JsonProperty(PropertyName = "maxNumOfCandidatesReturned")] |
| 12 | 118 | | public int? MaxNumOfCandidatesReturned { get; set; } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Gets or sets similar face searching mode. It can be "matchPerson" |
| | 122 | | /// or "matchFace". Possible values include: 'matchPerson', 'matchFace' |
| | 123 | | /// </summary> |
| | 124 | | [JsonProperty(PropertyName = "mode")] |
| 12 | 125 | | public FindSimilarMatchMode Mode { get; set; } |
| | 126 | |
|
| | 127 | | /// <summary> |
| | 128 | | /// Validate the object. |
| | 129 | | /// </summary> |
| | 130 | | /// <exception cref="ValidationException"> |
| | 131 | | /// Thrown if validation fails |
| | 132 | | /// </exception> |
| | 133 | | public virtual void Validate() |
| | 134 | | { |
| 0 | 135 | | if (FaceListId != null) |
| | 136 | | { |
| 0 | 137 | | if (FaceListId.Length > 64) |
| | 138 | | { |
| 0 | 139 | | throw new ValidationException(ValidationRules.MaxLength, "FaceListId", 64); |
| | 140 | | } |
| 0 | 141 | | if (!System.Text.RegularExpressions.Regex.IsMatch(FaceListId, "^[a-z0-9-_]+$")) |
| | 142 | | { |
| 0 | 143 | | throw new ValidationException(ValidationRules.Pattern, "FaceListId", "^[a-z0-9-_]+$"); |
| | 144 | | } |
| | 145 | | } |
| 0 | 146 | | if (LargeFaceListId != null) |
| | 147 | | { |
| 0 | 148 | | if (LargeFaceListId.Length > 64) |
| | 149 | | { |
| 0 | 150 | | throw new ValidationException(ValidationRules.MaxLength, "LargeFaceListId", 64); |
| | 151 | | } |
| 0 | 152 | | if (!System.Text.RegularExpressions.Regex.IsMatch(LargeFaceListId, "^[a-z0-9-_]+$")) |
| | 153 | | { |
| 0 | 154 | | throw new ValidationException(ValidationRules.Pattern, "LargeFaceListId", "^[a-z0-9-_]+$"); |
| | 155 | | } |
| | 156 | | } |
| 0 | 157 | | if (FaceIds != null) |
| | 158 | | { |
| 0 | 159 | | if (FaceIds.Count > 1000) |
| | 160 | | { |
| 0 | 161 | | throw new ValidationException(ValidationRules.MaxItems, "FaceIds", 1000); |
| | 162 | | } |
| | 163 | | } |
| 0 | 164 | | if (MaxNumOfCandidatesReturned > 1000) |
| | 165 | | { |
| 0 | 166 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxNumOfCandidatesReturned", 1000); |
| | 167 | | } |
| 0 | 168 | | if (MaxNumOfCandidatesReturned < 1) |
| | 169 | | { |
| 0 | 170 | | throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxNumOfCandidatesReturned", 1); |
| | 171 | | } |
| 0 | 172 | | } |
| | 173 | | } |
| | 174 | | } |