@@ -63,6 +63,63 @@ public Pager<MergeRequest> getMergeRequests(Integer projectId, int itemsPerPage)
63
63
return (new Pager <MergeRequest >(this , MergeRequest .class , itemsPerPage , null , "projects" , projectId , "merge_requests" ));
64
64
}
65
65
66
+ /**
67
+ * Get all merge requests for the specified project.
68
+ *
69
+ * GET /projects/:id/merge_requests
70
+ *
71
+ * @param projectId the project ID to get the merge requests for
72
+ * @param page the page to get
73
+ * @param perPage the number of MergeRequest instances per page
74
+ * @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
75
+ * @return all merge requests for the specified project
76
+ * @throws GitLabApiException if any exception occurs
77
+ */
78
+ public List <MergeRequest > getMergeRequests (Integer projectId , int page , int perPage , MergeRequestState state ) throws GitLabApiException {
79
+ Form formData = new GitLabApiForm ()
80
+ .withParam ("state" , state )
81
+ .withParam (PAGE_PARAM , page )
82
+ .withParam (PER_PAGE_PARAM , perPage );
83
+ Response response = get (Response .Status .OK , formData .asMap (), "projects" , projectId , "merge_requests" );
84
+ return (response .readEntity (new GenericType <List <MergeRequest >>() {}));
85
+ }
86
+
87
+
88
+ /**
89
+ * Get all merge requests for the specified project.
90
+ *
91
+ * GET /projects/:id/merge_requests
92
+ *
93
+ * @param projectId the project ID to get the merge requests for
94
+ * @param itemsPerPage the number of MergeRequest instances that will be fetched per page
95
+ * @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
96
+ * @return all merge requests for the specified project
97
+ * @throws GitLabApiException if any exception occurs
98
+ */
99
+ public Pager <MergeRequest > getMergeRequests (Integer projectId , int itemsPerPage , MergeRequestState state ) throws GitLabApiException {
100
+ Form formData = new GitLabApiForm ()
101
+ .withParam ("state" , state );
102
+ return (new Pager <MergeRequest >(this , MergeRequest .class , itemsPerPage , formData .asMap (), "projects" , projectId , "merge_requests" ));
103
+ }
104
+
105
+ /**
106
+ * Get all merge requests with a specific state for the specified project.
107
+ *
108
+ * GET /projects/:id/merge_requests?state=:state
109
+ *
110
+ * @param projectId the project ID to get the merge requests for
111
+ * @param state the state parameter can be used to get only merge requests with a given state (opened, closed, or merged) or all of them (all).
112
+ * @return all merge requests for the specified project
113
+ * @throws GitLabApiException if any exception occurs
114
+ */
115
+ public List <MergeRequest > getMergeRequests (Integer projectId , MergeRequestState state ) throws GitLabApiException {
116
+ Form formData = new GitLabApiForm ()
117
+ .withParam ("state" , state )
118
+ .withParam (PER_PAGE_PARAM , getDefaultPerPage ());
119
+ Response response = get (Response .Status .OK , formData .asMap (), "projects" , projectId , "merge_requests" );
120
+ return (response .readEntity (new GenericType <List <MergeRequest >>() {}));
121
+ }
122
+
66
123
/**
67
124
* Get information about a single merge request.
68
125
*
0 commit comments