@@ -29,7 +29,7 @@ public partial class Address : IEquatable<Address>, IValidatableObject
29
29
/// Initializes a new instance of the <see cref="Address" /> class.
30
30
/// </summary>
31
31
[ JsonConstructorAttribute ]
32
- protected Address ( ) { }
32
+ public Address ( ) { }
33
33
/// <summary>
34
34
/// Initializes a new instance of the <see cref="Address" /> class.
35
35
/// </summary>
@@ -38,11 +38,21 @@ protected Address() { }
38
38
/// <param name="city">The city. (required).</param>
39
39
/// <param name="companyName">The name of the business..</param>
40
40
/// <param name="countryCode">The country code in two-character ISO 3166-1 alpha-2 format. (required).</param>
41
- /// <param name="name">The name of the individual or business. (required).</param>
41
+ /// <param name="email">The email address.</param>
42
+ /// <param name="name">The name of the individual who is the primary contact. (required).</param>
43
+ /// <param name="phoneNumber">The phone number.</param>
42
44
/// <param name="postalCode">The postal code. (required).</param>
43
45
/// <param name="stateOrProvinceCode">The state or province code..</param>
44
- /// /// <param name="phoneNumber">The phone number for the business.</param>
45
- public Address ( string addressLine1 = default ( string ) , string addressLine2 = default ( string ) , string city = default ( string ) , string companyName = default ( string ) , string countryCode = default ( string ) , string name = default ( string ) , string postalCode = default ( string ) , string stateOrProvinceCode = default ( string ) , string phoneNumber = default ( string ) )
46
+ public Address ( string addressLine1 = default ( string ) ,
47
+ string addressLine2 = default ( string ) ,
48
+ string city = default ( string ) ,
49
+ string companyName = default ( string ) ,
50
+ string countryCode = default ( string ) ,
51
+ string email = default ( string ) ,
52
+ string name = default ( string ) ,
53
+ string phoneNumber = default ( string ) ,
54
+ string postalCode = default ( string ) ,
55
+ string stateOrProvinceCode = default ( string ) )
46
56
{
47
57
// to ensure "addressLine1" is required (not null)
48
58
if ( addressLine1 == null )
@@ -89,17 +99,10 @@ protected Address() { }
89
99
{
90
100
this . PostalCode = postalCode ;
91
101
}
92
- // to ensure "phoneNumber" is required (not null)
93
- if ( phoneNumber == null )
94
- {
95
- throw new InvalidDataException ( "phoneNumber is a required property for Address and cannot be null" ) ;
96
- }
97
- else
98
- {
99
- this . PhoneNumber = phoneNumber ;
100
- }
101
102
this . AddressLine2 = addressLine2 ;
102
103
this . CompanyName = companyName ;
104
+ this . Email = email ;
105
+ this . PhoneNumber = phoneNumber ;
103
106
this . StateOrProvinceCode = stateOrProvinceCode ;
104
107
}
105
108
@@ -139,12 +142,26 @@ protected Address() { }
139
142
public string CountryCode { get ; set ; }
140
143
141
144
/// <summary>
142
- /// The name of the individual or business .
145
+ /// The email address .
143
146
/// </summary>
144
- /// <value>The name of the individual or business.</value>
147
+ /// <value>The email address.</value>
148
+ [ DataMember ( Name = "email" , EmitDefaultValue = false ) ]
149
+ public string Email { get ; set ; }
150
+
151
+ /// <summary>
152
+ /// The name of the individual who is the primary contact.
153
+ /// </summary>
154
+ /// <value>The name of the individual who is the primary contact.</value>
145
155
[ DataMember ( Name = "name" , EmitDefaultValue = false ) ]
146
156
public string Name { get ; set ; }
147
157
158
+ /// <summary>
159
+ /// The phone number.
160
+ /// </summary>
161
+ /// <value>The phone number.</value>
162
+ [ DataMember ( Name = "phoneNumber" , EmitDefaultValue = false ) ]
163
+ public string PhoneNumber { get ; set ; }
164
+
148
165
/// <summary>
149
166
/// The postal code.
150
167
/// </summary>
@@ -159,13 +176,6 @@ protected Address() { }
159
176
[ DataMember ( Name = "stateOrProvinceCode" , EmitDefaultValue = false ) ]
160
177
public string StateOrProvinceCode { get ; set ; }
161
178
162
- /// <summary>
163
- /// The phone number.
164
- /// </summary>
165
- /// <value>The phone number.</value>
166
- [ DataMember ( Name = "phoneNumber" , EmitDefaultValue = false ) ]
167
- public string PhoneNumber { get ; set ; }
168
-
169
179
/// <summary>
170
180
/// Returns the string presentation of the object
171
181
/// </summary>
@@ -179,10 +189,11 @@ public override string ToString()
179
189
sb . Append ( " City: " ) . Append ( City ) . Append ( "\n " ) ;
180
190
sb . Append ( " CompanyName: " ) . Append ( CompanyName ) . Append ( "\n " ) ;
181
191
sb . Append ( " CountryCode: " ) . Append ( CountryCode ) . Append ( "\n " ) ;
192
+ sb . Append ( " Email: " ) . Append ( Email ) . Append ( "\n " ) ;
182
193
sb . Append ( " Name: " ) . Append ( Name ) . Append ( "\n " ) ;
194
+ sb . Append ( " PhoneNumber: " ) . Append ( PhoneNumber ) . Append ( "\n " ) ;
183
195
sb . Append ( " PostalCode: " ) . Append ( PostalCode ) . Append ( "\n " ) ;
184
196
sb . Append ( " StateOrProvinceCode: " ) . Append ( StateOrProvinceCode ) . Append ( "\n " ) ;
185
- sb . Append ( " PhoneNumber: " ) . Append ( PhoneNumber ) . Append ( "\n " ) ;
186
197
sb . Append ( "}\n " ) ;
187
198
return sb . ToString ( ) ;
188
199
}
@@ -241,21 +252,26 @@ public bool Equals(Address input)
241
252
this . CountryCode == input . CountryCode ||
242
253
( this . CountryCode != null &&
243
254
this . CountryCode . Equals ( input . CountryCode ) )
244
- ) &&
255
+ ) &&
256
+ (
257
+ this . Email == input . Email ||
258
+ ( this . Email != null &&
259
+ this . Email . Equals ( input . Email ) )
260
+ ) &&
245
261
(
246
262
this . Name == input . Name ||
247
263
( this . Name != null &&
248
264
this . Name . Equals ( input . Name ) )
249
- ) &&
250
- (
251
- this . PostalCode == input . PostalCode ||
252
- ( this . PostalCode != null &&
253
- this . PostalCode . Equals ( input . PostalCode ) )
254
265
) &&
255
266
(
256
267
this . PhoneNumber == input . PhoneNumber ||
257
268
( this . PhoneNumber != null &&
258
269
this . PhoneNumber . Equals ( input . PhoneNumber ) )
270
+ ) &&
271
+ (
272
+ this . PostalCode == input . PostalCode ||
273
+ ( this . PostalCode != null &&
274
+ this . PostalCode . Equals ( input . PostalCode ) )
259
275
) &&
260
276
(
261
277
this . StateOrProvinceCode == input . StateOrProvinceCode ||
@@ -283,14 +299,16 @@ public override int GetHashCode()
283
299
hashCode = hashCode * 59 + this . CompanyName . GetHashCode ( ) ;
284
300
if ( this . CountryCode != null )
285
301
hashCode = hashCode * 59 + this . CountryCode . GetHashCode ( ) ;
302
+ if ( this . Email != null )
303
+ hashCode = hashCode * 59 + this . Email . GetHashCode ( ) ;
286
304
if ( this . Name != null )
287
305
hashCode = hashCode * 59 + this . Name . GetHashCode ( ) ;
306
+ if ( this . PhoneNumber != null )
307
+ hashCode = hashCode * 59 + this . PhoneNumber . GetHashCode ( ) ;
288
308
if ( this . PostalCode != null )
289
309
hashCode = hashCode * 59 + this . PostalCode . GetHashCode ( ) ;
290
310
if ( this . StateOrProvinceCode != null )
291
311
hashCode = hashCode * 59 + this . StateOrProvinceCode . GetHashCode ( ) ;
292
- if ( this . PhoneNumber != null )
293
- hashCode = hashCode * 59 + this . PhoneNumber . GetHashCode ( ) ;
294
312
return hashCode ;
295
313
}
296
314
}
@@ -362,15 +380,39 @@ public override int GetHashCode()
362
380
yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for CountryCode, length must be greater than 2." , new [ ] { "CountryCode" } ) ;
363
381
}
364
382
383
+ // Email (string) maxLength
384
+ if ( this . Email != null && this . Email . Length > 1024 )
385
+ {
386
+ yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for Email, length must be less than 1024." , new [ ] { "Email" } ) ;
387
+ }
388
+
389
+ // Email (string) minLength
390
+ if ( this . Email != null && this . Email . Length < 1 )
391
+ {
392
+ yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for Email, length must be greater than 1." , new [ ] { "Email" } ) ;
393
+ }
394
+
365
395
// CountryCode (string) pattern
366
396
Regex regexCountryCode = new Regex ( @"^[A-Z]{2}$" , RegexOptions . CultureInvariant ) ;
367
397
if ( false == regexCountryCode . Match ( this . CountryCode ) . Success )
368
398
{
369
399
yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for CountryCode, must match a pattern of " + regexCountryCode , new [ ] { "CountryCode" } ) ;
370
400
}
371
401
402
+ // PhoneNumber (string) maxLength
403
+ if ( this . PhoneNumber != null && this . PhoneNumber . Length > 20 )
404
+ {
405
+ yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for PhoneNumber, length must be less than 20." , new [ ] { "PhoneNumber" } ) ;
406
+ }
407
+
408
+ // PhoneNumber (string) minLength
409
+ if ( this . PhoneNumber != null && this . PhoneNumber . Length < 1 )
410
+ {
411
+ yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for PhoneNumber, length must be greater than 1." , new [ ] { "PhoneNumber" } ) ;
412
+ }
413
+
372
414
// Name (string) maxLength
373
- if ( this . Name != null && this . Name . Length > 50 )
415
+ if ( this . Name != null && this . Name . Length > 50 )
374
416
{
375
417
yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for Name, length must be less than 50." , new [ ] { "Name" } ) ;
376
418
}
@@ -405,18 +447,6 @@ public override int GetHashCode()
405
447
yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for StateOrProvinceCode, length must be greater than 1." , new [ ] { "StateOrProvinceCode" } ) ;
406
448
}
407
449
408
- // PhoneNumber (string) maxLength
409
- if ( this . PhoneNumber != null && this . PhoneNumber . Length > 20 )
410
- {
411
- yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for PhoneNumber, length must be less than 20." , new [ ] { "PhoneNumber" } ) ;
412
- }
413
-
414
- // PhoneNumber (string) minLength
415
- if ( this . PhoneNumber != null && this . PhoneNumber . Length < 1 )
416
- {
417
- yield return new System . ComponentModel . DataAnnotations . ValidationResult ( "Invalid value for PhoneNumber, length must be greater than 1." , new [ ] { "PhoneNumber" } ) ;
418
- }
419
-
420
450
yield break ;
421
451
}
422
452
}
0 commit comments