Skip to content

Commit

Permalink
Merge pull request #268 from caionovaes/feature-user-related-info
Browse files Browse the repository at this point in the history
Implemented model and method for getting user related information and updated README
  • Loading branch information
aheritier authored Sep 23, 2018
2 parents 3378232 + b4d71f0 commit 590ea40
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/zendesk/client/v2/Zendesk.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -451,6 +452,11 @@ public Iterable<Ticket> 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<Metric> getTicketMetrics() {
return new PagedIterable<>(cnst("/ticket_metrics.json"), handleList(Metric.class, "ticket_metrics"));
}
Expand Down
128 changes: 128 additions & 0 deletions src/main/java/org/zendesk/client/v2/model/UserRelatedInfo.java
Original file line number Diff line number Diff line change
@@ -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 +
'}';
}
}

0 comments on commit 590ea40

Please sign in to comment.