Skip to content

Commit 639ca5a

Browse files
committed
Added getParticipants() methods that return List.
1 parent b96fd36 commit 639ca5a

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

src/main/java/org/gitlab4j/api/MergeRequestApi.java

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,16 +593,48 @@ public MergeRequest getMergeRequestChanges(Integer projectId, Integer mergeReque
593593
Response response = get(Response.Status.OK, null, "projects", projectId, "merge_requests", mergeRequestIid, "changes");
594594
return (response.readEntity(MergeRequest.class));
595595
}
596-
596+
597+
/**
598+
* Get list of participants of merge request.
599+
*
600+
* GET /projects/:id/merge_requests/:merge_request_iid/participants
601+
*
602+
* @param projectId the project ID to get the merge requests for
603+
* @param mergeRequestIid the IID of the merge request to get
604+
* @return a List containing all participants for the specified merge request
605+
* @throws GitLabApiException if any exception occurs
606+
*/
607+
public List<Participant> getParticipants(Integer projectId, Integer mergeRequestIid) throws GitLabApiException {
608+
return (getParticipants(projectId, mergeRequestIid, 1, getDefaultPerPage()));
609+
}
610+
611+
/**
612+
* Get list of participants of merge request and in the specified page range.
613+
*
614+
* GET /projects/:id/merge_requests/:merge_request_iid/participants
615+
*
616+
* @param projectId the project ID to get the merge requests for
617+
* @param mergeRequestIid the IID of the merge request to get
618+
* @param page the page to get
619+
* @param perPage the number of projects per page
620+
* @return a List containing all participants for the specified merge request
621+
* @throws GitLabApiException if any exception occurs
622+
*/
623+
public List<Participant> getParticipants(Integer projectId, Integer mergeRequestIid, int page, int perPage) throws GitLabApiException {
624+
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),
625+
"projects", projectId, "merge_requests", mergeRequestIid, "participants");
626+
return (response.readEntity(new GenericType<List<Participant>>() { }));
627+
}
628+
597629
/**
598-
* Get participants of merge request.
599-
*
630+
* Get a Pager of the participants of merge request.
631+
*
600632
* GET /projects/:id/merge_requests/:merge_request_iid/participants
601-
*
633+
*
602634
* @param projectId the project ID to get the merge requests for
603635
* @param mergeRequestIid the IID of the merge request to get
604636
* @param itemsPerPage the number of Participant instances that will be fetched per page
605-
* @return all participants for the specified merge request
637+
* @return a Pager containing all participants for the specified merge request
606638
* @throws GitLabApiException if any exception occurs
607639
*/
608640
public Pager<Participant> getParticipants(Integer projectId, Integer mergeRequestIid, int itemsPerPage) throws GitLabApiException {

0 commit comments

Comments
 (0)