Skip to content

Commit 9616d20

Browse files
committed
Merge pull request cloudbees-oss#14 from benashby/organizationfields
Organizationfields
2 parents e14d3bf + d1e38ff commit 9616d20

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.zendesk.client.v2.model.Group;
2424
import org.zendesk.client.v2.model.Identity;
2525
import org.zendesk.client.v2.model.Organization;
26+
import org.zendesk.client.v2.model.OrganizationField;
2627
import org.zendesk.client.v2.model.SearchResultEntity;
2728
import org.zendesk.client.v2.model.Ticket;
2829
import org.zendesk.client.v2.model.User;
@@ -41,6 +42,7 @@
4142
import java.util.concurrent.ExecutionException;
4243
import org.zendesk.client.v2.model.Status;
4344

45+
4446
/**
4547
* @author stephenc
4648
* @since 04/04/2013 13:08
@@ -595,6 +597,12 @@ public Iterable<Organization> getOrganizations() {
595597
handleList(Organization.class, "organizations"));
596598
}
597599

600+
public Iterable<OrganizationField> getOrganizationFields() {
601+
//The organization_fields api doesn't seem to support paging
602+
return complete(submit(req("GET", cnst("/organization_fields.json")),
603+
handleList(OrganizationField.class, "organization_fields")));
604+
}
605+
598606
public Iterable<Organization> getAutoCompleteOrganizations(String name) {
599607
if (name == null || name.length() < 2) {
600608
throw new IllegalArgumentException("Name must be at least 2 characters long");

src/main/java/org/zendesk/client/v2/model/Organization.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.util.Date;
66
import java.util.List;
7+
import java.util.Map;
78

89
/**
910
* @author stephenc
@@ -22,6 +23,7 @@ public class Organization implements SearchResultEntity {
2223
private Boolean sharedTickets;
2324
private Boolean sharedComments;
2425
private List<String> tags;
26+
private Map<String,Object> organizationFields;
2527

2628
public Organization() {
2729
}
@@ -129,6 +131,15 @@ public void setUpdatedAt(Date updatedAt) {
129131
this.updatedAt = updatedAt;
130132
}
131133

134+
@JsonProperty("organization_fields")
135+
public Map<String, Object> getOrganizationFields() {
136+
return organizationFields;
137+
}
138+
139+
public void setOrganizationFields(Map<String, Object> organizationFields) {
140+
this.organizationFields = organizationFields;
141+
}
142+
132143
@Override
133144
public String toString() {
134145
final StringBuilder sb = new StringBuilder("Organization{");
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package org.zendesk.client.v2.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import java.util.Date;
6+
7+
/**
8+
* Created by benashby on 8/27/2014.
9+
*/
10+
public class OrganizationField implements SearchResultEntity {
11+
12+
private Long id;
13+
private String url;
14+
private String type;
15+
private String key;
16+
private String title;
17+
private String description;
18+
private Long position;
19+
private Boolean active;
20+
private Date createdAt;
21+
private Date updatedAt;
22+
23+
public Long getId() {
24+
return id;
25+
}
26+
27+
public void setId(Long id) {
28+
this.id = id;
29+
}
30+
31+
public String getUrl() {
32+
return url;
33+
}
34+
35+
public void setUrl(String url) {
36+
this.url = url;
37+
}
38+
39+
public String getType() {
40+
return type;
41+
}
42+
43+
public void setType(String type) {
44+
this.type = type;
45+
}
46+
47+
public String getKey() {
48+
return key;
49+
}
50+
51+
public void setKey(String key) {
52+
this.key = key;
53+
}
54+
55+
public String getTitle() {
56+
return title;
57+
}
58+
59+
public void setTitle(String title) {
60+
this.title = title;
61+
}
62+
63+
public String getDescription() {
64+
return description;
65+
}
66+
67+
public void setDescription(String description) {
68+
this.description = description;
69+
}
70+
71+
public Long getPosition() {
72+
return position;
73+
}
74+
75+
public void setPosition(Long position) {
76+
this.position = position;
77+
}
78+
79+
public Boolean getActive() {
80+
return active;
81+
}
82+
83+
public void setActive(Boolean active) {
84+
this.active = active;
85+
}
86+
87+
@JsonProperty("created_at")
88+
public Date getCreatedAt() {
89+
return createdAt;
90+
}
91+
92+
public void setCreatedAt(Date createdAt) {
93+
this.createdAt = createdAt;
94+
}
95+
96+
@JsonProperty("updated_at")
97+
public Date getUpdatedAt() {
98+
return updatedAt;
99+
}
100+
101+
public void setUpdatedAt(Date updatedAt) {
102+
this.updatedAt = updatedAt;
103+
}
104+
105+
@Override
106+
public String toString() {
107+
return "OrganizationField{" +
108+
"id=" + id +
109+
", type='" + type + '\'' +
110+
", key='" + key + '\'' +
111+
", title='" + title + '\'' +
112+
", description='" + description + '\'' +
113+
", position=" + position +
114+
", active=" + active +
115+
", createdAt=" + createdAt +
116+
", updatedAt=" + updatedAt +
117+
'}';
118+
}
119+
}

0 commit comments

Comments
 (0)