Skip to content

Commit 9319910

Browse files
committed
[feature] New method getOrganizations(id,ids)
1 parent c807045 commit 9319910

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,11 @@ public Iterable<Organization> getOrganizations() {
12501250
handleList(Organization.class, "organizations"));
12511251
}
12521252

1253+
public List<Organization> getOrganizations(long id, long... ids) {
1254+
return complete(submit(req("GET", tmpl("/organizations/show_many.json{?ids}").set("ids", idArray(id, ids))),
1255+
handleList(Organization.class, "organizations")));
1256+
}
1257+
12531258
public Iterable<Organization> getOrganizationsIncrementally(Date startTime) {
12541259
return new PagedIterable<>(
12551260
tmpl("/incremental/organizations.json{?start_time}")

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,21 @@ public void getOrganizations() throws Exception {
11901190
}
11911191
}
11921192

1193+
@Test
1194+
public void getOrganizationsById() throws Exception {
1195+
createClientWithTokenOrPassword();
1196+
1197+
Long[] orgIds = StreamSupport.stream(instance.getOrganizations().spliterator(), false)
1198+
.limit(5)
1199+
.map(Organization::getId)
1200+
.toArray(Long[]::new);
1201+
1202+
for (Organization org : instance.getOrganizations(orgIds[0], orgIds[1], orgIds[2], orgIds[3], orgIds[4])) {
1203+
assertThat(org.getId(), notNullValue());
1204+
assertThat(org.getName(), notNullValue());
1205+
}
1206+
}
1207+
11931208
@Test
11941209
public void getOrganizationsIncrementally() throws Exception {
11951210
createClientWithTokenOrPassword();

0 commit comments

Comments
 (0)