| | | 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 | | /// Face list object. |
| | | 21 | | /// </summary> |
| | | 22 | | public partial class FaceList : MetaDataContract |
| | | 23 | | { |
| | | 24 | | /// <summary> |
| | | 25 | | /// Initializes a new instance of the FaceList class. |
| | | 26 | | /// </summary> |
| | 2 | 27 | | public FaceList() |
| | | 28 | | { |
| | | 29 | | CustomInit(); |
| | 2 | 30 | | } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Initializes a new instance of the FaceList class. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <param name="faceListId">FaceListId of the target face |
| | | 36 | | /// list.</param> |
| | | 37 | | /// <param name="name">User defined name, maximum length is |
| | | 38 | | /// 128.</param> |
| | | 39 | | /// <param name="userData">User specified data. Length should not |
| | | 40 | | /// exceed 16KB.</param> |
| | | 41 | | /// <param name="recognitionModel">Possible values include: |
| | | 42 | | /// 'recognition_01', 'recognition_02'</param> |
| | | 43 | | /// <param name="persistedFaces">Persisted faces within the face |
| | | 44 | | /// list.</param> |
| | | 45 | | public FaceList(string faceListId, string name = default(string), string userData = default(string), string reco |
| | 0 | 46 | | : base(name, userData, recognitionModel) |
| | | 47 | | { |
| | 0 | 48 | | FaceListId = faceListId; |
| | 0 | 49 | | PersistedFaces = persistedFaces; |
| | | 50 | | CustomInit(); |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// An initialization method that performs custom operations like setting defaults |
| | | 55 | | /// </summary> |
| | | 56 | | partial void CustomInit(); |
| | | 57 | | |
| | | 58 | | /// <summary> |
| | | 59 | | /// Gets or sets faceListId of the target face list. |
| | | 60 | | /// </summary> |
| | | 61 | | [JsonProperty(PropertyName = "faceListId")] |
| | 0 | 62 | | public string FaceListId { get; set; } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Gets or sets persisted faces within the face list. |
| | | 66 | | /// </summary> |
| | | 67 | | [JsonProperty(PropertyName = "persistedFaces")] |
| | 6 | 68 | | public IList<PersistedFace> PersistedFaces { get; set; } |
| | | 69 | | |
| | | 70 | | /// <summary> |
| | | 71 | | /// Validate the object. |
| | | 72 | | /// </summary> |
| | | 73 | | /// <exception cref="ValidationException"> |
| | | 74 | | /// Thrown if validation fails |
| | | 75 | | /// </exception> |
| | | 76 | | public override void Validate() |
| | | 77 | | { |
| | 0 | 78 | | base.Validate(); |
| | 0 | 79 | | if (FaceListId == null) |
| | | 80 | | { |
| | 0 | 81 | | throw new ValidationException(ValidationRules.CannotBeNull, "FaceListId"); |
| | | 82 | | } |
| | 0 | 83 | | if (FaceListId != null) |
| | | 84 | | { |
| | 0 | 85 | | if (FaceListId.Length > 64) |
| | | 86 | | { |
| | 0 | 87 | | throw new ValidationException(ValidationRules.MaxLength, "FaceListId", 64); |
| | | 88 | | } |
| | 0 | 89 | | if (!System.Text.RegularExpressions.Regex.IsMatch(FaceListId, "^[a-z0-9-_]+$")) |
| | | 90 | | { |
| | 0 | 91 | | throw new ValidationException(ValidationRules.Pattern, "FaceListId", "^[a-z0-9-_]+$"); |
| | | 92 | | } |
| | | 93 | | } |
| | 0 | 94 | | if (PersistedFaces != null) |
| | | 95 | | { |
| | 0 | 96 | | foreach (var element in PersistedFaces) |
| | | 97 | | { |
| | 0 | 98 | | if (element != null) |
| | | 99 | | { |
| | 0 | 100 | | element.Validate(); |
| | | 101 | | } |
| | | 102 | | } |
| | | 103 | | } |
| | 0 | 104 | | } |
| | | 105 | | } |
| | | 106 | | } |