Skip to content

Commit 5a97fd1

Browse files
authored
Merge pull request #482 from cloudbees-oss/many_orgs
New method getOrganizations(id,ids)
2 parents 0316ed0 + 9319910 commit 5a97fd1

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
@@ -1298,6 +1298,11 @@ public Iterable<Organization> getOrganizations() {
12981298
handleList(Organization.class, "organizations"));
12991299
}
13001300

1301+
public List<Organization> getOrganizations(long id, long... ids) {
1302+
return complete(submit(req("GET", tmpl("/organizations/show_many.json{?ids}").set("ids", idArray(id, ids))),
1303+
handleList(Organization.class, "organizations")));
1304+
}
1305+
13011306
public Iterable<Organization> getOrganizationsIncrementally(Date startTime) {
13021307
return new PagedIterable<>(
13031308
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
@@ -1255,6 +1255,21 @@ public void getOrganizations() throws Exception {
12551255
}
12561256
}
12571257

1258+
@Test
1259+
public void getOrganizationsById() throws Exception {
1260+
createClientWithTokenOrPassword();
1261+
1262+
Long[] orgIds = StreamSupport.stream(instance.getOrganizations().spliterator(), false)
1263+
.limit(5)
1264+
.map(Organization::getId)
1265+
.toArray(Long[]::new);
1266+
1267+
for (Organization org : instance.getOrganizations(orgIds[0], orgIds[1], orgIds[2], orgIds[3], orgIds[4])) {
1268+
assertThat(org.getId(), notNullValue());
1269+
assertThat(org.getName(), notNullValue());
1270+
}
1271+
}
1272+
12581273
@Test
12591274
public void getOrganizationsIncrementally() throws Exception {
12601275
createClientWithTokenOrPassword();

0 commit comments

Comments
 (0)