From d36de748530a3759df1b45fdcf9c83f8526b703f Mon Sep 17 00:00:00 2001 From: Timothy Lim Date: Tue, 7 Aug 2018 17:13:33 +0800 Subject: [PATCH] Add support for more company attributes --- .../main/java/io/intercom/api/Company.java | 63 +++++++++++++++++++ .../io/intercom/api/CompanyUpdateBuilder.java | 3 + .../intercom/api/CompanyWithStringPlan.java | 33 ++++++++++ 3 files changed, 99 insertions(+) diff --git a/intercom-java/src/main/java/io/intercom/api/Company.java b/intercom-java/src/main/java/io/intercom/api/Company.java index 1967e638..8c02165b 100644 --- a/intercom-java/src/main/java/io/intercom/api/Company.java +++ b/intercom-java/src/main/java/io/intercom/api/Company.java @@ -40,6 +40,9 @@ public static Company update(Company company) throws InvalidException, Authoriza entity.setSessionCount(company.getSessionCount()); entity.setMonthlySpend(company.getMonthlySpend()); entity.setRemoteCreatedAt(company.getRemoteCreatedAt()); + entity.setIndustry(company.getIndustry()); + entity.setSize(company.getSize()); + entity.setWebsite(company.getWebsite()); if(company.getCustomAttributes() != null) { entity.getCustomAttributes().putAll(company.getCustomAttributes()); } @@ -177,6 +180,9 @@ public String toString() { @JsonProperty("remote_created_at") private long remoteCreatedAt; + @JsonProperty("last_request_at") + private long lastRequestAt; + @JsonProperty("created_at") private long createdAt; @@ -189,6 +195,15 @@ public String toString() { @JsonProperty("user_count") private Integer userCount; + @JsonProperty("size") + private int size; + + @JsonProperty("website") + private String website; + + @JsonProperty("industry") + private String industry; + @JsonIgnoreProperties(ignoreUnknown = false) @JsonProperty("custom_attributes") private Map customAttributes = Maps.newHashMap(); @@ -232,6 +247,33 @@ public Company setName(String name) { return this; } + public int getSize() { + return size; + } + + public Company setSize(int size) { + this.size = size; + return this; + } + + public String getWebsite() { + return website; + } + + public Company setWebsite(String website) { + this.website = website; + return this; + } + + public String getIndustry() { + return industry; + } + + public Company setIndustry(String industry) { + this.industry = industry; + return this; + } + public long getCreatedAt() { return createdAt; } @@ -262,6 +304,15 @@ public Company setRemoteCreatedAt(long remoteCreatedAt) { return this; } + public long getLastRequestAt() { + return lastRequestAt; + } + + public Company setLastRequestAt(long lastRequestAt) { + this.lastRequestAt = lastRequestAt; + return this; + } + public Map getCustomAttributes() { return customAttributes; } @@ -322,6 +373,7 @@ public boolean equals(Object o) { if (remoteCreatedAt != company.remoteCreatedAt) return false; if (sessionCount != company.sessionCount) return false; if (updatedAt != company.updatedAt) return false; + if (lastRequestAt != company.lastRequestAt) return false; if (companyID != null ? !companyID.equals(company.companyID) : company.companyID != null) return false; if (customAttributes != null ? !customAttributes.equals(company.customAttributes) : company.customAttributes != null) return false; @@ -336,6 +388,9 @@ public boolean equals(Object o) { if (untag != null ? !untag.equals(company.untag) : company.untag != null) return false; //noinspection RedundantIfStatement if (userCount != null ? !userCount.equals(company.userCount) : company.userCount != null) return false; + if (size != company.size) return false; + if (website != null ? !website.equals(company.website) : company.website != null) return false; + if (industry != null ? !industry.equals(company.industry) : company.industry != null) return false; return true; } @@ -351,12 +406,16 @@ public int hashCode() { result = 31 * result + (int) (remoteCreatedAt ^ (remoteCreatedAt >>> 32)); result = 31 * result + (int) (createdAt ^ (createdAt >>> 32)); result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32)); + result = 31 * result + (int) (lastRequestAt ^ (lastRequestAt >>> 32)); result = 31 * result + (plan != null ? plan.hashCode() : 0); result = 31 * result + (userCount != null ? userCount.hashCode() : 0); result = 31 * result + (customAttributes != null ? customAttributes.hashCode() : 0); result = 31 * result + (segmentCollection != null ? segmentCollection.hashCode() : 0); result = 31 * result + (tagCollection != null ? tagCollection.hashCode() : 0); result = 31 * result + (untag != null ? untag.hashCode() : 0); + result = 31 * result + size; + result = 31 * result + (website != null ? website.hashCode() : 0); + result = 31 * result + (industry != null ? industry.hashCode() : 0); return result; } @@ -370,11 +429,15 @@ public String toString() { ", monthlySpend=" + monthlySpend + ", remoteCreatedAt=" + remoteCreatedAt + ", createdAt=" + createdAt + + ", lastRequestAt=" + lastRequestAt + ", updatedAt=" + updatedAt + ", plan=" + plan + ", customAttributes=" + customAttributes + ", segmentCollection=" + segmentCollection + ", tagCollection=" + tagCollection + + ", size=" + size + + ", website='" + website + '\'' + + ", industry='" + industry + '\'' + "} " + super.toString(); } diff --git a/intercom-java/src/main/java/io/intercom/api/CompanyUpdateBuilder.java b/intercom-java/src/main/java/io/intercom/api/CompanyUpdateBuilder.java index ef003dc7..894d1802 100644 --- a/intercom-java/src/main/java/io/intercom/api/CompanyUpdateBuilder.java +++ b/intercom-java/src/main/java/io/intercom/api/CompanyUpdateBuilder.java @@ -56,6 +56,9 @@ private static CompanyWithStringPlan prepareUpdatableCompany(Company company) { updatableCompany.setSessionCount(company.getSessionCount()); updatableCompany.setMonthlySpend(company.getMonthlySpend()); updatableCompany.setRemoteCreatedAt(company.getRemoteCreatedAt()); + updatableCompany.setIndustry(company.getIndustry()); + updatableCompany.setSize(company.getSize()); + updatableCompany.setWebsite(company.getWebsite()); if (company.getCustomAttributes() != null) { updatableCompany.getCustomAttributes().putAll(company.getCustomAttributes()); } diff --git a/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java b/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java index d7f603c4..8f1d8296 100644 --- a/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java +++ b/intercom-java/src/main/java/io/intercom/api/CompanyWithStringPlan.java @@ -33,6 +33,15 @@ class CompanyWithStringPlan extends TypedData { @JsonProperty("plan") private String plan; + @JsonProperty("size") + private int size; + + @JsonProperty("website") + private String website; + + @JsonProperty("industry") + private String industry; + @JsonIgnoreProperties(ignoreUnknown = false) @JsonProperty("custom_attributes") private Map customAttributes = Maps.newHashMap(); @@ -96,6 +105,30 @@ public void setRemoteCreatedAt(long remoteCreatedAt) { this.remoteCreatedAt = remoteCreatedAt; } + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public String getWebsite() { + return website; + } + + public void setWebsite(String website) { + this.website = website; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + public String getPlan() { return plan; }