|
34 | 34 | import org.gitlab4j.api.models.Member; |
35 | 35 | import org.gitlab4j.api.models.Project; |
36 | 36 | import org.gitlab4j.api.models.SamlGroupLink; |
| 37 | +import org.gitlab4j.api.models.SharedGroupsFilter; |
37 | 38 | import org.gitlab4j.api.models.UploadedFile; |
38 | 39 | import org.gitlab4j.api.models.Variable; |
39 | 40 | import org.gitlab4j.api.models.Visibility; |
@@ -595,6 +596,89 @@ public Stream<Project> getProjectsStream(Object groupIdOrPath) throws GitLabApiE |
595 | 596 | return (getProjects(groupIdOrPath, getDefaultPerPage()).stream()); |
596 | 597 | } |
597 | 598 |
|
| 599 | + /** |
| 600 | + * Get a list of groups where the given group has been invited. |
| 601 | + * When accessed without authentication, only public shared groups are returned. |
| 602 | + * |
| 603 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 604 | + * |
| 605 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 606 | + * @param filter the GroupProjectsFilter instance holding the filter values for the query |
| 607 | + * @return a Stream containing the Group instances that belong to the group and match the provided filter |
| 608 | + * @throws GitLabApiException if any exception occurs |
| 609 | + */ |
| 610 | + public Stream<Group> getSharedGroupsStream(Object groupIdOrPath, SharedGroupsFilter filter) |
| 611 | + throws GitLabApiException { |
| 612 | + return (getSharedGroups(groupIdOrPath, filter, getDefaultPerPage()).stream()); |
| 613 | + } |
| 614 | + |
| 615 | + /** |
| 616 | + * Get a list of groups where the given group has been invited. |
| 617 | + * When accessed without authentication, only public shared groups are returned. |
| 618 | + * |
| 619 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 620 | + * |
| 621 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 622 | + * @return a list of groups where the specified group ID has been invited |
| 623 | + * @throws GitLabApiException if any exception occurs |
| 624 | + */ |
| 625 | + public List<Group> getSharedGroups(Object groupIdOrPath) throws GitLabApiException { |
| 626 | + return (getSharedGroups(groupIdOrPath, getDefaultPerPage()).all()); |
| 627 | + } |
| 628 | + |
| 629 | + /** |
| 630 | + * Get a list of groups in the specified page range where the given group has been invited. |
| 631 | + * When accessed without authentication, only public shared groups are returned. |
| 632 | + * |
| 633 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 634 | + * |
| 635 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 636 | + * @param page the page to get |
| 637 | + * @param perPage the number of Group instances per page |
| 638 | + * @return a list of groups where the specified group ID has been invited in the specified page range |
| 639 | + * @throws GitLabApiException if any exception occurs |
| 640 | + */ |
| 641 | + public List<Group> getSharedGroups(Object groupIdOrPath, int page, int perPage) throws GitLabApiException { |
| 642 | + Response response = get( |
| 643 | + Response.Status.OK, |
| 644 | + getPageQueryParams(page, perPage), |
| 645 | + "groups", |
| 646 | + getGroupIdOrPath(groupIdOrPath), |
| 647 | + "groups", |
| 648 | + "shared"); |
| 649 | + return (response.readEntity(new GenericType<List<Group>>() {})); |
| 650 | + } |
| 651 | + |
| 652 | + /** |
| 653 | + * Get a list of groups where the given group has been invited. |
| 654 | + * When accessed without authentication, only public shared groups are returned. |
| 655 | + * |
| 656 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 657 | + * |
| 658 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 659 | + * @param itemsPerPage the number of Group instances that will be fetched per page |
| 660 | + * @return a Pager of groups where the specified group ID has been invited |
| 661 | + * @throws GitLabApiException if any exception occurs |
| 662 | + */ |
| 663 | + public Pager<Group> getSharedGroups(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException { |
| 664 | + return (new Pager<Group>( |
| 665 | + this, Project.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "groups", "shared")); |
| 666 | + } |
| 667 | + |
| 668 | + /** |
| 669 | + * Get a Stream of groups where the given group has been invited. |
| 670 | + * When accessed without authentication, only public shared groups are returned. |
| 671 | + * |
| 672 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 673 | + * |
| 674 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 675 | + * @return a Stream of groups where the specified group ID has been invited |
| 676 | + * @throws GitLabApiException if any exception occurs |
| 677 | + */ |
| 678 | + public Stream<Group> getSharedGroupsStream(Object groupIdOrPath) throws GitLabApiException { |
| 679 | + return (getSharedGroups(groupIdOrPath, getDefaultPerPage()).stream()); |
| 680 | + } |
| 681 | + |
598 | 682 | /** |
599 | 683 | * Get all details of a group. |
600 | 684 | * |
|
0 commit comments