-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathReportResponse.java
More file actions
379 lines (318 loc) · 11.6 KB
/
ReportResponse.java
File metadata and controls
379 lines (318 loc) · 11.6 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
/*
* Dropbox Sign API
* Dropbox Sign v3 API
*
* The version of the OpenAPI document: 3.0.0
* Contact: apisupport@hellosign.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.dropbox.sign.model;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.dropbox.sign.JSON;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.dropbox.sign.ApiException;
/**
* Contains information about the report request.
*/
@JsonPropertyOrder({
ReportResponse.JSON_PROPERTY_SUCCESS,
ReportResponse.JSON_PROPERTY_START_DATE,
ReportResponse.JSON_PROPERTY_END_DATE,
ReportResponse.JSON_PROPERTY_REPORT_TYPE
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
@JsonIgnoreProperties(ignoreUnknown=true)
public class ReportResponse {
public static final String JSON_PROPERTY_SUCCESS = "success";
@jakarta.annotation.Nullable
private String success;
public static final String JSON_PROPERTY_START_DATE = "start_date";
@jakarta.annotation.Nullable
private String startDate;
public static final String JSON_PROPERTY_END_DATE = "end_date";
@jakarta.annotation.Nullable
private String endDate;
/**
* Gets or Sets reportType
*/
public enum ReportTypeEnum {
USER_ACTIVITY(String.valueOf("user_activity")),
DOCUMENT_STATUS(String.valueOf("document_status")),
SMS_ACTIVITY(String.valueOf("sms_activity"));
private String value;
ReportTypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ReportTypeEnum fromValue(String value) {
for (ReportTypeEnum b : ReportTypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_REPORT_TYPE = "report_type";
@jakarta.annotation.Nullable
private List<ReportTypeEnum> reportType = null;
public ReportResponse() {
}
/**
* Attempt to instantiate and hydrate a new instance of this class
* @param jsonData String of JSON data representing target object
*/
static public ReportResponse init(String jsonData) throws Exception {
return new ObjectMapper().readValue(jsonData, ReportResponse.class);
}
static public ReportResponse init(HashMap data) throws Exception {
return new ObjectMapper().readValue(
new ObjectMapper().writeValueAsString(data),
ReportResponse.class
);
}
public ReportResponse success(@jakarta.annotation.Nullable String success) {
this.success = success;
return this;
}
/**
* A message indicating the requested operation's success
* @return success
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SUCCESS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSuccess() {
return success;
}
@JsonProperty(JSON_PROPERTY_SUCCESS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setSuccess(@jakarta.annotation.Nullable String success) {
this.success = success;
}
public ReportResponse startDate(@jakarta.annotation.Nullable String startDate) {
this.startDate = startDate;
return this;
}
/**
* The (inclusive) start date for the report data in MM/DD/YYYY format.
* @return startDate
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_START_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getStartDate() {
return startDate;
}
@JsonProperty(JSON_PROPERTY_START_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setStartDate(@jakarta.annotation.Nullable String startDate) {
this.startDate = startDate;
}
public ReportResponse endDate(@jakarta.annotation.Nullable String endDate) {
this.endDate = endDate;
return this;
}
/**
* The (inclusive) end date for the report data in MM/DD/YYYY format.
* @return endDate
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_END_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getEndDate() {
return endDate;
}
@JsonProperty(JSON_PROPERTY_END_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEndDate(@jakarta.annotation.Nullable String endDate) {
this.endDate = endDate;
}
public ReportResponse reportType(@jakarta.annotation.Nullable List<ReportTypeEnum> reportType) {
this.reportType = reportType;
return this;
}
public ReportResponse addReportTypeItem(ReportTypeEnum reportTypeItem) {
if (this.reportType == null) {
this.reportType = new ArrayList<>();
}
this.reportType.add(reportTypeItem);
return this;
}
/**
* The type(s) of the report you are requesting. Allowed values are \"user_activity\" and \"document_status\". User activity reports contain list of all users and their activity during the specified date range. Document status report contain a list of signature requests created in the specified time range (and their status).
* @return reportType
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_REPORT_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<ReportTypeEnum> getReportType() {
return reportType;
}
@JsonProperty(JSON_PROPERTY_REPORT_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setReportType(@jakarta.annotation.Nullable List<ReportTypeEnum> reportType) {
this.reportType = reportType;
}
/**
* Return true if this ReportResponse object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ReportResponse reportResponse = (ReportResponse) o;
return Objects.equals(this.success, reportResponse.success) &&
Objects.equals(this.startDate, reportResponse.startDate) &&
Objects.equals(this.endDate, reportResponse.endDate) &&
Objects.equals(this.reportType, reportResponse.reportType);
}
@Override
public int hashCode() {
return Objects.hash(success, startDate, endDate, reportType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ReportResponse {\n");
sb.append(" success: ").append(toIndentedString(success)).append("\n");
sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n");
sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n");
sb.append(" reportType: ").append(toIndentedString(reportType)).append("\n");
sb.append("}");
return sb.toString();
}
public Map<String, Object> createFormData() throws ApiException {
Map<String, Object> map = new HashMap<>();
boolean fileTypeFound = false;
try {
if (success != null) {
if (isFileTypeOrListOfFiles(success)) {
fileTypeFound = true;
}
if (success.getClass().equals(java.io.File.class) ||
success.getClass().equals(Integer.class) ||
success.getClass().equals(String.class) ||
success.getClass().isEnum()) {
map.put("success", success);
} else if (isListOfFile(success)) {
for(int i = 0; i< getListSize(success); i++) {
map.put("success[" + i + "]", getFromList(success, i));
}
}
else {
map.put("success", JSON.getDefault().getMapper().writeValueAsString(success));
}
}
if (startDate != null) {
if (isFileTypeOrListOfFiles(startDate)) {
fileTypeFound = true;
}
if (startDate.getClass().equals(java.io.File.class) ||
startDate.getClass().equals(Integer.class) ||
startDate.getClass().equals(String.class) ||
startDate.getClass().isEnum()) {
map.put("start_date", startDate);
} else if (isListOfFile(startDate)) {
for(int i = 0; i< getListSize(startDate); i++) {
map.put("start_date[" + i + "]", getFromList(startDate, i));
}
}
else {
map.put("start_date", JSON.getDefault().getMapper().writeValueAsString(startDate));
}
}
if (endDate != null) {
if (isFileTypeOrListOfFiles(endDate)) {
fileTypeFound = true;
}
if (endDate.getClass().equals(java.io.File.class) ||
endDate.getClass().equals(Integer.class) ||
endDate.getClass().equals(String.class) ||
endDate.getClass().isEnum()) {
map.put("end_date", endDate);
} else if (isListOfFile(endDate)) {
for(int i = 0; i< getListSize(endDate); i++) {
map.put("end_date[" + i + "]", getFromList(endDate, i));
}
}
else {
map.put("end_date", JSON.getDefault().getMapper().writeValueAsString(endDate));
}
}
if (reportType != null) {
if (isFileTypeOrListOfFiles(reportType)) {
fileTypeFound = true;
}
if (reportType.getClass().equals(java.io.File.class) ||
reportType.getClass().equals(Integer.class) ||
reportType.getClass().equals(String.class) ||
reportType.getClass().isEnum()) {
map.put("report_type", reportType);
} else if (isListOfFile(reportType)) {
for(int i = 0; i< getListSize(reportType); i++) {
map.put("report_type[" + i + "]", getFromList(reportType, i));
}
}
else {
map.put("report_type", JSON.getDefault().getMapper().writeValueAsString(reportType));
}
}
} catch (Exception e) {
throw new ApiException(e);
}
return fileTypeFound ? map : new HashMap<>();
}
private boolean isFileTypeOrListOfFiles(Object obj) throws Exception {
return obj.getClass().equals(java.io.File.class) || isListOfFile(obj);
}
private boolean isListOfFile(Object obj) throws Exception {
return obj instanceof java.util.List && !isListEmpty(obj) && getFromList(obj, 0) instanceof java.io.File;
}
private boolean isListEmpty(Object obj) throws Exception {
return (boolean) Class.forName(java.util.List.class.getName()).getMethod("isEmpty").invoke(obj);
}
private Object getFromList(Object obj, int index) throws Exception {
return Class.forName(java.util.List.class.getName()).getMethod("get", int.class).invoke(obj, index);
}
private int getListSize(Object obj) throws Exception {
return (int) Class.forName(java.util.List.class.getName()).getMethod("size").invoke(obj);
}
/**
* 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 ");
}
}