|
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,130 @@ 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 SharedGroupsFilter instance holding the filter values for the query |
| 607 | + * @return a List containing the Group instances the given group has been invited to and match the provided filter |
| 608 | + * @throws GitLabApiException if any exception occurs |
| 609 | + */ |
| 610 | + public List<Group> getSharedGroups(Object groupIdOrPath, SharedGroupsFilter filter) throws GitLabApiException { |
| 611 | + return (getSharedGroups(groupIdOrPath, filter, getDefaultPerPage()).all()); |
| 612 | + } |
| 613 | + |
| 614 | + /** |
| 615 | + * Get a Pager of groups where the given group has been invited. |
| 616 | + * When accessed without authentication, only public shared groups are returned. |
| 617 | + * |
| 618 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 619 | + * |
| 620 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 621 | + * @param filter the SharedGroupsFilter instance holding the filter values for the query |
| 622 | + * @param itemsPerPage the number of Group instances that will be fetched per page |
| 623 | + * @return a Pager containing the Group instances the given group has been invited to and match the provided filter |
| 624 | + * @throws GitLabApiException if any exception occurs |
| 625 | + */ |
| 626 | + public Pager<Group> getSharedGroups(Object groupIdOrPath, SharedGroupsFilter filter, int itemsPerPage) |
| 627 | + throws GitLabApiException { |
| 628 | + GitLabApiForm formData = new GitLabApiForm(filter.getQueryParams()); |
| 629 | + return (new Pager<Group>( |
| 630 | + this, |
| 631 | + Group.class, |
| 632 | + itemsPerPage, |
| 633 | + formData.asMap(), |
| 634 | + "groups", |
| 635 | + getGroupIdOrPath(groupIdOrPath), |
| 636 | + "groups", |
| 637 | + "shared")); |
| 638 | + } |
| 639 | + |
| 640 | + /** |
| 641 | + * Get a Stream of groups where the given group has been invited. |
| 642 | + * When accessed without authentication, only public shared groups are returned. |
| 643 | + * |
| 644 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 645 | + * |
| 646 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 647 | + * @param filter the SharedGroupsFilter instance holding the filter values for the query |
| 648 | + * @return a Stream containing the Group instances the given group has been invited to and match the provided filter |
| 649 | + * @throws GitLabApiException if any exception occurs |
| 650 | + */ |
| 651 | + public Stream<Group> getSharedGroupsStream(Object groupIdOrPath, SharedGroupsFilter filter) |
| 652 | + throws GitLabApiException { |
| 653 | + return (getSharedGroups(groupIdOrPath, filter, getDefaultPerPage()).stream()); |
| 654 | + } |
| 655 | + |
| 656 | + /** |
| 657 | + * Get a list of groups where the given group has been invited. |
| 658 | + * When accessed without authentication, only public shared groups are returned. |
| 659 | + * |
| 660 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 661 | + * |
| 662 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 663 | + * @return a list of groups where the specified group ID has been invited |
| 664 | + * @throws GitLabApiException if any exception occurs |
| 665 | + */ |
| 666 | + public List<Group> getSharedGroups(Object groupIdOrPath) throws GitLabApiException { |
| 667 | + return (getSharedGroups(groupIdOrPath, getDefaultPerPage()).all()); |
| 668 | + } |
| 669 | + |
| 670 | + /** |
| 671 | + * Get a list of groups in the specified page range where the given group has been invited. |
| 672 | + * When accessed without authentication, only public shared groups are returned. |
| 673 | + * |
| 674 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 675 | + * |
| 676 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 677 | + * @param page the page to get |
| 678 | + * @param perPage the number of Group instances per page |
| 679 | + * @return a list of groups where the specified group ID has been invited in the specified page range |
| 680 | + * @throws GitLabApiException if any exception occurs |
| 681 | + */ |
| 682 | + public List<Group> getSharedGroups(Object groupIdOrPath, int page, int perPage) throws GitLabApiException { |
| 683 | + Response response = get( |
| 684 | + Response.Status.OK, |
| 685 | + getPageQueryParams(page, perPage), |
| 686 | + "groups", |
| 687 | + getGroupIdOrPath(groupIdOrPath), |
| 688 | + "groups", |
| 689 | + "shared"); |
| 690 | + return (response.readEntity(new GenericType<List<Group>>() {})); |
| 691 | + } |
| 692 | + |
| 693 | + /** |
| 694 | + * Get a list of groups where the given group has been invited. |
| 695 | + * When accessed without authentication, only public shared groups are returned. |
| 696 | + * |
| 697 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 698 | + * |
| 699 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 700 | + * @param itemsPerPage the number of Group instances that will be fetched per page |
| 701 | + * @return a Pager of groups where the specified group ID has been invited |
| 702 | + * @throws GitLabApiException if any exception occurs |
| 703 | + */ |
| 704 | + public Pager<Group> getSharedGroups(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException { |
| 705 | + return (new Pager<Group>( |
| 706 | + this, Group.class, itemsPerPage, null, "groups", getGroupIdOrPath(groupIdOrPath), "groups", "shared")); |
| 707 | + } |
| 708 | + |
| 709 | + /** |
| 710 | + * Get a Stream of groups where the given group has been invited. |
| 711 | + * When accessed without authentication, only public shared groups are returned. |
| 712 | + * |
| 713 | + * <pre><code>GitLab Endpoint: GET /groups/:id/groups/shared</code></pre> |
| 714 | + * |
| 715 | + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path |
| 716 | + * @return a Stream of groups where the specified group ID has been invited |
| 717 | + * @throws GitLabApiException if any exception occurs |
| 718 | + */ |
| 719 | + public Stream<Group> getSharedGroupsStream(Object groupIdOrPath) throws GitLabApiException { |
| 720 | + return (getSharedGroups(groupIdOrPath, getDefaultPerPage()).stream()); |
| 721 | + } |
| 722 | + |
598 | 723 | /** |
599 | 724 | * Get all details of a group. |
600 | 725 | * |
|
0 commit comments