Currently, the MergeRequestFilter requires the project ID (number) to filter merge requests. It would be very useful to allow passing the project path (e.g., group/subgroup/project) directly in the filter, since retrieving the project ID often requires an extra API call.
try (GitLabApi gitLabApi = new GitLabApi(url, token)) {
MergeRequestFilter filter = new MergeRequestFilter()
.withSourceBranch(sourceBranch)
.withTargetBranch(targetBranch)
.withState(MergeRequestState.OPENED)
.withProjectId(gitLabApi.getProjectApi().getProject(projectPath).getId()) // extra API call here
// .withProjectIdOrPath(projectPath) // something like this
;
List<MergeRequest> mergeRequests = gitLabApi.getMergeRequestApi().getMergeRequests(filter);
}
Alternatively, it would also help to provide an overloaded version of the method
public List<MergeRequest> getMergeRequests(Object projectIdOrPath) throws GitLabApiException
that accepts a MergeRequestFilter as a parameter.
Currently, the
MergeRequestFilterrequires the project ID (number) to filter merge requests. It would be very useful to allow passing the project path (e.g., group/subgroup/project) directly in the filter, since retrieving the project ID often requires an extra API call.Alternatively, it would also help to provide an overloaded version of the method
public List<MergeRequest> getMergeRequests(Object projectIdOrPath) throws GitLabApiExceptionthat accepts a
MergeRequestFilteras a parameter.