5
5
6
6
import javax .ws .rs .core .Form ;
7
7
import javax .ws .rs .core .GenericType ;
8
+ import javax .ws .rs .core .MultivaluedMap ;
8
9
import javax .ws .rs .core .Response ;
9
10
10
11
import org .gitlab4j .api .GitLabApi .ApiVersion ;
11
12
import org .gitlab4j .api .models .Commit ;
12
13
import org .gitlab4j .api .models .MergeRequest ;
14
+ import org .gitlab4j .api .models .MergeRequestFilter ;
13
15
import org .gitlab4j .api .models .Participant ;
14
16
15
17
/**
@@ -21,6 +23,52 @@ public MergeRequestApi(GitLabApi gitLabApi) {
21
23
super (gitLabApi );
22
24
}
23
25
26
+ /**
27
+ * Get all merge requests matching the filter.
28
+ *
29
+ * GET /merge_requests
30
+ *
31
+ * @param filter a MergeRequestFilter instance with the filter settings
32
+ * @return all merge requests for the specified project matching the filter
33
+ * @throws GitLabApiException if any exception occurs
34
+ */
35
+ public List <MergeRequest > getMergeRequests (MergeRequestFilter filter ) throws GitLabApiException {
36
+ return (getMergeRequests (filter , 1 , getDefaultPerPage ()));
37
+ }
38
+
39
+ /**
40
+ * Get all merge requests matching the filter.
41
+ *
42
+ * GET /merge_requests
43
+ *
44
+ * @param filter a MergeRequestFilter instance with the filter settings
45
+ * @param page the page to get
46
+ * @param perPage the number of MergeRequest instances per page
47
+ * @return all merge requests for the specified project matching the filter
48
+ * @throws GitLabApiException if any exception occurs
49
+ */
50
+ public List <MergeRequest > getMergeRequests (MergeRequestFilter filter , int page , int perPage ) throws GitLabApiException {
51
+ MultivaluedMap <String , String > queryParams = (filter != null ?
52
+ filter .getQueryParams (page , perPage ).asMap () : getPageQueryParams (page , perPage ));
53
+ Response response = get (Response .Status .OK , queryParams , "merge_requests" );
54
+ return (response .readEntity (new GenericType <List <MergeRequest >>() {}));
55
+ }
56
+
57
+ /**
58
+ * Get all merge requests matching the filter.
59
+ *
60
+ * GET /merge_requests
61
+ *
62
+ * @param filter a MergeRequestFilter instance with the filter settings
63
+ * @param itemsPerPage the number of MergeRequest instances that will be fetched per page
64
+ * @return all merge requests for the specified project matching the filter
65
+ * @throws GitLabApiException if any exception occurs
66
+ */
67
+ public Pager <MergeRequest > getMergeRequests (MergeRequestFilter filter , int itemsPerPage ) throws GitLabApiException {
68
+ MultivaluedMap <String , String > queryParams = (filter != null ? filter .getQueryParams ().asMap () : null );
69
+ return (new Pager <MergeRequest >(this , MergeRequest .class , itemsPerPage , queryParams , "merge_requests" ));
70
+ }
71
+
24
72
/**
25
73
* Get all merge requests for the specified project.
26
74
*
0 commit comments