3
3
import java .util .Date ;
4
4
import java .util .List ;
5
5
import java .util .Optional ;
6
+ import java .util .stream .Stream ;
6
7
7
8
import javax .ws .rs .core .Form ;
8
9
import javax .ws .rs .core .GenericType ;
@@ -29,15 +30,15 @@ public EpicsApi(GitLabApi gitLabApi) {
29
30
30
31
/**
31
32
* Gets all epics of the requested group and its subgroups.
32
- *
33
+ *
33
34
* <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
34
35
*
35
36
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
36
37
* @return a list of all epics of the requested group and its subgroups
37
38
* @throws GitLabApiException if any exception occurs
38
39
*/
39
40
public List <Epic > getEpics (Object groupIdOrPath ) throws GitLabApiException {
40
- return (getEpics (groupIdOrPath , 1 , getDefaultPerPage ()));
41
+ return (getEpics (groupIdOrPath , getDefaultPerPage ()). all ( ));
41
42
}
42
43
43
44
/**
@@ -70,6 +71,19 @@ public Pager<Epic> getEpics(Object groupIdOrPath, int itemsPerPage) throws GitLa
70
71
return (new Pager <Epic >(this , Epic .class , itemsPerPage , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" ));
71
72
}
72
73
74
+ /**
75
+ * Gets all epics of the requested group and its subgroups as a Stream.
76
+ *
77
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
78
+ *
79
+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
80
+ * @return a Stream of all epics of the requested group and its subgroups
81
+ * @throws GitLabApiException if any exception occurs
82
+ */
83
+ public Stream <Epic > getEpicsStream (Object groupIdOrPath ) throws GitLabApiException {
84
+ return (getEpics (groupIdOrPath , getDefaultPerPage ()).stream ());
85
+ }
86
+
73
87
/**
74
88
* Gets all epics of the requested group and its subgroups.
75
89
*
@@ -87,7 +101,7 @@ public Pager<Epic> getEpics(Object groupIdOrPath, int itemsPerPage) throws GitLa
87
101
*/
88
102
public List <Epic > getEpics (Object groupIdOrPath , Integer authorId , String labels , EpicOrderBy orderBy ,
89
103
SortOrder sortOrder , String search ) throws GitLabApiException {
90
- return (getEpics (groupIdOrPath , authorId , labels , orderBy , sortOrder , search , 1 , getDefaultPerPage ()));
104
+ return (getEpics (groupIdOrPath , authorId , labels , orderBy , sortOrder , search , getDefaultPerPage ()). all ( ));
91
105
}
92
106
93
107
/**
@@ -146,6 +160,26 @@ public Pager<Epic> getEpics(Object groupIdOrPath, Integer authorId, String label
146
160
return (new Pager <Epic >(this , Epic .class , itemsPerPage , formData .asMap (), "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" ));
147
161
}
148
162
163
+ /**
164
+ * Gets all epics of the requested group and its subgroups as a Stream.
165
+ *
166
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
167
+ *
168
+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
169
+ * @param authorId returns epics created by the given user id
170
+ * @param labels return epics matching a comma separated list of labels names.
171
+ * Label names from the epic group or a parent group can be used
172
+ * @param orderBy return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
173
+ * @param sortOrder return epics sorted in ASC or DESC order. Default is DESC
174
+ * @param search search epics against their title and description
175
+ * @return a Stream of matching epics of the requested group and its subgroups
176
+ * @throws GitLabApiException if any exception occurs
177
+ */
178
+ public Stream <Epic > getEpicsStream (Object groupIdOrPath , Integer authorId , String labels , EpicOrderBy orderBy ,
179
+ SortOrder sortOrder , String search ) throws GitLabApiException {
180
+ return (getEpics (groupIdOrPath , authorId , labels , orderBy , sortOrder , search , getDefaultPerPage ()).stream ());
181
+ }
182
+
149
183
/**
150
184
* Get a single epic for the specified group.
151
185
*
@@ -305,11 +339,10 @@ public Epic updateEpic(Object groupIdOrPath, Integer epicIid, Epic epic) throws
305
339
public void deleteEpic (Object groupIdOrPath , Integer epicIid ) throws GitLabApiException {
306
340
delete (Response .Status .NO_CONTENT , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid );
307
341
}
308
-
309
342
310
343
/**
311
344
* Gets all issues that are assigned to an epic and the authenticated user has access to.
312
- *
345
+ *
313
346
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
314
347
*
315
348
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@@ -318,13 +351,13 @@ public void deleteEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiEx
318
351
* @throws GitLabApiException if any exception occurs
319
352
*/
320
353
public List <Epic > getEpicIssues (Object groupIdOrPath , Integer epicIid ) throws GitLabApiException {
321
- return (getEpicIssues (groupIdOrPath , epicIid , 1 , getDefaultPerPage ()));
354
+ return (getEpicIssues (groupIdOrPath , epicIid , getDefaultPerPage ()). all ( ));
322
355
}
323
356
324
357
/**
325
358
* Gets all issues that are assigned to an epic and the authenticated user has access to
326
359
* using the specified page and per page setting.
327
- *
360
+ *
328
361
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
329
362
*
330
363
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@@ -341,7 +374,7 @@ public List<Epic> getEpicIssues(Object groupIdOrPath, Integer epicIid, int page,
341
374
342
375
/**
343
376
* Get a Pager of all issues that are assigned to an epic and the authenticated user has access to.
344
- *
377
+ *
345
378
* <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
346
379
*
347
380
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@@ -354,6 +387,20 @@ public Pager<Epic> getEpicIssues(Object groupIdOrPath, Integer epicIid, int item
354
387
return (new Pager <Epic >(this , Epic .class , itemsPerPage , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid , "issues" ));
355
388
}
356
389
390
+ /**
391
+ * Gets all issues that are assigned to an epic and the authenticated user has access to as a Stream.
392
+ *
393
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
394
+ *
395
+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
396
+ * @param epicIid the IID of the epic to get issues for
397
+ * @return a Stream of all epic issues belonging to the specified epic
398
+ * @throws GitLabApiException if any exception occurs
399
+ */
400
+ public Stream <Epic > getEpicIssuesStream (Object groupIdOrPath , Integer epicIid ) throws GitLabApiException {
401
+ return (getEpicIssues (groupIdOrPath , epicIid , getDefaultPerPage ()).stream ());
402
+ }
403
+
357
404
/**
358
405
* Creates an epic - issue association. If the issue in question belongs to another epic
359
406
* it is unassigned from that epic.
0 commit comments