Skip to content

Commit d0d1ff3

Browse files
authored
Merge pull request #483 from cloudbees-oss/org-requests
New method getOrganizationRequests(id)
2 parents c807045 + 88a03b5 commit d0d1ff3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,12 @@ public Iterable<Ticket> getOrganizationTickets(long organizationId) {
510510
handleList(Ticket.class, "tickets"));
511511
}
512512

513+
public Iterable<org.zendesk.client.v2.model.Request> getOrganizationRequests(long organizationId) {
514+
return new PagedIterable<>(
515+
tmpl("/organizations/{organizationId}/requests.json").set("organizationId", organizationId),
516+
handleList(org.zendesk.client.v2.model.Request.class, "requests"));
517+
}
518+
513519
public Iterable<Ticket> getUserRequestedTickets(long userId) {
514520
return new PagedIterable<>(tmpl("/users/{userId}/tickets/requested.json").set("userId", userId),
515521
handleList(Ticket.class, "tickets"));

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,18 @@ public void getOrganizationTickets() throws Exception {
438438
}
439439
}
440440

441+
@Test
442+
public void getOrganizationRequests() throws Exception {
443+
createClientWithTokenOrPassword();
444+
int count = 0;
445+
for (Request request : instance.getOrganizationRequests(CLOUDBEES_ORGANIZATION_ID)) {
446+
assertThat(request.getId(), notNullValue());
447+
if (++count > 10) {
448+
break;
449+
}
450+
}
451+
}
452+
441453
@Test
442454
public void getTicketAudits() throws Exception {
443455
createClientWithTokenOrPassword();

0 commit comments

Comments
 (0)