Skip to content

Commit edec32f

Browse files
author
Timothy Lim
committed
Allow admin message to contacts
1 parent 0ec97e7 commit edec32f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: intercom-java/src/main/java/io/intercom/api/AdminMessage.java

+20
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,16 @@ public class AdminMessage extends TypedData {
3737
private Admin admin;
3838

3939
@JsonProperty("to")
40+
private TypedData to(){
41+
if(user != null) return user;
42+
if(contact != null) return contact;
43+
return null;
44+
};
45+
4046
private User user;
4147

48+
private Contact contact;
49+
4250
public AdminMessage() {
4351
}
4452

@@ -121,6 +129,15 @@ public AdminMessage setUser(User user) {
121129
return this;
122130
}
123131

132+
public Contact getContact() {
133+
return contact;
134+
}
135+
136+
public AdminMessage setContact(Contact contact) {
137+
this.contact = contact;
138+
return this;
139+
}
140+
124141
@Override
125142
public boolean equals(Object o) {
126143
if (this == o) return true;
@@ -138,6 +155,7 @@ public boolean equals(Object o) {
138155
if (!type.equals(message.type)) return false;
139156
//noinspection RedundantIfStatement
140157
if (user != null ? !user.equals(message.user) : message.user != null) return false;
158+
if (contact != null ? !contact.equals(message.contact) : message.contact != null) return false;
141159

142160
return true;
143161
}
@@ -153,6 +171,7 @@ public int hashCode() {
153171
result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
154172
result = 31 * result + (admin != null ? admin.hashCode() : 0);
155173
result = 31 * result + (user != null ? user.hashCode() : 0);
174+
result = 31 * result + (contact != null ? contact.hashCode() : 0);
156175
return result;
157176
}
158177

@@ -167,6 +186,7 @@ public String toString() {
167186
", createdAt=" + createdAt +
168187
", admin=" + admin +
169188
", user=" + user +
189+
", contact=" + contact +
170190
"} " + super.toString();
171191
}
172192

0 commit comments

Comments
 (0)