Repository navigation
Expand file tree
/
Copy pathModelsCreateEvent.java
More file actions
391 lines (327 loc) · 13.2 KB
/
Copy pathModelsCreateEvent.java
File metadata and controls
391 lines (327 loc) · 13.2 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
/*
* Convoy API Reference
* Convoy is a fast and secure webhooks proxy. This document contains datastore's API specification.
*
* The version of the OpenAPI document: 26.3.5
* Contact: support@getconvoy.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 com.getconvoy.models;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
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.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.getconvoy.client.ApiClient;
/**
* ModelsCreateEvent
*/
@JsonPropertyOrder({
ModelsCreateEvent.JSON_PROPERTY_APP_ID,
ModelsCreateEvent.JSON_PROPERTY_CUSTOM_HEADERS,
ModelsCreateEvent.JSON_PROPERTY_DATA,
ModelsCreateEvent.JSON_PROPERTY_ENDPOINT_ID,
ModelsCreateEvent.JSON_PROPERTY_EVENT_TYPE,
ModelsCreateEvent.JSON_PROPERTY_IDEMPOTENCY_KEY
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0")
public class ModelsCreateEvent {
public static final String JSON_PROPERTY_APP_ID = "app_id";
@jakarta.annotation.Nullable
private String appId;
public static final String JSON_PROPERTY_CUSTOM_HEADERS = "custom_headers";
private JsonNullable<Map<String, String>> customHeaders = JsonNullable.<Map<String, String>>undefined();
public static final String JSON_PROPERTY_DATA = "data";
private JsonNullable<Map<String, Object>> data = JsonNullable.<Map<String, Object>>undefined();
public static final String JSON_PROPERTY_ENDPOINT_ID = "endpoint_id";
@jakarta.annotation.Nullable
private String endpointId;
public static final String JSON_PROPERTY_EVENT_TYPE = "event_type";
@jakarta.annotation.Nullable
private String eventType;
public static final String JSON_PROPERTY_IDEMPOTENCY_KEY = "idempotency_key";
@jakarta.annotation.Nullable
private String idempotencyKey;
public ModelsCreateEvent() {
}
public ModelsCreateEvent appId(@jakarta.annotation.Nullable String appId) {
this.appId = appId;
return this;
}
/**
* Deprecated but necessary for backward compatibility.
* @return appId
*/
@jakarta.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_APP_ID, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getAppId() {
return appId;
}
@JsonProperty(value = JSON_PROPERTY_APP_ID, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setAppId(@jakarta.annotation.Nullable String appId) {
this.appId = appId;
}
public ModelsCreateEvent customHeaders(@jakarta.annotation.Nullable Map<String, String> customHeaders) {
this.customHeaders = JsonNullable.<Map<String, String>>of(customHeaders);
return this;
}
public ModelsCreateEvent putCustomHeadersItem(String key, String customHeadersItem) {
if (this.customHeaders == null || !this.customHeaders.isPresent() || this.customHeaders.get() == null) {
this.customHeaders = JsonNullable.<Map<String, String>>of(new HashMap<>());
}
try {
this.customHeaders.get().put(key, customHeadersItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Specifies custom headers you want convoy to add when the event is dispatched to your endpoint
* @return customHeaders
*/
@jakarta.annotation.Nullable
@JsonIgnore
public Map<String, String> getCustomHeaders() {
return customHeaders.orElse(null);
}
@JsonProperty(value = JSON_PROPERTY_CUSTOM_HEADERS, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Map<String, String>> getCustomHeaders_JsonNullable() {
return customHeaders;
}
@JsonProperty(JSON_PROPERTY_CUSTOM_HEADERS)
public void setCustomHeaders_JsonNullable(JsonNullable<Map<String, String>> customHeaders) {
this.customHeaders = customHeaders;
}
public void setCustomHeaders(@jakarta.annotation.Nullable Map<String, String> customHeaders) {
this.customHeaders = JsonNullable.<Map<String, String>>of(customHeaders);
}
public ModelsCreateEvent data(@jakarta.annotation.Nullable Map<String, Object> data) {
this.data = JsonNullable.<Map<String, Object>>of(data);
return this;
}
public ModelsCreateEvent putDataItem(String key, Object dataItem) {
if (this.data == null || !this.data.isPresent() || this.data.get() == null) {
this.data = JsonNullable.<Map<String, Object>>of(new HashMap<>());
}
try {
this.data.get().put(key, dataItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Data is an arbitrary JSON value that gets sent as the body of the webhook to the endpoints
* @return data
*/
@jakarta.annotation.Nullable
@JsonIgnore
public Map<String, Object> getData() {
return data.orElse(null);
}
@JsonProperty(value = JSON_PROPERTY_DATA, required = false)
@JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<Map<String, Object>> getData_JsonNullable() {
return data;
}
@JsonProperty(JSON_PROPERTY_DATA)
public void setData_JsonNullable(JsonNullable<Map<String, Object>> data) {
this.data = data;
}
public void setData(@jakarta.annotation.Nullable Map<String, Object> data) {
this.data = JsonNullable.<Map<String, Object>>of(data);
}
public ModelsCreateEvent endpointId(@jakarta.annotation.Nullable String endpointId) {
this.endpointId = endpointId;
return this;
}
/**
* Specifies the endpoint to send this event to. Required unless the deprecated app_id is provided.
* @return endpointId
*/
@jakarta.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_ENDPOINT_ID, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getEndpointId() {
return endpointId;
}
@JsonProperty(value = JSON_PROPERTY_ENDPOINT_ID, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEndpointId(@jakarta.annotation.Nullable String endpointId) {
this.endpointId = endpointId;
}
public ModelsCreateEvent eventType(@jakarta.annotation.Nullable String eventType) {
this.eventType = eventType;
return this;
}
/**
* Event Type is used for filtering and debugging e.g invoice.paid
* @return eventType
*/
@jakarta.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_EVENT_TYPE, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getEventType() {
return eventType;
}
@JsonProperty(value = JSON_PROPERTY_EVENT_TYPE, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEventType(@jakarta.annotation.Nullable String eventType) {
this.eventType = eventType;
}
public ModelsCreateEvent idempotencyKey(@jakarta.annotation.Nullable String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
return this;
}
/**
* Specify a key for event deduplication
* @return idempotencyKey
*/
@jakarta.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_IDEMPOTENCY_KEY, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getIdempotencyKey() {
return idempotencyKey;
}
@JsonProperty(value = JSON_PROPERTY_IDEMPOTENCY_KEY, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setIdempotencyKey(@jakarta.annotation.Nullable String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
}
/**
* Return true if this models.CreateEvent object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelsCreateEvent modelsCreateEvent = (ModelsCreateEvent) o;
return Objects.equals(this.appId, modelsCreateEvent.appId) &&
equalsNullable(this.customHeaders, modelsCreateEvent.customHeaders) &&
equalsNullable(this.data, modelsCreateEvent.data) &&
Objects.equals(this.endpointId, modelsCreateEvent.endpointId) &&
Objects.equals(this.eventType, modelsCreateEvent.eventType) &&
Objects.equals(this.idempotencyKey, modelsCreateEvent.idempotencyKey);
}
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(appId, hashCodeNullable(customHeaders), hashCodeNullable(data), endpointId, eventType, idempotencyKey);
}
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 ModelsCreateEvent {\n");
sb.append(" appId: ").append(toIndentedString(appId)).append("\n");
sb.append(" customHeaders: ").append(toIndentedString(customHeaders)).append("\n");
sb.append(" data: ").append(toIndentedString(data)).append("\n");
sb.append(" endpointId: ").append(toIndentedString(endpointId)).append("\n");
sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n");
sb.append(" idempotencyKey: ").append(toIndentedString(idempotencyKey)).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) {
return o == null ? "null" : o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `app_id` to the URL query string
if (getAppId() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sapp_id%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getAppId()))));
}
// add `custom_headers` to the URL query string
if (getCustomHeaders() != null) {
for (String _key : getCustomHeaders().keySet()) {
joiner.add(String.format(java.util.Locale.ROOT, "%scustom_headers%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
getCustomHeaders().get(_key), ApiClient.urlEncode(ApiClient.valueToString(getCustomHeaders().get(_key)))));
}
}
// add `data` to the URL query string
if (getData() != null) {
for (String _key : getData().keySet()) {
joiner.add(String.format(java.util.Locale.ROOT, "%sdata%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix),
getData().get(_key), ApiClient.urlEncode(ApiClient.valueToString(getData().get(_key)))));
}
}
// add `endpoint_id` to the URL query string
if (getEndpointId() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sendpoint_id%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEndpointId()))));
}
// add `event_type` to the URL query string
if (getEventType() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sevent_type%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEventType()))));
}
// add `idempotency_key` to the URL query string
if (getIdempotencyKey() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sidempotency_key%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getIdempotencyKey()))));
}
return joiner.toString();
}
}