Skip to content

Commit ed101a7

Browse files
author
fdi
committed
fix: added missing Methods
1 parent c4c5777 commit ed101a7

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
import java.util.Optional;
1010
import java.util.stream.Stream;
1111

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-
1812
import org.gitlab4j.api.models.AccessLevel;
1913
import org.gitlab4j.api.models.AccessRequest;
2014
import org.gitlab4j.api.models.AuditEvent;
@@ -40,6 +34,12 @@
4034
import org.gitlab4j.api.models.Visibility;
4135
import org.gitlab4j.models.utils.ISO8601;
4236

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+
4343
/**
4444
* This class implements the client side API for the GitLab groups calls.
4545
* @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
596596
return (getProjects(groupIdOrPath, getDefaultPerPage()).stream());
597597
}
598598

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+
599638
/**
600639
* Get a list of groups where the given group has been invited.
601640
* When accessed without authentication, only public shared groups are returned.
@@ -662,7 +701,7 @@ public List<Group> getSharedGroups(Object groupIdOrPath, int page, int perPage)
662701
*/
663702
public Pager<Group> getSharedGroups(Object groupIdOrPath, int itemsPerPage) throws GitLabApiException {
664703
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"));
666705
}
667706

668707
/**

0 commit comments

Comments
 (0)