Skip to content

Commit 72210a7

Browse files
authored
Merge branch 'master' into sircpl/cbp_only
2 parents 0f9b6e1 + 5466a40 commit 72210a7

File tree

10 files changed

+166
-12
lines changed

10 files changed

+166
-12
lines changed

.github/workflows/ci-master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
with:
1818
# Disabling shallow clone is recommended for improving relevancy of reporting with SonarCloud
1919
fetch-depth: 0

.github/workflows/ci-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
with:
1818
# Disabling shallow clone is recommended for improving relevancy of reporting with SonarCloud
1919
fetch-depth: 0

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
# Drafts your next Release notes as Pull Requests are merged into "master"
14-
- uses: release-drafter/release-drafter@v5.24.0
14+
- uses: release-drafter/release-drafter@v5.25.0
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Here is the status of the various API components:
8282
* [Attachments](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket-attachments/)
8383
* [Automations](https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/)
8484
* [Job Statuses](https://developer.zendesk.com/api-reference/ticketing/ticket-management/job_statuses/)
85-
* [Locales](https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/)
85+
* [Locales](https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/) - Partial (List Locales)
8686
* [Macros](https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/)*except for restrictions*
8787
* [Satisfaction Ratings](https://developer.zendesk.com/api-reference/ticketing/ticket-management/satisfaction_ratings/)
8888
* [Sharing Agreements](https://developer.zendesk.com/api-reference/ticketing/account-configuration/sharing_agreements/)

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@
9999
<dependency>
100100
<groupId>com.fasterxml.jackson</groupId>
101101
<artifactId>jackson-bom</artifactId>
102-
<version>2.15.2</version>
102+
<version>2.15.3</version>
103103
<type>pom</type>
104104
<scope>import</scope>
105105
</dependency>
106106
<dependency>
107107
<groupId>io.netty</groupId>
108108
<artifactId>netty-bom</artifactId>
109-
<version>4.1.95.Final</version>
109+
<version>4.1.100.Final</version>
110110
<type>pom</type>
111111
<scope>import</scope>
112112
</dependency>
@@ -117,7 +117,7 @@
117117
<dependency>
118118
<groupId>org.slf4j</groupId>
119119
<artifactId>slf4j-api</artifactId>
120-
<version>2.0.7</version>
120+
<version>2.0.9</version>
121121
</dependency>
122122
<dependency>
123123
<groupId>org.asynchttpclient</groupId>
@@ -152,7 +152,7 @@
152152
<dependency>
153153
<groupId>org.slf4j</groupId>
154154
<artifactId>slf4j-simple</artifactId>
155-
<version>2.0.7</version>
155+
<version>2.0.9</version>
156156
<scope>test</scope>
157157
</dependency>
158158
<dependency>
@@ -171,7 +171,7 @@
171171
<dependency>
172172
<groupId>org.apache.commons</groupId>
173173
<artifactId>commons-text</artifactId>
174-
<version>1.10.0</version>
174+
<version>1.11.0</version>
175175
<scope>test</scope>
176176
</dependency>
177177
<dependency>
@@ -187,7 +187,7 @@
187187
<plugins>
188188
<plugin>
189189
<artifactId>maven-enforcer-plugin</artifactId>
190-
<version>3.3.0</version>
190+
<version>3.4.1</version>
191191
</plugin>
192192
<plugin>
193193
<groupId>org.apache.maven.plugins</groupId>
@@ -313,7 +313,7 @@
313313
<plugin>
314314
<groupId>org.jacoco</groupId>
315315
<artifactId>jacoco-maven-plugin</artifactId>
316-
<version>0.8.10</version>
316+
<version>0.8.11</version>
317317
<executions>
318318
<execution>
319319
<id>prepare-agent</id>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.zendesk.client.v2.model.GroupMembership;
5656
import org.zendesk.client.v2.model.Identity;
5757
import org.zendesk.client.v2.model.JobStatus;
58+
import org.zendesk.client.v2.model.Locale;
5859
import org.zendesk.client.v2.model.Macro;
5960
import org.zendesk.client.v2.model.Metric;
6061
import org.zendesk.client.v2.model.Organization;
@@ -2638,6 +2639,20 @@ public void deleteDynamicContentItemVariant(Long itemId, DynamicContentItemVaria
26382639
handleStatus()));
26392640
}
26402641

2642+
//////////////////////////////////////////////////////////////////////
2643+
// Action methods for Locales
2644+
//////////////////////////////////////////////////////////////////////
2645+
2646+
/**
2647+
* https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/#list-locales
2648+
*
2649+
* @return the translation locales available for the account.
2650+
* @since FIXME
2651+
*/
2652+
public Iterable<Locale> getLocales() {
2653+
return new PagedIterable<>(cnst("/locales.json"), handleList(Locale.class, "locales"));
2654+
}
2655+
26412656
// TODO search with query building API
26422657

26432658
//////////////////////////////////////////////////////////////////////
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package org.zendesk.client.v2.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import java.util.Date;
6+
7+
/**
8+
* See <a
9+
* href="https://developer.zendesk.com/api-reference/ticketing/account-configuration/locales/">
10+
* Locales in Zendesk API </a>
11+
*
12+
* @since FIXME
13+
*/
14+
public class Locale implements Serializable {
15+
16+
private static final long serialVersionUID = 1L;
17+
18+
private Date createdAt;
19+
private Long id;
20+
private String locale;
21+
private String name;
22+
private Date updatedAt;
23+
private String url;
24+
25+
@JsonProperty("created_at")
26+
public Date getCreatedAt() {
27+
return createdAt;
28+
}
29+
30+
public void setCreatedAt(Date createdAt) {
31+
this.createdAt = createdAt;
32+
}
33+
34+
public Long getId() {
35+
return id;
36+
}
37+
38+
public void setId(Long id) {
39+
this.id = id;
40+
}
41+
42+
public String getLocale() {
43+
return locale;
44+
}
45+
46+
public void setLocale(String locale) {
47+
this.locale = locale;
48+
}
49+
50+
public String getName() {
51+
return name;
52+
}
53+
54+
public void setName(String name) {
55+
this.name = name;
56+
}
57+
58+
@JsonProperty("updated_at")
59+
public Date getUpdatedAt() {
60+
return updatedAt;
61+
}
62+
63+
public void setUpdatedAt(Date updatedAt) {
64+
this.updatedAt = updatedAt;
65+
}
66+
67+
public String getUrl() {
68+
return url;
69+
}
70+
71+
public void setUrl(String url) {
72+
this.url = url;
73+
}
74+
75+
@Override
76+
public String toString() {
77+
return "Locale{"
78+
+ "createdAt="
79+
+ createdAt
80+
+ ", id="
81+
+ id
82+
+ ", locale='"
83+
+ locale
84+
+ '\''
85+
+ ", name='"
86+
+ name
87+
+ '\''
88+
+ ", updatedAt="
89+
+ updatedAt
90+
+ ", url='"
91+
+ url
92+
+ '\''
93+
+ '}';
94+
}
95+
}

src/test/java/org/zendesk/client/v2/RealSmokeTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
import org.zendesk.client.v2.model.Identity;
7373
import org.zendesk.client.v2.model.JobResult;
7474
import org.zendesk.client.v2.model.JobStatus;
75+
import org.zendesk.client.v2.model.Locale;
7576
import org.zendesk.client.v2.model.Macro;
7677
import org.zendesk.client.v2.model.Metric;
7778
import org.zendesk.client.v2.model.Organization;
@@ -2801,6 +2802,18 @@ public void getViews() throws Exception {
28012802
break;
28022803
}
28032804
}
2805+
2806+
@Test
2807+
public void getLocalesReturnsLocales() throws Exception {
2808+
createClientWithTokenOrPassword();
2809+
Iterable<Locale> locales = instance.getLocales();
2810+
assertThat(locales, notNullValue());
2811+
2812+
int numLocales = 0;
2813+
for (Locale ignored : locales) {
2814+
++numLocales;
2815+
}
2816+
assertThat(numLocales, greaterThan(0));
28042817
}
28052818

28062819
// UTILITIES
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.zendesk.client.v2.model;
2+
3+
import static org.hamcrest.CoreMatchers.is;
4+
import static org.hamcrest.MatcherAssert.assertThat;
5+
6+
import org.junit.Test;
7+
import org.zendesk.client.v2.Zendesk;
8+
9+
public class LocaleTest {
10+
@Test
11+
public void testLocaleDeserialization() throws Exception {
12+
String json =
13+
"{"
14+
+ "\"url\": \"https://acme.zendesk.com/api/v2/locales/en-US.json\","
15+
+ "\"id\": 1,"
16+
+ "\"locale\": \"en-US\","
17+
+ "\"name\": \"English\","
18+
+ "\"created_at\": \"2023-08-13T19:23:16Z\","
19+
+ "\"updated_at\": \"2023-09-21T19:23:16Z\""
20+
+ "}";
21+
22+
Locale locale = Zendesk.createMapper().readValue(json, Locale.class);
23+
24+
assertThat(locale.getUrl(), is("https://acme.zendesk.com/api/v2/locales/en-US.json"));
25+
assertThat(locale.getId(), is(1L));
26+
assertThat(locale.getLocale(), is("en-US"));
27+
assertThat(locale.getName(), is("English"));
28+
assertThat(locale.getCreatedAt().getTime(), is(1691954596000L));
29+
assertThat(locale.getUpdatedAt().getTime(), is(1695324196000L));
30+
}
31+
}

0 commit comments

Comments
 (0)