@@ -29,8 +29,7 @@ public MergeRequestApi(GitLabApi gitLabApi) {
29
29
* @throws GitLabApiException if any exception occurs
30
30
*/
31
31
public List <MergeRequest > getMergeRequests (Integer projectId ) throws GitLabApiException {
32
- Response response = get (Response .Status .OK , getDefaultPerPageParam (), "projects" , projectId , "merge_requests" );
33
- return (response .readEntity (new GenericType <List <MergeRequest >>() {}));
32
+ return (getMergeRequests (projectId , 1 , getDefaultPerPage ()));
34
33
}
35
34
36
35
/**
@@ -64,60 +63,55 @@ public Pager<MergeRequest> getMergeRequests(Integer projectId, int itemsPerPage)
64
63
}
65
64
66
65
/**
67
- * Get all merge requests for the specified project.
66
+ * Get all merge requests with a specific state for the specified project.
68
67
*
69
- * GET /projects/:id/merge_requests
68
+ * GET /projects/:id/merge_requests?state=:state
70
69
*
71
70
* @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
71
* @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
72
* @return all merge requests for the specified project
76
73
* @throws GitLabApiException if any exception occurs
77
74
*/
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 >>() {}));
75
+ public List <MergeRequest > getMergeRequests (Integer projectId , MergeRequestState state ) throws GitLabApiException {
76
+ return (getMergeRequests (projectId , state , 1 , getDefaultPerPage ()));
85
77
}
86
78
87
-
88
79
/**
89
80
* Get all merge requests for the specified project.
90
81
*
91
82
* GET /projects/:id/merge_requests
92
83
*
93
84
* @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
85
* @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).
86
+ * @param page the page to get
87
+ * @param perPage the number of MergeRequest instances per page
96
88
* @return all merge requests for the specified project
97
89
* @throws GitLabApiException if any exception occurs
98
90
*/
99
- public Pager <MergeRequest > getMergeRequests (Integer projectId , int itemsPerPage , MergeRequestState state ) throws GitLabApiException {
91
+ public List <MergeRequest > getMergeRequests (Integer projectId , MergeRequestState state , int page , int perPage ) throws GitLabApiException {
100
92
Form formData = new GitLabApiForm ()
101
- .withParam ("state" , state );
102
- return (new Pager <MergeRequest >(this , MergeRequest .class , itemsPerPage , formData .asMap (), "projects" , projectId , "merge_requests" ));
93
+ .withParam ("state" , state )
94
+ .withParam (PAGE_PARAM , page )
95
+ .withParam (PER_PAGE_PARAM , perPage );
96
+ Response response = get (Response .Status .OK , formData .asMap (), "projects" , projectId , "merge_requests" );
97
+ return (response .readEntity (new GenericType <List <MergeRequest >>() {}));
103
98
}
104
99
105
100
/**
106
- * Get all merge requests with a specific state for the specified project.
101
+ * Get all merge requests for the specified project.
107
102
*
108
- * GET /projects/:id/merge_requests?state=:state
103
+ * GET /projects/:id/merge_requests
109
104
*
110
105
* @param projectId the project ID to get the merge requests for
111
106
* @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).
107
+ * @param itemsPerPage the number of MergeRequest instances that will be fetched per page
112
108
* @return all merge requests for the specified project
113
109
* @throws GitLabApiException if any exception occurs
114
110
*/
115
- public List <MergeRequest > getMergeRequests (Integer projectId , MergeRequestState state ) throws GitLabApiException {
111
+ public Pager <MergeRequest > getMergeRequests (Integer projectId , MergeRequestState state , int itemsPerPage ) throws GitLabApiException {
116
112
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 >>() {}));
113
+ .withParam ("state" , state );
114
+ return (new Pager <MergeRequest >(this , MergeRequest .class , itemsPerPage , formData .asMap (), "projects" , projectId , "merge_requests" ));
121
115
}
122
116
123
117
/**
0 commit comments