diff --git a/README.md b/README.md index 36cf60ac..a5856d8b 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Here is the status of the various API components: * [Ticket Forms](http://developer.zendesk.com/documentation/rest_api/ticket_forms.html) *getTicketForm() and getTicketForms()* * [Views](http://developer.zendesk.com/documentation/rest_api/views.html) * [Users](http://developer.zendesk.com/documentation/rest_api/users.html) ✓ + * [User Related Information](https://developer.zendesk.com/rest_api/docs/core/users#user-related-information) ✓ * [User Fields](https://developer.zendesk.com/rest_api/docs/core/user_fields.html) - Partial - List User Fields (`getUserField()`) * [Requests](http://developer.zendesk.com/documentation/rest_api/requests.html) ✓ * [User Identities](http://developer.zendesk.com/documentation/rest_api/user_identities.html) ✓ diff --git a/src/main/java/org/zendesk/client/v2/Zendesk.java b/src/main/java/org/zendesk/client/v2/Zendesk.java index 5dec9b34..7292d37f 100644 --- a/src/main/java/org/zendesk/client/v2/Zendesk.java +++ b/src/main/java/org/zendesk/client/v2/Zendesk.java @@ -52,6 +52,7 @@ import org.zendesk.client.v2.model.TwitterMonitor; import org.zendesk.client.v2.model.User; import org.zendesk.client.v2.model.UserField; +import org.zendesk.client.v2.model.UserRelatedInfo; import org.zendesk.client.v2.model.hc.Article; import org.zendesk.client.v2.model.hc.ArticleAttachments; import org.zendesk.client.v2.model.hc.Category; @@ -451,6 +452,11 @@ public Iterable getUserCCDTickets(long userId) { handleList(Ticket.class, "tickets")); } + public UserRelatedInfo getUserRelatedInfo(long userId) { + return complete(submit(req("GET", tmpl("/users/{userId}/related.json").set("userId", userId)), + handle(UserRelatedInfo.class, "user_related"))); + } + public Iterable getTicketMetrics() { return new PagedIterable<>(cnst("/ticket_metrics.json"), handleList(Metric.class, "ticket_metrics")); } diff --git a/src/main/java/org/zendesk/client/v2/model/UserRelatedInfo.java b/src/main/java/org/zendesk/client/v2/model/UserRelatedInfo.java new file mode 100644 index 00000000..8fe304b6 --- /dev/null +++ b/src/main/java/org/zendesk/client/v2/model/UserRelatedInfo.java @@ -0,0 +1,128 @@ +package org.zendesk.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + * @author caionovaes + * @since 08/24/2018 + */ +public class UserRelatedInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonProperty(value = "assigned_tickets") + private Integer assignedTickets; + @JsonProperty(value = "requested_tickets") + private Integer requestedTickets; + private Integer topics; + @JsonProperty(value = "topic_comments") + private Integer topicComments; + private Integer votes; + private Integer subscriptions; + @JsonProperty(value = "entry_subscriptions") + private Integer entrySubscriptions; + @JsonProperty(value = "forum_subscriptions") + private Integer forumSubscriptions; + @JsonProperty(value = "organization_subscriptions") + private Integer organizationSubscriptions; + @JsonProperty(value = "ccd_tickets") + private Integer ccdTickets; + + public Integer getAssignedTickets() { + return assignedTickets; + } + + public void setAssignedTickets(Integer assignedTickets) { + this.assignedTickets = assignedTickets; + } + + public Integer getRequestedTickets() { + return requestedTickets; + } + + public void setRequestedTickets(Integer requestedTickets) { + this.requestedTickets = requestedTickets; + } + + public Integer getTopics() { + return topics; + } + + public void setTopics(Integer topics) { + this.topics = topics; + } + + public Integer getTopicComments() { + return topicComments; + } + + public void setTopicComments(Integer topicComments) { + this.topicComments = topicComments; + } + + public Integer getVotes() { + return votes; + } + + public void setVotes(Integer votes) { + this.votes = votes; + } + + public Integer getSubscriptions() { + return subscriptions; + } + + public void setSubscriptions(Integer subscriptions) { + this.subscriptions = subscriptions; + } + + public Integer getEntrySubscriptions() { + return entrySubscriptions; + } + + public void setEntrySubscriptions(Integer entrySubscriptions) { + this.entrySubscriptions = entrySubscriptions; + } + + public Integer getForumSubscriptions() { + return forumSubscriptions; + } + + public void setForumSubscriptions(Integer forumSubscriptions) { + this.forumSubscriptions = forumSubscriptions; + } + + public Integer getOrganizationSubscriptions() { + return organizationSubscriptions; + } + + public void setOrganizationSubscriptions(Integer organizationSubscriptions) { + this.organizationSubscriptions = organizationSubscriptions; + } + + public Integer getCcdTickets() { + return ccdTickets; + } + + public void setCcdTickets(Integer ccdTickets) { + this.ccdTickets = ccdTickets; + } + + @Override + public String toString() { + return "UserRelatedInfo{" + + "assignedTickets=" + assignedTickets + + ", requestedTickets=" + requestedTickets + + ", topics=" + topics + + ", topicComments=" + topicComments + + ", votes=" + votes + + ", subscriptions=" + subscriptions + + ", entrySubscriptions=" + entrySubscriptions + + ", forumSubscriptions=" + forumSubscriptions + + ", organizationSubscriptions=" + organizationSubscriptions + + ", ccdTickets=" + ccdTickets + + '}'; + } +}