Skip to content

Commit 794a361

Browse files
author
Timothy Lim
committed
Add support for new company attributes + add tests
1 parent 2751b32 commit 794a361

File tree

6 files changed

+396
-13
lines changed

6 files changed

+396
-13
lines changed

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

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public static Company update(Company company) throws InvalidException, Authoriza
4040
entity.setSessionCount(company.getSessionCount());
4141
entity.setMonthlySpend(company.getMonthlySpend());
4242
entity.setRemoteCreatedAt(company.getRemoteCreatedAt());
43+
entity.setIndustry(company.getIndustry());
44+
entity.setSize(company.getSize());
45+
entity.setWebsite(company.getWebsite());
4346
if(company.getCustomAttributes() != null) {
4447
entity.getCustomAttributes().putAll(company.getCustomAttributes());
4548
}
@@ -181,6 +184,9 @@ public String toString() {
181184
@JsonProperty("remote_created_at")
182185
private long remoteCreatedAt;
183186

187+
@JsonProperty("last_request_at")
188+
private long lastRequestAt;
189+
184190
@JsonProperty("created_at")
185191
private long createdAt;
186192

@@ -193,6 +199,15 @@ public String toString() {
193199
@JsonProperty("user_count")
194200
private Integer userCount;
195201

202+
@JsonProperty("size")
203+
private int size;
204+
205+
@JsonProperty("website")
206+
private String website;
207+
208+
@JsonProperty("industry")
209+
private String industry;
210+
196211
@JsonIgnoreProperties(ignoreUnknown = false)
197212
@JsonProperty("custom_attributes")
198213
private Map<String, CustomAttribute> customAttributes = Maps.newHashMap();
@@ -236,6 +251,33 @@ public Company setName(String name) {
236251
return this;
237252
}
238253

254+
public int getSize() {
255+
return size;
256+
}
257+
258+
public Company setSize(int size) {
259+
this.size = size;
260+
return this;
261+
}
262+
263+
public String getWebsite() {
264+
return website;
265+
}
266+
267+
public Company setWebsite(String website) {
268+
this.website = website;
269+
return this;
270+
}
271+
272+
public String getIndustry() {
273+
return industry;
274+
}
275+
276+
public Company setIndustry(String industry) {
277+
this.industry = industry;
278+
return this;
279+
}
280+
239281
public long getCreatedAt() {
240282
return createdAt;
241283
}
@@ -257,19 +299,6 @@ public int getSessionCount() {
257299
return sessionCount;
258300
}
259301

260-
/**
261-
* Deprecated. The Intercom API does not support changing the
262-
* session value for a company. Calling this method has no
263-
* effect.
264-
*
265-
* @param sessionCount this value is ignored
266-
* @return the company object
267-
*/
268-
@Deprecated
269-
public Company setSessionCount(int sessionCount) {
270-
return this;
271-
}
272-
273302
public long getRemoteCreatedAt() {
274303
return remoteCreatedAt;
275304
}
@@ -279,6 +308,15 @@ public Company setRemoteCreatedAt(long remoteCreatedAt) {
279308
return this;
280309
}
281310

311+
public long getLastRequestAt() {
312+
return lastRequestAt;
313+
}
314+
315+
public Company setLastRequestAt(long lastRequestAt) {
316+
this.lastRequestAt = lastRequestAt;
317+
return this;
318+
}
319+
282320
public Map<String, CustomAttribute> getCustomAttributes() {
283321
return customAttributes;
284322
}
@@ -339,6 +377,7 @@ public boolean equals(Object o) {
339377
if (remoteCreatedAt != company.remoteCreatedAt) return false;
340378
if (sessionCount != company.sessionCount) return false;
341379
if (updatedAt != company.updatedAt) return false;
380+
if (lastRequestAt != company.lastRequestAt) return false;
342381
if (companyID != null ? !companyID.equals(company.companyID) : company.companyID != null) return false;
343382
if (customAttributes != null ? !customAttributes.equals(company.customAttributes) : company.customAttributes != null)
344383
return false;
@@ -353,6 +392,9 @@ public boolean equals(Object o) {
353392
if (untag != null ? !untag.equals(company.untag) : company.untag != null) return false;
354393
//noinspection RedundantIfStatement
355394
if (userCount != null ? !userCount.equals(company.userCount) : company.userCount != null) return false;
395+
if (size != company.size) return false;
396+
if (website != null ? !website.equals(company.website) : company.website != null) return false;
397+
if (industry != null ? !industry.equals(company.industry) : company.industry != null) return false;
356398

357399
return true;
358400
}
@@ -368,12 +410,16 @@ public int hashCode() {
368410
result = 31 * result + (int) (remoteCreatedAt ^ (remoteCreatedAt >>> 32));
369411
result = 31 * result + (int) (createdAt ^ (createdAt >>> 32));
370412
result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32));
413+
result = 31 * result + (int) (lastRequestAt ^ (lastRequestAt >>> 32));
371414
result = 31 * result + (plan != null ? plan.hashCode() : 0);
372415
result = 31 * result + (userCount != null ? userCount.hashCode() : 0);
373416
result = 31 * result + (customAttributes != null ? customAttributes.hashCode() : 0);
374417
result = 31 * result + (segmentCollection != null ? segmentCollection.hashCode() : 0);
375418
result = 31 * result + (tagCollection != null ? tagCollection.hashCode() : 0);
376419
result = 31 * result + (untag != null ? untag.hashCode() : 0);
420+
result = 31 * result + size;
421+
result = 31 * result + (website != null ? website.hashCode() : 0);
422+
result = 31 * result + (industry != null ? industry.hashCode() : 0);
377423
return result;
378424
}
379425

@@ -387,11 +433,15 @@ public String toString() {
387433
", monthlySpend=" + monthlySpend +
388434
", remoteCreatedAt=" + remoteCreatedAt +
389435
", createdAt=" + createdAt +
436+
", lastRequestAt=" + lastRequestAt +
390437
", updatedAt=" + updatedAt +
391438
", plan=" + plan +
392439
", customAttributes=" + customAttributes +
393440
", segmentCollection=" + segmentCollection +
394441
", tagCollection=" + tagCollection +
442+
", size=" + size +
443+
", website='" + website + '\'' +
444+
", industry='" + industry + '\'' +
395445
"} " + super.toString();
396446
}
397447

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ private static CompanyWithStringPlan prepareUpdatableCompany(Company company) {
5656
updatableCompany.setSessionCount(company.getSessionCount());
5757
updatableCompany.setMonthlySpend(company.getMonthlySpend());
5858
updatableCompany.setRemoteCreatedAt(company.getRemoteCreatedAt());
59+
updatableCompany.setIndustry(company.getIndustry());
60+
updatableCompany.setSize(company.getSize());
61+
updatableCompany.setWebsite(company.getWebsite());
5962
if (company.getCustomAttributes() != null) {
6063
updatableCompany.getCustomAttributes().putAll(company.getCustomAttributes());
6164
}

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ class CompanyWithStringPlan extends TypedData {
3333
@JsonProperty("plan")
3434
private String plan;
3535

36+
@JsonProperty("size")
37+
private int size;
38+
39+
@JsonProperty("website")
40+
private String website;
41+
42+
@JsonProperty("industry")
43+
private String industry;
44+
3645
@JsonIgnoreProperties(ignoreUnknown = false)
3746
@JsonProperty("custom_attributes")
3847
private Map<String, CustomAttribute> customAttributes = Maps.newHashMap();
@@ -96,6 +105,30 @@ public void setRemoteCreatedAt(long remoteCreatedAt) {
96105
this.remoteCreatedAt = remoteCreatedAt;
97106
}
98107

108+
public int getSize() {
109+
return size;
110+
}
111+
112+
public void setSize(int size) {
113+
this.size = size;
114+
}
115+
116+
public String getWebsite() {
117+
return website;
118+
}
119+
120+
public void setWebsite(String website) {
121+
this.website = website;
122+
}
123+
124+
public String getIndustry() {
125+
return industry;
126+
}
127+
128+
public void setIndustry(String industry) {
129+
this.industry = industry;
130+
}
131+
99132
public String getPlan() {
100133
return plan;
101134
}

0 commit comments

Comments
 (0)