From 065f779fe299133590b692cdb3b8e64a0fe69e72 Mon Sep 17 00:00:00 2001 From: Dwouglas Mhagnum Date: Fri, 29 Aug 2025 17:28:56 -0300 Subject: [PATCH 1/2] Add methods to retrieve merge requests with projectIdOrPath and filter --- .tool-versions | 1 + .../org/gitlab4j/api/MergeRequestApi.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..f3e9f95a4 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +java temurin-11.0.28+6 diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/MergeRequestApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/MergeRequestApi.java index 13fead670..6c2ff6626 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/MergeRequestApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/MergeRequestApi.java @@ -155,6 +155,52 @@ public List getMergeRequests(Object projectIdOrPath) throws GitLab return (getMergeRequests(projectIdOrPath, getDefaultPerPage()).all()); } + /** + * Get all merge requests for the specified project. + * + *
GitLab Endpoint: GET /projects/:id/merge_requests
+ * + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param filter a MergeRequestFilter instance with the filter settings + * @return all merge requests for the specified project matching the filter + * @throws GitLabApiException if any exception occurs + */ + public List getMergeRequests(Object projectIdOrPath, MergeRequestFilter filter) + throws GitLabApiException { + return (getMergeRequests(projectIdOrPath, filter, getDefaultPerPage()).all()); + } + + /** + * Get all merge requests for the specified project. + * + *
GitLab Endpoint: GET /projects/:id/merge_requests
+ * + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance + * @param filter a MergeRequestFilter instance with the filter settings + * @param itemsPerPage the number of MergeRequest instances that will be fetched per page + * @return all merge requests for the specified project matching the filter + * @throws GitLabApiException if any exception occurs + */ + public Pager getMergeRequests(Object projectIdOrPath, MergeRequestFilter filter, int itemsPerPage) + throws GitLabApiException { + + if (filter != null && filter.getProjectId() != null) { + throw new RuntimeException( + "projectId cannot be specified in filter, use projectIdOrPath parameter instead"); + } + + MultivaluedMap queryParams = + (filter != null ? new GitLabApiForm(filter.getQueryParams()).asMap() : null); + return (new Pager( + this, + MergeRequest.class, + itemsPerPage, + queryParams, + "projects", + getProjectIdOrPath(projectIdOrPath), + "merge_requests")); + } + /** * Get all merge requests for the specified project. * From 898ef17a80a0a96d15d6b7baf532641a4e53a472 Mon Sep 17 00:00:00 2001 From: Dwouglas Mhagnum Date: Mon, 1 Sep 2025 13:25:00 -0300 Subject: [PATCH 2/2] Remove .tool-versions file --- .tool-versions | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index f3e9f95a4..000000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -java temurin-11.0.28+6