-
Notifications
You must be signed in to change notification settings - Fork 450
/
LegalHoldsPolicyUpdateArg.cs
188 lines (165 loc) · 6.67 KB
/
LegalHoldsPolicyUpdateArg.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// <auto-generated>
// Auto-generated by StoneAPI, do not modify.
// </auto-generated>
namespace Dropbox.Api.Team
{
using sys = System;
using col = System.Collections.Generic;
using re = System.Text.RegularExpressions;
using enc = Dropbox.Api.Stone;
/// <summary>
/// <para>The legal holds policy update arg object</para>
/// </summary>
public class LegalHoldsPolicyUpdateArg
{
#pragma warning disable 108
/// <summary>
/// <para>The encoder instance.</para>
/// </summary>
internal static enc.StructEncoder<LegalHoldsPolicyUpdateArg> Encoder = new LegalHoldsPolicyUpdateArgEncoder();
/// <summary>
/// <para>The decoder instance.</para>
/// </summary>
internal static enc.StructDecoder<LegalHoldsPolicyUpdateArg> Decoder = new LegalHoldsPolicyUpdateArgDecoder();
/// <summary>
/// <para>Initializes a new instance of the <see cref="LegalHoldsPolicyUpdateArg" />
/// class.</para>
/// </summary>
/// <param name="id">The legal hold Id.</param>
/// <param name="name">Policy new name.</param>
/// <param name="description">Policy new description.</param>
/// <param name="members">List of team member IDs to apply the policy on.</param>
public LegalHoldsPolicyUpdateArg(string id,
string name = null,
string description = null,
col.IEnumerable<string> members = null)
{
if (id == null)
{
throw new sys.ArgumentNullException("id");
}
if (!re.Regex.IsMatch(id, @"\A(?:^pid_dbhid:.+)\z"))
{
throw new sys.ArgumentOutOfRangeException("id", @"Value should match pattern '\A(?:^pid_dbhid:.+)\z'");
}
if (name != null)
{
if (name.Length > 140)
{
throw new sys.ArgumentOutOfRangeException("name", "Length should be at most 140");
}
}
if (description != null)
{
if (description.Length > 501)
{
throw new sys.ArgumentOutOfRangeException("description", "Length should be at most 501");
}
}
var membersList = enc.Util.ToList(members);
this.Id = id;
this.Name = name;
this.Description = description;
this.Members = membersList;
}
/// <summary>
/// <para>Initializes a new instance of the <see cref="LegalHoldsPolicyUpdateArg" />
/// class.</para>
/// </summary>
/// <remarks>This is to construct an instance of the object when
/// deserializing.</remarks>
[sys.ComponentModel.EditorBrowsable(sys.ComponentModel.EditorBrowsableState.Never)]
public LegalHoldsPolicyUpdateArg()
{
}
/// <summary>
/// <para>The legal hold Id.</para>
/// </summary>
public string Id { get; protected set; }
/// <summary>
/// <para>Policy new name.</para>
/// </summary>
public string Name { get; protected set; }
/// <summary>
/// <para>Policy new description.</para>
/// </summary>
public string Description { get; protected set; }
/// <summary>
/// <para>List of team member IDs to apply the policy on.</para>
/// </summary>
public col.IList<string> Members { get; protected set; }
#region Encoder class
/// <summary>
/// <para>Encoder for <see cref="LegalHoldsPolicyUpdateArg" />.</para>
/// </summary>
private class LegalHoldsPolicyUpdateArgEncoder : enc.StructEncoder<LegalHoldsPolicyUpdateArg>
{
/// <summary>
/// <para>Encode fields of given value.</para>
/// </summary>
/// <param name="value">The value.</param>
/// <param name="writer">The writer.</param>
public override void EncodeFields(LegalHoldsPolicyUpdateArg value, enc.IJsonWriter writer)
{
WriteProperty("id", value.Id, writer, enc.StringEncoder.Instance);
if (value.Name != null)
{
WriteProperty("name", value.Name, writer, enc.StringEncoder.Instance);
}
if (value.Description != null)
{
WriteProperty("description", value.Description, writer, enc.StringEncoder.Instance);
}
if (value.Members.Count > 0)
{
WriteListProperty("members", value.Members, writer, enc.StringEncoder.Instance);
}
}
}
#endregion
#region Decoder class
/// <summary>
/// <para>Decoder for <see cref="LegalHoldsPolicyUpdateArg" />.</para>
/// </summary>
private class LegalHoldsPolicyUpdateArgDecoder : enc.StructDecoder<LegalHoldsPolicyUpdateArg>
{
/// <summary>
/// <para>Create a new instance of type <see cref="LegalHoldsPolicyUpdateArg"
/// />.</para>
/// </summary>
/// <returns>The struct instance.</returns>
protected override LegalHoldsPolicyUpdateArg Create()
{
return new LegalHoldsPolicyUpdateArg();
}
/// <summary>
/// <para>Set given field.</para>
/// </summary>
/// <param name="value">The field value.</param>
/// <param name="fieldName">The field name.</param>
/// <param name="reader">The json reader.</param>
protected override void SetField(LegalHoldsPolicyUpdateArg value, string fieldName, enc.IJsonReader reader)
{
switch (fieldName)
{
case "id":
value.Id = enc.StringDecoder.Instance.Decode(reader);
break;
case "name":
value.Name = enc.StringDecoder.Instance.Decode(reader);
break;
case "description":
value.Description = enc.StringDecoder.Instance.Decode(reader);
break;
case "members":
value.Members = ReadList<string>(reader, enc.StringDecoder.Instance);
break;
default:
reader.Skip();
break;
}
}
}
#endregion
}
}