Skip to content

Commit a163cd2

Browse files
author
Timothy Lim
committed
Add phone attribute
1 parent 4fdf0b5 commit a163cd2

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

intercom-java/src/main/java/io/intercom/api/Contact.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static ContactUpdate buildFrom(Contact c) {
183183
contactUpdate.id = c.getID(); // propagated, noset
184184
contactUpdate.userID = c.getUserID(); // propagated, noset
185185
contactUpdate.email = c.getEmail();
186+
contactUpdate.phone = c.getPhone();
186187
contactUpdate.name = c.getName();
187188
contactUpdate.lastSeenIP = c.getLastSeenIP();
188189
contactUpdate.customAttributes = c.getCustomAttributes();
@@ -204,6 +205,9 @@ static ContactUpdate buildFrom(Contact c) {
204205
@JsonProperty("email")
205206
private String email;
206207

208+
@JsonProperty("phone")
209+
private String phone;
210+
207211
@JsonProperty("name")
208212
private String name;
209213

@@ -263,6 +267,10 @@ public String getEmail() {
263267
return email;
264268
}
265269

270+
public String getPhone() {
271+
return phone;
272+
}
273+
266274
public String getName() {
267275
return name;
268276
}
@@ -313,6 +321,9 @@ public Boolean isNewSession() {
313321
@JsonProperty("email")
314322
private String email;
315323

324+
@JsonProperty("phone")
325+
private String phone;
326+
316327
@JsonProperty("name")
317328
private String name;
318329

@@ -424,6 +435,15 @@ public Contact setEmail(String email) {
424435
return this;
425436
}
426437

438+
public String getPhone() {
439+
return phone;
440+
}
441+
442+
public Contact setPhone(String phone) {
443+
this.phone = phone;
444+
return this;
445+
}
446+
427447
public String getUserID() {
428448
return userID;
429449
}
@@ -532,6 +552,7 @@ public boolean equals(Object o) {
532552
if (id != null ? !id.equals(contact.id) : contact.id != null) return false;
533553
if (name != null ? !name.equals(contact.name) : contact.name != null) return false;
534554
if (email != null ? !email.equals(contact.email) : contact.email != null) return false;
555+
if (phone != null ? !phone.equals(contact.phone) : contact.phone != null) return false;
535556
if (userID != null ? !userID.equals(contact.userID) : contact.userID != null) return false;
536557
if (avatar != null ? !avatar.equals(contact.avatar) : contact.avatar != null) return false;
537558
if (unsubscribedFromEmails != null ? !unsubscribedFromEmails.equals(contact.unsubscribedFromEmails) : contact.unsubscribedFromEmails != null)
@@ -565,6 +586,7 @@ public int hashCode() {
565586
result = 31 * result + (id != null ? id.hashCode() : 0);
566587
result = 31 * result + (name != null ? name.hashCode() : 0);
567588
result = 31 * result + (email != null ? email.hashCode() : 0);
589+
result = 31 * result + (phone != null ? phone.hashCode() : 0);
568590
result = 31 * result + (userID != null ? userID.hashCode() : 0);
569591
result = 31 * result + (avatar != null ? avatar.hashCode() : 0);
570592
result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
@@ -593,6 +615,7 @@ public String toString() {
593615
", id='" + id + '\'' +
594616
", name='" + name + '\'' +
595617
", email='" + email + '\'' +
618+
", phone='" + phone + '\'' +
596619
", userID='" + userID + '\'' +
597620
", avatar=" + avatar +
598621
", createdAt=" + createdAt +

intercom-java/src/main/java/io/intercom/api/User.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static UserUpdate buildFrom(User user) {
9696
final UserUpdate userUpdate = new UserUpdate();
9797
userUpdate.userId = user.getUserId();
9898
userUpdate.email = user.getEmail();
99+
userUpdate.phone = user.getPhone();
99100
userUpdate.id = user.getId();
100101
userUpdate.remoteCreatedAt = user.getRemoteCreatedAt();
101102
userUpdate.name = user.getName();
@@ -139,6 +140,9 @@ static List<JobItem<UserUpdate>> validateAndConvertJobItems(List<JobItem<User>>
139140
@JsonProperty("email")
140141
private String email;
141142

143+
@JsonProperty("phone")
144+
private String phone;
145+
142146
@JsonProperty("remote_created_at")
143147
private long remoteCreatedAt;
144148

@@ -210,6 +214,10 @@ public String getEmail() {
210214
return email;
211215
}
212216

217+
public String getPhone() {
218+
return phone;
219+
}
220+
213221
public long getRemoteCreatedAt() {
214222
return remoteCreatedAt;
215223
}
@@ -268,6 +276,9 @@ public Boolean isNewSession() {
268276
@JsonProperty("email")
269277
private String email;
270278

279+
@JsonProperty("phone")
280+
private String phone;
281+
271282
@JsonProperty("user_id")
272283
private String userId;
273284

@@ -382,6 +393,15 @@ public User setEmail(String email) {
382393
return this;
383394
}
384395

396+
public String getPhone() {
397+
return phone;
398+
}
399+
400+
public User setPhone(String phone) {
401+
this.phone = phone;
402+
return this;
403+
}
404+
385405
public String getUserId() {
386406
return userId;
387407
}
@@ -563,6 +583,7 @@ public boolean equals(Object o) {
563583
if (customAttributes != null ? !customAttributes.equals(user.customAttributes) : user.customAttributes != null)
564584
return false;
565585
if (email != null ? !email.equals(user.email) : user.email != null) return false;
586+
if (phone != null ? !phone.equals(user.phone) : user.phone != null) return false;
566587
if (id != null ? !id.equals(user.id) : user.id != null) return false;
567588
if (lastSeenIp != null ? !lastSeenIp.equals(user.lastSeenIp) : user.lastSeenIp != null) return false;
568589
if (locationData != null ? !locationData.equals(user.locationData) : user.locationData != null) return false;
@@ -590,6 +611,7 @@ public int hashCode() {
590611
result = 31 * result + (id != null ? id.hashCode() : 0);
591612
result = 31 * result + (name != null ? name.hashCode() : 0);
592613
result = 31 * result + (email != null ? email.hashCode() : 0);
614+
result = 31 * result + (phone != null ? phone.hashCode() : 0);
593615
result = 31 * result + (userId != null ? userId.hashCode() : 0);
594616
result = 31 * result + (pseudonym != null ? pseudonym.hashCode() : 0);
595617
result = 31 * result + (avatar != null ? avatar.hashCode() : 0);
@@ -621,6 +643,7 @@ public String toString() {
621643
", id='" + id + '\'' +
622644
", name='" + name + '\'' +
623645
", email='" + email + '\'' +
646+
", phone='" + phone + '\'' +
624647
", userId='" + userId + '\'' +
625648
", avatar=" + avatar +
626649
", createdAt=" + createdAt +

intercom-java/src/test/java/io/intercom/api/UserTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void TestUserUpdate() throws Exception {
3333
final long now = System.currentTimeMillis() / 1000;
3434
final User user = new User()
3535
.setEmail("[email protected]")
36+
.setPhone("+1234567890")
3637
.setId("54321")
3738
.setUserId("22")
3839
.setRemoteCreatedAt(now)
@@ -46,6 +47,7 @@ public void TestUserUpdate() throws Exception {
4647

4748
assertEquals("54321", userUpdate.getId());
4849
assertEquals("[email protected]", userUpdate.getEmail());
50+
assertEquals("+1234567890", userUpdate.getPhone());
4951
assertEquals("22", userUpdate.getUserId());
5052
assertEquals(now, userUpdate.getRemoteCreatedAt());
5153
assertEquals("Wash", userUpdate.getName());
@@ -169,6 +171,7 @@ public void TestSerdes() throws Exception {
169171
assertEquals("530370b477ad7120001d", user.getId());
170172
assertEquals("25", user.getUserId());
171173
assertEquals("[email protected]", user.getEmail());
174+
assertEquals("+1234567890", user.getPhone());
172175
assertEquals("Hoban Washburne", user.getName());
173176
assertEquals(0, user.getSessionCount());
174177
assertEquals("1.2.3.4", user.getLastSeenIp());

intercom-java/src/test/resources/user.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"id": "530370b477ad7120001d",
44
"user_id": "25",
55
"email": "[email protected]",
6+
"phone": "+1234567890",
67
"name": "Hoban Washburne",
78
"remote_created_at": 1392731331,
89
"updated_at": 1392734388,

0 commit comments

Comments
 (0)