/
FullAccount.cs
304 lines (276 loc) · 13.1 KB
/
FullAccount.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// <auto-generated>
// Auto-generated by StoneAPI, do not modify.
// </auto-generated>
namespace Dropbox.Api.Users
{
using sys = System;
using col = System.Collections.Generic;
using re = System.Text.RegularExpressions;
using enc = Dropbox.Api.Stone;
/// <summary>
/// <para>Detailed information about the current user's account.</para>
/// </summary>
/// <seealso cref="Global::Dropbox.Api.Users.Account" />
public class FullAccount : Account
{
#pragma warning disable 108
/// <summary>
/// <para>The encoder instance.</para>
/// </summary>
internal static enc.StructEncoder<FullAccount> Encoder = new FullAccountEncoder();
/// <summary>
/// <para>The decoder instance.</para>
/// </summary>
internal static enc.StructDecoder<FullAccount> Decoder = new FullAccountDecoder();
/// <summary>
/// <para>Initializes a new instance of the <see cref="FullAccount" /> class.</para>
/// </summary>
/// <param name="accountId">The user's unique Dropbox ID.</param>
/// <param name="name">Details of a user's name.</param>
/// <param name="email">The user's email address. Do not rely on this without checking
/// the <paramref name="emailVerified" /> field. Even then, it's possible that the user
/// has since lost access to their email.</param>
/// <param name="emailVerified">Whether the user has verified their email
/// address.</param>
/// <param name="disabled">Whether the user has been disabled.</param>
/// <param name="locale">The language that the user specified. Locale tags will be <a
/// href="http://en.wikipedia.org/wiki/IETF_language_tag">IETF language
/// tags</a>.</param>
/// <param name="referralLink">The user's <a
/// href="https://www.dropbox.com/referrals">referral link</a>.</param>
/// <param name="isPaired">Whether the user has a personal and work account. If the
/// current account is personal, then <paramref name="team" /> will always be
/// <c>null</c>, but <paramref name="isPaired" /> will indicate if a work account is
/// linked.</param>
/// <param name="accountType">What type of account this user has.</param>
/// <param name="rootInfo">The root info for this account.</param>
/// <param name="profilePhotoUrl">URL for the photo representing the user, if one is
/// set.</param>
/// <param name="country">The user's two-letter country code, if available. Country
/// codes are based on <a href="http://en.wikipedia.org/wiki/ISO_3166-1">ISO
/// 3166-1</a>.</param>
/// <param name="team">If this account is a member of a team, information about that
/// team.</param>
/// <param name="teamMemberId">This account's unique team member id. This field will
/// only be present if <paramref name="team" /> is present.</param>
public FullAccount(string accountId,
Name name,
string email,
bool emailVerified,
bool disabled,
string locale,
string referralLink,
bool isPaired,
global::Dropbox.Api.UsersCommon.AccountType accountType,
global::Dropbox.Api.Common.RootInfo rootInfo,
string profilePhotoUrl = null,
string country = null,
FullTeam team = null,
string teamMemberId = null)
: base(accountId, name, email, emailVerified, disabled, profilePhotoUrl)
{
if (locale == null)
{
throw new sys.ArgumentNullException("locale");
}
if (locale.Length < 2)
{
throw new sys.ArgumentOutOfRangeException("locale", "Length should be at least 2");
}
if (referralLink == null)
{
throw new sys.ArgumentNullException("referralLink");
}
if (accountType == null)
{
throw new sys.ArgumentNullException("accountType");
}
if (rootInfo == null)
{
throw new sys.ArgumentNullException("rootInfo");
}
if (country != null)
{
if (country.Length < 2)
{
throw new sys.ArgumentOutOfRangeException("country", "Length should be at least 2");
}
if (country.Length > 2)
{
throw new sys.ArgumentOutOfRangeException("country", "Length should be at most 2");
}
}
this.Locale = locale;
this.ReferralLink = referralLink;
this.IsPaired = isPaired;
this.AccountType = accountType;
this.RootInfo = rootInfo;
this.Country = country;
this.Team = team;
this.TeamMemberId = teamMemberId;
}
/// <summary>
/// <para>Initializes a new instance of the <see cref="FullAccount" /> class.</para>
/// </summary>
/// <remarks>This is to construct an instance of the object when
/// deserializing.</remarks>
[sys.ComponentModel.EditorBrowsable(sys.ComponentModel.EditorBrowsableState.Never)]
public FullAccount()
{
}
/// <summary>
/// <para>The language that the user specified. Locale tags will be <a
/// href="http://en.wikipedia.org/wiki/IETF_language_tag">IETF language
/// tags</a>.</para>
/// </summary>
public string Locale { get; protected set; }
/// <summary>
/// <para>The user's <a href="https://www.dropbox.com/referrals">referral
/// link</a>.</para>
/// </summary>
public string ReferralLink { get; protected set; }
/// <summary>
/// <para>Whether the user has a personal and work account. If the current account is
/// personal, then <see cref="Team" /> will always be <c>null</c>, but <see
/// cref="IsPaired" /> will indicate if a work account is linked.</para>
/// </summary>
public bool IsPaired { get; protected set; }
/// <summary>
/// <para>What type of account this user has.</para>
/// </summary>
public global::Dropbox.Api.UsersCommon.AccountType AccountType { get; protected set; }
/// <summary>
/// <para>The root info for this account.</para>
/// </summary>
public global::Dropbox.Api.Common.RootInfo RootInfo { get; protected set; }
/// <summary>
/// <para>The user's two-letter country code, if available. Country codes are based on
/// <a href="http://en.wikipedia.org/wiki/ISO_3166-1">ISO 3166-1</a>.</para>
/// </summary>
public string Country { get; protected set; }
/// <summary>
/// <para>If this account is a member of a team, information about that team.</para>
/// </summary>
public FullTeam Team { get; protected set; }
/// <summary>
/// <para>This account's unique team member id. This field will only be present if <see
/// cref="Team" /> is present.</para>
/// </summary>
public string TeamMemberId { get; protected set; }
#region Encoder class
/// <summary>
/// <para>Encoder for <see cref="FullAccount" />.</para>
/// </summary>
private class FullAccountEncoder : enc.StructEncoder<FullAccount>
{
/// <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(FullAccount value, enc.IJsonWriter writer)
{
WriteProperty("account_id", value.AccountId, writer, enc.StringEncoder.Instance);
WriteProperty("name", value.Name, writer, global::Dropbox.Api.Users.Name.Encoder);
WriteProperty("email", value.Email, writer, enc.StringEncoder.Instance);
WriteProperty("email_verified", value.EmailVerified, writer, enc.BooleanEncoder.Instance);
WriteProperty("disabled", value.Disabled, writer, enc.BooleanEncoder.Instance);
WriteProperty("locale", value.Locale, writer, enc.StringEncoder.Instance);
WriteProperty("referral_link", value.ReferralLink, writer, enc.StringEncoder.Instance);
WriteProperty("is_paired", value.IsPaired, writer, enc.BooleanEncoder.Instance);
WriteProperty("account_type", value.AccountType, writer, global::Dropbox.Api.UsersCommon.AccountType.Encoder);
WriteProperty("root_info", value.RootInfo, writer, global::Dropbox.Api.Common.RootInfo.Encoder);
if (value.ProfilePhotoUrl != null)
{
WriteProperty("profile_photo_url", value.ProfilePhotoUrl, writer, enc.StringEncoder.Instance);
}
if (value.Country != null)
{
WriteProperty("country", value.Country, writer, enc.StringEncoder.Instance);
}
if (value.Team != null)
{
WriteProperty("team", value.Team, writer, global::Dropbox.Api.Users.FullTeam.Encoder);
}
if (value.TeamMemberId != null)
{
WriteProperty("team_member_id", value.TeamMemberId, writer, enc.StringEncoder.Instance);
}
}
}
#endregion
#region Decoder class
/// <summary>
/// <para>Decoder for <see cref="FullAccount" />.</para>
/// </summary>
private class FullAccountDecoder : enc.StructDecoder<FullAccount>
{
/// <summary>
/// <para>Create a new instance of type <see cref="FullAccount" />.</para>
/// </summary>
/// <returns>The struct instance.</returns>
protected override FullAccount Create()
{
return new FullAccount();
}
/// <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(FullAccount value, string fieldName, enc.IJsonReader reader)
{
switch (fieldName)
{
case "account_id":
value.AccountId = enc.StringDecoder.Instance.Decode(reader);
break;
case "name":
value.Name = global::Dropbox.Api.Users.Name.Decoder.Decode(reader);
break;
case "email":
value.Email = enc.StringDecoder.Instance.Decode(reader);
break;
case "email_verified":
value.EmailVerified = enc.BooleanDecoder.Instance.Decode(reader);
break;
case "disabled":
value.Disabled = enc.BooleanDecoder.Instance.Decode(reader);
break;
case "locale":
value.Locale = enc.StringDecoder.Instance.Decode(reader);
break;
case "referral_link":
value.ReferralLink = enc.StringDecoder.Instance.Decode(reader);
break;
case "is_paired":
value.IsPaired = enc.BooleanDecoder.Instance.Decode(reader);
break;
case "account_type":
value.AccountType = global::Dropbox.Api.UsersCommon.AccountType.Decoder.Decode(reader);
break;
case "root_info":
value.RootInfo = global::Dropbox.Api.Common.RootInfo.Decoder.Decode(reader);
break;
case "profile_photo_url":
value.ProfilePhotoUrl = enc.StringDecoder.Instance.Decode(reader);
break;
case "country":
value.Country = enc.StringDecoder.Instance.Decode(reader);
break;
case "team":
value.Team = global::Dropbox.Api.Users.FullTeam.Decoder.Decode(reader);
break;
case "team_member_id":
value.TeamMemberId = enc.StringDecoder.Instance.Decode(reader);
break;
default:
reader.Skip();
break;
}
}
}
#endregion
}
}