Skip to content

Commit d7c031b

Browse files
author
bob
committed
Add basic View support - List the Views; List the tickets in a View
Provide basic functionality for views. Support getting a list of the Views. Then, using the view id, we can get a list of the Tickets in the View.
1 parent c8b4c03 commit d7c031b

File tree

3 files changed

+156
-2
lines changed

3 files changed

+156
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<groupId>com.cloudbees.thirdparty</groupId>
2727
<artifactId>zendesk-java-client</artifactId>
28-
<version>0.17.1-SNAPSHOT</version>
28+
<version>0.17.2-SNAPSHOT</version>
2929

3030
<name>zendesk-java-client</name>
3131
<description>Java client for the Zendesk API</description>

src/main/java/org/zendesk/client/v2/Zendesk.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.zendesk.client.v2.model.User;
5858
import org.zendesk.client.v2.model.UserField;
5959
import org.zendesk.client.v2.model.UserRelatedInfo;
60+
import org.zendesk.client.v2.model.View;
6061
import org.zendesk.client.v2.model.dynamic.DynamicContentItem;
6162
import org.zendesk.client.v2.model.dynamic.DynamicContentItemVariant;
6263
import org.zendesk.client.v2.model.hc.Article;
@@ -853,7 +854,18 @@ public void deleteTrigger(long triggerId) {
853854
}
854855

855856

856-
// Automations
857+
// Views
858+
public Iterable<View> getViews() {
859+
return new PagedIterable<>(cnst("/views.json"), handleList(View.class, "views"));
860+
861+
}
862+
863+
public Iterable<Ticket> getView(long id) {
864+
return new PagedIterable<>(tmpl("/views/{id}/tickets.json").set("id", id),
865+
handleList(Ticket.class, "tickets"));
866+
}
867+
868+
// Automations
857869
public Iterable<Automation> getAutomations() {
858870
return new PagedIterable<>(cnst("/automations.json"),
859871
handleList(Automation.class, "automations"));
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
package org.zendesk.client.v2.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
import java.io.Serializable;
7+
8+
@JsonIgnoreProperties(ignoreUnknown = true)
9+
public class View implements Serializable {
10+
11+
<<<<<<< HEAD
12+
private static final long serialVersionUID = 1L;
13+
=======
14+
private static final long serialVersionUID = 8162172428393948830L;
15+
16+
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
17+
private long id;
18+
private String title;
19+
private boolean active;
20+
private String updatedAt;
21+
private String createdAt;
22+
private long position;
23+
private String description;
24+
private Conditions conditions;
25+
private boolean watchable;
26+
<<<<<<< HEAD
27+
private String rawTitle;
28+
=======
29+
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
30+
31+
public void setId(long id) {
32+
this.id = id;
33+
}
34+
35+
@JsonProperty("id")
36+
public long getId() {
37+
return this.id;
38+
}
39+
40+
public void setTitle(String title) {
41+
this.title = title;
42+
}
43+
44+
@JsonProperty("title")
45+
public String getTitle() {
46+
return this.title;
47+
}
48+
49+
public void setActive(boolean active) {
50+
this.active = active;
51+
}
52+
53+
@JsonProperty("active")
54+
public boolean getActive() {
55+
return this.active;
56+
}
57+
58+
public void setUpdatedAt(String updatedAt) {
59+
this.updatedAt = updatedAt;
60+
}
61+
62+
@JsonProperty("updated_at")
63+
public String getUpdatedAt() {
64+
return this.updatedAt;
65+
}
66+
67+
public void setCreatedAt(String createdAt) {
68+
this.createdAt = createdAt;
69+
}
70+
71+
@JsonProperty("created_at")
72+
public String getCreatedAt() {
73+
return this.createdAt;
74+
}
75+
76+
public void setPosition(long position) {
77+
this.position = position;
78+
}
79+
80+
@JsonProperty("position")
81+
public long getPosition() {
82+
return this.position;
83+
}
84+
85+
public void setDescription(String description) {
86+
this.description = description;
87+
}
88+
89+
@JsonProperty("description")
90+
public String getDescription() {
91+
return this.description;
92+
}
93+
94+
public void setConditions(Conditions conditions) {
95+
this.conditions = conditions;
96+
}
97+
98+
@JsonProperty("conditions")
99+
public Conditions getConditions() {
100+
return this.conditions;
101+
}
102+
103+
public void setWatchable(boolean watchable) {
104+
this.watchable = watchable;
105+
}
106+
107+
@JsonProperty("watchable")
108+
public boolean getWatchable() {
109+
return this.watchable;
110+
}
111+
112+
<<<<<<< HEAD
113+
public void setRawTitle(String rawTitle) {
114+
this.rawTitle = rawTitle;
115+
}
116+
117+
@JsonProperty("raw_title")
118+
public String getRawTitle() {
119+
return this.rawTitle;
120+
}
121+
122+
=======
123+
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
124+
//TODO: fix this.
125+
public String toString() {
126+
return "View " +
127+
"{id=" + id +
128+
", title=" + title +
129+
", active=" + active +
130+
", updatedAt=" + updatedAt +
131+
", createdAt=" + createdAt +
132+
", position=" + position +
133+
", description=" + description +
134+
", conditions=" + conditions +
135+
", watchable=" + watchable +
136+
<<<<<<< HEAD
137+
", rawTitle=" + rawTitle +
138+
=======
139+
>>>>>>> 954b71b... Add basic View support - List the Views; List the tickets in a View
140+
"}";
141+
}
142+
}

0 commit comments

Comments
 (0)