/
PersonGroup.cs
128 lines (119 loc) · 4.39 KB
/
PersonGroup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// <auto-generated>
// 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.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.CognitiveServices.Vision.Face.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Person group object.
/// </summary>
public partial class PersonGroup
{
/// <summary>
/// Initializes a new instance of the PersonGroup class.
/// </summary>
public PersonGroup()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the PersonGroup class.
/// </summary>
/// <param name="personGroupId">PersonGroupId of the target person
/// group.</param>
/// <param name="name">User defined name, maximum length is
/// 128.</param>
/// <param name="userData">User specified data. Length should not
/// exceed 16KB.</param>
/// <param name="recognitionModel">Possible values include:
/// 'recognition_01', 'recognition_02', 'recognition_03',
/// 'recognition_04'</param>
public PersonGroup(string personGroupId, string name, string userData = default(string), string recognitionModel = default(string))
{
PersonGroupId = personGroupId;
Name = name;
UserData = userData;
RecognitionModel = recognitionModel;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets personGroupId of the target person group.
/// </summary>
[JsonProperty(PropertyName = "personGroupId")]
public string PersonGroupId { get; set; }
/// <summary>
/// Gets or sets user defined name, maximum length is 128.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets user specified data. Length should not exceed 16KB.
/// </summary>
[JsonProperty(PropertyName = "userData")]
public string UserData { get; set; }
/// <summary>
/// Gets or sets possible values include: 'recognition_01',
/// 'recognition_02', 'recognition_03', 'recognition_04'
/// </summary>
[JsonProperty(PropertyName = "recognitionModel")]
public string RecognitionModel { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (PersonGroupId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "PersonGroupId");
}
if (Name == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Name");
}
if (PersonGroupId != null)
{
if (PersonGroupId.Length > 64)
{
throw new ValidationException(ValidationRules.MaxLength, "PersonGroupId", 64);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(PersonGroupId, "^[a-z0-9-_]+$"))
{
throw new ValidationException(ValidationRules.Pattern, "PersonGroupId", "^[a-z0-9-_]+$");
}
}
if (Name != null)
{
if (Name.Length > 128)
{
throw new ValidationException(ValidationRules.MaxLength, "Name", 128);
}
if (Name.Length < 1)
{
throw new ValidationException(ValidationRules.MinLength, "Name", 1);
}
}
if (UserData != null)
{
if (UserData.Length > 16384)
{
throw new ValidationException(ValidationRules.MaxLength, "UserData", 16384);
}
}
}
}
}