|
9 | 9 | import java.util.Optional; |
10 | 10 | import java.util.stream.Stream; |
11 | 11 |
|
12 | | -import jakarta.ws.rs.core.Form; |
13 | | -import jakarta.ws.rs.core.GenericType; |
14 | | -import jakarta.ws.rs.core.MediaType; |
15 | | -import jakarta.ws.rs.core.MultivaluedMap; |
16 | | -import jakarta.ws.rs.core.Response; |
17 | | - |
18 | 12 | import org.gitlab4j.api.models.AccessLevel; |
19 | 13 | import org.gitlab4j.api.models.AccessRequest; |
20 | 14 | import org.gitlab4j.api.models.AuditEvent; |
|
40 | 34 | import org.gitlab4j.api.models.Visibility; |
41 | 35 | import org.gitlab4j.models.utils.ISO8601; |
42 | 36 |
|
| 37 | +import jakarta.ws.rs.core.Form; |
| 38 | +import jakarta.ws.rs.core.GenericType; |
| 39 | +import jakarta.ws.rs.core.MediaType; |
| 40 | +import jakarta.ws.rs.core.MultivaluedMap; |
| 41 | +import jakarta.ws.rs.core.Response; |
| 42 | + |
43 | 43 | /** |
44 | 44 | * This class implements the client side API for the GitLab groups calls. |
45 | 45 | * @see <a href="https://docs.gitlab.com/ce/api/groups.html">Groups API at GitLab</a> |
@@ -596,6 +596,45 @@ public Stream<Project> getProjectsStream(Object groupIdOrPath) throws GitLabApiE |
596 | 596 | return (getProjects(groupIdOrPath, getDefaultPerPage()).stream()); |
597 | 597 | } |
598 | 598 |
|
| 599 | + /** |
| 600 | + * Get a list of projects belonging to the specified group ID and filter. |
| 601 | + * |
| 602 | + * <pre><code>GitLab Endpoint: GET /groups/:id/projects</code></pre> |
| 603 | + * |
| 604 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 605 | + * @param filter the GroupProjectsFilter instance holding the filter values for the query |
| 606 | + * @return a List containing Project instances that belong to the group and match the provided filter |
| 607 | + * @throws GitLabApiException if any exception occurs |
| 608 | + */ |
| 609 | + public List<Group> getSharedGroups(Object groupIdOrPath, SharedGroupsFilter filter) throws GitLabApiException { |
| 610 | + return (getSharedGroups(groupIdOrPath, filter, getDefaultPerPage()).all()); |
| 611 | + } |
| 612 | + |
| 613 | + /** |
| 614 | + * Get a Pager of projects belonging to the specified group ID and filter. |
| 615 | + * |
| 616 | + * <pre><code>GitLab Endpoint: GET /groups/:id/projects</code></pre> |
| 617 | + * |
| 618 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 619 | + * @param filter the GroupProjectsFilter instance holding the filter values for the query |
| 620 | + * @param itemsPerPage the number of Project instances that will be fetched per page |
| 621 | + * @return a Pager containing Project instances that belong to the group and match the provided filter |
| 622 | + * @throws GitLabApiException if any exception occurs |
| 623 | + */ |
| 624 | + public Pager<Group> getSharedGroups(Object groupIdOrPath, SharedGroupsFilter filter, int itemsPerPage) |
| 625 | + throws GitLabApiException { |
| 626 | + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); |
| 627 | + return (new Pager<Group>( |
| 628 | + this, |
| 629 | + Group.class, |
| 630 | + itemsPerPage, |
| 631 | + formData.asMap(), |
| 632 | + "groups", |
| 633 | + getGroupIdOrPath(groupIdOrPath), |
| 634 | + "groups", |
| 635 | + "shared")); |
| 636 | + } |
| 637 | + |
599 | 638 | /** |
600 | 639 | * Get a list of groups where the given group has been invited. |
601 | 640 | * When accessed without authentication, only public shared groups are returned. |
@@ -662,7 +701,7 @@ public List<Group> getSharedGroups(Object groupIdOrPath, int page, int perPage) |
662 | 701 | */ |
663 | 702 | public Pager<Group> getSharedGroups(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException { |
664 | 703 | return (new Pager<Group>( |
665 | | - this, Project.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "groups", "shared")); |
| 704 | + this, Group.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "groups", "shared")); |
666 | 705 | } |
667 | 706 |
|
668 | 707 | /** |
|
0 commit comments