33import java .util .Date ;
44import java .util .List ;
55import java .util .Optional ;
6+ import java .util .stream .Stream ;
67
78import javax .ws .rs .core .Form ;
89import javax .ws .rs .core .GenericType ;
@@ -29,15 +30,15 @@ public EpicsApi(GitLabApi gitLabApi) {
2930
3031 /**
3132 * Gets all epics of the requested group and its subgroups.
32- *
33+ *
3334 * <pre><code>GitLab Endpoint: GET /groups/:id/epics</code></pre>
3435 *
3536 * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
3637 * @return a list of all epics of the requested group and its subgroups
3738 * @throws GitLabApiException if any exception occurs
3839 */
3940 public List <Epic > getEpics (Object groupIdOrPath ) throws GitLabApiException {
40- return (getEpics (groupIdOrPath , 1 , getDefaultPerPage ()));
41+ return (getEpics (groupIdOrPath , getDefaultPerPage ()). all ( ));
4142 }
4243
4344 /**
@@ -70,6 +71,19 @@ public Pager<Epic> getEpics(Object groupIdOrPath, int itemsPerPage) throws GitLa
7071 return (new Pager <Epic >(this , Epic .class , itemsPerPage , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" ));
7172 }
7273
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+
7387 /**
7488 * Gets all epics of the requested group and its subgroups.
7589 *
@@ -87,7 +101,7 @@ public Pager<Epic> getEpics(Object groupIdOrPath, int itemsPerPage) throws GitLa
87101 */
88102 public List <Epic > getEpics (Object groupIdOrPath , Integer authorId , String labels , EpicOrderBy orderBy ,
89103 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 ( ));
91105 }
92106
93107 /**
@@ -146,6 +160,26 @@ public Pager<Epic> getEpics(Object groupIdOrPath, Integer authorId, String label
146160 return (new Pager <Epic >(this , Epic .class , itemsPerPage , formData .asMap (), "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" ));
147161 }
148162
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+
149183 /**
150184 * Get a single epic for the specified group.
151185 *
@@ -305,11 +339,10 @@ public Epic updateEpic(Object groupIdOrPath, Integer epicIid, Epic epic) throws
305339 public void deleteEpic (Object groupIdOrPath , Integer epicIid ) throws GitLabApiException {
306340 delete (Response .Status .NO_CONTENT , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid );
307341 }
308-
309342
310343 /**
311344 * Gets all issues that are assigned to an epic and the authenticated user has access to.
312- *
345+ *
313346 * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
314347 *
315348 * @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
318351 * @throws GitLabApiException if any exception occurs
319352 */
320353 public List <Epic > getEpicIssues (Object groupIdOrPath , Integer epicIid ) throws GitLabApiException {
321- return (getEpicIssues (groupIdOrPath , epicIid , 1 , getDefaultPerPage ()));
354+ return (getEpicIssues (groupIdOrPath , epicIid , getDefaultPerPage ()). all ( ));
322355 }
323356
324357 /**
325358 * Gets all issues that are assigned to an epic and the authenticated user has access to
326359 * using the specified page and per page setting.
327- *
360+ *
328361 * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
329362 *
330363 * @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,
341374
342375 /**
343376 * Get a Pager of all issues that are assigned to an epic and the authenticated user has access to.
344- *
377+ *
345378 * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues</code></pre>
346379 *
347380 * @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
354387 return (new Pager <Epic >(this , Epic .class , itemsPerPage , null , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid , "issues" ));
355388 }
356389
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+
357404 /**
358405 * Creates an epic - issue association. If the issue in question belongs to another epic
359406 * it is unassigned from that epic.
0 commit comments