forked from intercom/intercom-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotification.java
More file actions
217 lines (170 loc) · 6.01 KB
/
Copy pathNotification.java
File metadata and controls
217 lines (170 loc) · 6.01 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
package io.intercom.api;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Maps;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.Map;
@SuppressWarnings("UnusedDeclaration")
@JsonIgnoreProperties({"intercom"})
public class Notification extends TypedData {
public static Notification readJSON(String json) throws InvalidException {
try {
return MapperSupport.objectMapper().readValue(json, Notification.class);
} catch (IOException e) {
throw new InvalidException("could not parse json string [" + e.getMessage() + "]", e);
}
}
public static Notification readJSON(InputStream json) throws InvalidException {
try {
return MapperSupport.objectMapper().readValue(json, Notification.class);
} catch (IOException e) {
throw new InvalidException("could not parse json stream [" + e.getMessage() + "]", e);
}
}
@JsonProperty("type")
private final String type = "notification_event";
@JsonProperty("id")
private String id;
@JsonProperty("topic")
private String topic;
@JsonProperty("app_id")
private String appID;
@JsonProperty("data")
private NotificationData data;
@JsonProperty("delivery_status")
private String deliveryStatus;
@JsonProperty("delivery_attempts")
private int deliveryAttempts;
@JsonProperty("delivered_at")
private long deliveredAt;
@JsonProperty("first_sent_at")
private long firstSentAt;
@JsonProperty("created_at")
private long createdAt;
@JsonProperty
private Map<String, URI> links = Maps.newHashMap();
@JsonProperty("self")
private URI self;
public Notification() {
}
public String getType() {
return type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getAppID() {
return appID;
}
public void setAppID(String appID) {
this.appID = appID;
}
public NotificationData getData() {
return data;
}
public void setData(NotificationData data) {
this.data = data;
}
public String getDeliveryStatus() {
return deliveryStatus;
}
public void setDeliveryStatus(String deliveryStatus) {
this.deliveryStatus = deliveryStatus;
}
public int getDeliveryAttempts() {
return deliveryAttempts;
}
public void setDeliveryAttempts(int deliveryAttempts) {
this.deliveryAttempts = deliveryAttempts;
}
public long getDeliveredAt() {
return deliveredAt;
}
public void setDeliveredAt(long deliveredAt) {
this.deliveredAt = deliveredAt;
}
public long getFirstSentAt() {
return firstSentAt;
}
public void setFirstSentAt(long firstSentAt) {
this.firstSentAt = firstSentAt;
}
public long getCreatedAt() {
return createdAt;
}
public Map<String, URI> getLinks() {
return links;
}
public void setLinks(Map<String, URI> links) {
this.links = links;
}
public URI getSelf() {
return self;
}
public void setSelf(URI self) {
this.self = self;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (topic != null ? topic.hashCode() : 0);
result = 31 * result + (appID != null ? appID.hashCode() : 0);
result = 31 * result + (data != null ? data.hashCode() : 0);
result = 31 * result + (deliveryStatus != null ? deliveryStatus.hashCode() : 0);
result = 31 * result + deliveryAttempts;
result = 31 * result + (int) (deliveredAt ^ (deliveredAt >>> 32));
result = 31 * result + (int) (firstSentAt ^ (firstSentAt >>> 32));
result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
result = 31 * result + (links != null ? links.hashCode() : 0);
result = 31 * result + (self != null ? self.hashCode() : 0);
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Notification that = (Notification) o;
if (createdAt != that.createdAt) return false;
if (deliveredAt != that.deliveredAt) return false;
if (deliveryAttempts != that.deliveryAttempts) return false;
if (firstSentAt != that.firstSentAt) return false;
if (appID != null ? !appID.equals(that.appID) : that.appID != null) return false;
if (data != null ? !data.equals(that.data) : that.data != null) return false;
if (deliveryStatus != null ? !deliveryStatus.equals(that.deliveryStatus) : that.deliveryStatus != null)
return false;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
if (links != null ? !links.equals(that.links) : that.links != null) return false;
if (self != null ? !self.equals(that.self) : that.self != null) return false;
//noinspection RedundantIfStatement
if (topic != null ? !topic.equals(that.topic) : that.topic != null) return false;
return true;
}
@Override
public String toString() {
return "Notification{" +
"type='" + type + '\'' +
", id='" + id + '\'' +
", topic='" + topic + '\'' +
", appID='" + appID + '\'' +
", data=" + data +
", deliveryStatus='" + deliveryStatus + '\'' +
", deliveryAttempts=" + deliveryAttempts +
", deliveredAt=" + deliveredAt +
", firstSentAt=" + firstSentAt +
", createdAt=" + createdAt +
", links=" + links +
", self=" + self +
"} " + super.toString();
}
}