-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCustomersCreateRequestBody.java
More file actions
448 lines (352 loc) · 12.7 KB
/
CustomersCreateRequestBody.java
File metadata and controls
448 lines (352 loc) · 12.7 KB
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
/*
* Voucherify API
* Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.
*
* The version of the OpenAPI document: v2018-08-01
* Contact: support@voucherify.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package io.voucherify.client.model;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.voucherify.client.model.CustomersCreateRequestBodyAddress;
import java.io.IOException;
import java.time.LocalDate;
import java.util.Arrays;
import org.openapitools.jackson.nullable.JsonNullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import io.voucherify.client.JSON;
/**
* Request body schema for **POST** `v1/customers`.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class CustomersCreateRequestBody {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_SOURCE_ID = "source_id";
@SerializedName(SERIALIZED_NAME_SOURCE_ID)
private String sourceId;
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)
private String name;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
private String description;
public static final String SERIALIZED_NAME_EMAIL = "email";
@SerializedName(SERIALIZED_NAME_EMAIL)
private String email;
public static final String SERIALIZED_NAME_PHONE = "phone";
@SerializedName(SERIALIZED_NAME_PHONE)
private String phone;
public static final String SERIALIZED_NAME_BIRTHDAY = "birthday";
@SerializedName(SERIALIZED_NAME_BIRTHDAY)
private LocalDate birthday;
public static final String SERIALIZED_NAME_BIRTHDATE = "birthdate";
@SerializedName(SERIALIZED_NAME_BIRTHDATE)
private LocalDate birthdate;
public static final String SERIALIZED_NAME_ADDRESS = "address";
@SerializedName(SERIALIZED_NAME_ADDRESS)
private CustomersCreateRequestBodyAddress address;
public static final String SERIALIZED_NAME_METADATA = "metadata";
@SerializedName(SERIALIZED_NAME_METADATA)
private Map<String, Object> metadata;
public CustomersCreateRequestBody() {
}
public CustomersCreateRequestBody id(String id) {
this.id = id;
return this;
}
/**
* The ID of an existing customer.
* @return id
**/
@javax.annotation.Nullable
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public CustomersCreateRequestBody sourceId(String sourceId) {
this.sourceId = sourceId;
return this;
}
/**
* A unique identifier of the customer who validates a voucher. It can be a customer ID or email from a CRM system, database, or a third-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored.
* @return sourceId
**/
@javax.annotation.Nullable
public String getSourceId() {
return sourceId;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public CustomersCreateRequestBody name(String name) {
this.name = name;
return this;
}
/**
* Customer's first and last name.
* @return name
**/
@javax.annotation.Nullable
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CustomersCreateRequestBody description(String description) {
this.description = description;
return this;
}
/**
* An arbitrary string that you can attach to a customer object.
* @return description
**/
@javax.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public CustomersCreateRequestBody email(String email) {
this.email = email;
return this;
}
/**
* Customer's email address.
* @return email
**/
@javax.annotation.Nullable
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public CustomersCreateRequestBody phone(String phone) {
this.phone = phone;
return this;
}
/**
* Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel.
* @return phone
**/
@javax.annotation.Nullable
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public CustomersCreateRequestBody birthday(LocalDate birthday) {
this.birthday = birthday;
return this;
}
/**
* `Deprecated`. ~~Customer's birthdate; format YYYY-MM-DD~~.
* @return birthday
**/
@javax.annotation.Nullable
public LocalDate getBirthday() {
return birthday;
}
public void setBirthday(LocalDate birthday) {
this.birthday = birthday;
}
public CustomersCreateRequestBody birthdate(LocalDate birthdate) {
this.birthdate = birthdate;
return this;
}
/**
* Customer's birthdate; format YYYY-MM-DD.
* @return birthdate
**/
@javax.annotation.Nullable
public LocalDate getBirthdate() {
return birthdate;
}
public void setBirthdate(LocalDate birthdate) {
this.birthdate = birthdate;
}
public CustomersCreateRequestBody address(CustomersCreateRequestBodyAddress address) {
this.address = address;
return this;
}
/**
* Get address
* @return address
**/
@javax.annotation.Nullable
public CustomersCreateRequestBodyAddress getAddress() {
return address;
}
public void setAddress(CustomersCreateRequestBodyAddress address) {
this.address = address;
}
public CustomersCreateRequestBody metadata(Map<String, Object> metadata) {
this.metadata = metadata;
return this;
}
/**
* A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.
* @return metadata
**/
@javax.annotation.Nullable
public Map<String, Object> getMetadata() {
return metadata;
}
public void setMetadata(Map<String, Object> metadata) {
this.metadata = metadata;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CustomersCreateRequestBody customersCreateRequestBody = (CustomersCreateRequestBody) o;
return Objects.equals(this.id, customersCreateRequestBody.id) &&
Objects.equals(this.sourceId, customersCreateRequestBody.sourceId) &&
Objects.equals(this.name, customersCreateRequestBody.name) &&
Objects.equals(this.description, customersCreateRequestBody.description) &&
Objects.equals(this.email, customersCreateRequestBody.email) &&
Objects.equals(this.phone, customersCreateRequestBody.phone) &&
Objects.equals(this.birthday, customersCreateRequestBody.birthday) &&
Objects.equals(this.birthdate, customersCreateRequestBody.birthdate) &&
Objects.equals(this.address, customersCreateRequestBody.address) &&
Objects.equals(this.metadata, customersCreateRequestBody.metadata);
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(id, sourceId, name, description, email, phone, birthday, birthdate, address, metadata);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CustomersCreateRequestBody {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" birthday: ").append(toIndentedString(birthday)).append("\n");
sb.append(" birthdate: ").append(toIndentedString(birthdate)).append("\n");
sb.append(" address: ").append(toIndentedString(address)).append("\n");
sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet<String> openapiFields;
public static HashSet<String> openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>();
openapiFields.add("id");
openapiFields.add("source_id");
openapiFields.add("name");
openapiFields.add("description");
openapiFields.add("email");
openapiFields.add("phone");
openapiFields.add("birthday");
openapiFields.add("birthdate");
openapiFields.add("address");
openapiFields.add("metadata");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!CustomersCreateRequestBody.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'CustomersCreateRequestBody' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<CustomersCreateRequestBody> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(CustomersCreateRequestBody.class));
return (TypeAdapter<T>) new TypeAdapter<CustomersCreateRequestBody>() {
@Override
public void write(JsonWriter out, CustomersCreateRequestBody value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public CustomersCreateRequestBody read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of CustomersCreateRequestBody given an JSON string
*
* @param jsonString JSON string
* @return An instance of CustomersCreateRequestBody
* @throws IOException if the JSON string is invalid with respect to CustomersCreateRequestBody
*/
public static CustomersCreateRequestBody fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, CustomersCreateRequestBody.class);
}
/**
* Convert an instance of CustomersCreateRequestBody to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}