1212import java .io .IOException ;
1313import java .util .*;
1414
15+ // This is a partial support for the Groups API, some methods are currently missing.
1516interface IGroupsApi {
16- // GroupRead[] list(String resource, Boolean includeTotalCount, int page, int perPage, String search) throws IOException, PermitApiError, PermitContextError;
1717 GroupRead [] list (int page , int perPage ) throws IOException , PermitApiError , PermitContextError ;
1818 GroupRead [] list (int page ) throws IOException , PermitApiError , PermitContextError ;
1919 GroupRead [] list () throws IOException , PermitApiError , PermitContextError ;
@@ -26,16 +26,6 @@ interface IGroupsApi {
2626 GroupRead assignUserToGroup (String userId , String groupInstanceKey , String tenant ) throws IOException , PermitApiError , PermitContextError ;
2727 void removeRoleFromGroup (String groupInstanceKey , GroupAddRole groupAddRole ) throws IOException , PermitApiError , PermitContextError ;
2828 void removeUserFromGroup (String userId , String groupInstanceKey , String tenant ) throws IOException , PermitApiError , PermitContextError ;
29-
30-
31- // GroupReadSchema getDirectGroup(String projId, String envId, String groupInstanceKey) throws IOException, PermitApiError, PermitContextError;
32- // PaginatedResultGroupReadSchema listDirectGroup(String projId, String envId, String tenant, String resource, Integer page, Integer perPage, String search) throws IOException, PermitApiError, PermitContextError;
33- // PaginatedResultGroupReadSchema listGroupChildren(String projId, String envId, String groupInstanceKey, Integer page, Integer perPage) throws IOException, PermitApiError, PermitContextError;
34- // PaginatedResultGroupReadSchema listGroupParents(String projId, String envId, String groupInstanceKey, Integer page, Integer perPage) throws IOException, PermitApiError, PermitContextError;
35- // PaginatedResultGroupRoleReadSchema listGroupRoles(String projId, String envId, String groupInstanceKey, Integer page, Integer perPage) throws IOException, PermitApiError, PermitContextError;
36- // PaginatedResultGroupUserReadSchema listGroupUsers(String projId, String envId, String groupInstanceKey, Integer page, Integer perPage) throws IOException, PermitApiError, PermitContextError;
37- // GroupRead assignGroupToGroup(String projId, String envId, String groupInstanceKey, GroupAssignment groupAssignment) throws IOException, PermitApiError, PermitContextError;
38- // void removeGroupFromGroup(String projId, String envId, String groupInstanceKey, GroupAssignment groupAssignment) throws IOException, PermitApiError, PermitContextError;
3929}
4030
4131public class GroupsApi extends BaseApi implements IGroupsApi {
@@ -71,7 +61,7 @@ private String getGroupsUrl(String url) {
7161 *
7262 * @param page The page number of the result set to retrieve.
7363 * @param perPage The number of items per page.
74- * @return A PaginatedResultUserRead object representing the retrieved paginated result of groups.
64+ * @return An array of GroupRead objects representing the retrieved groups.
7565 * @throws IOException If an I/O error occurs during the HTTP request.
7666 * @throws PermitApiError If the Permit API returns a response with an error status code.
7767 * @throws PermitContextError If the configured {@link io.permit.sdk.PermitContext} does not match the required endpoint context.
@@ -86,8 +76,8 @@ public GroupRead[] list(int page, int perPage) throws IOException, PermitApiErro
8676 new Request .Builder ()
8777 .url (
8878 urlBuilder
89- // .addQueryParameter("page", Integer.toString(page))
90- // .addQueryParameter("per_page", Integer.toString(perPage))
79+ .addQueryParameter ("page" , Integer .toString (page ))
80+ .addQueryParameter ("per_page" , Integer .toString (perPage ))
9181 .build ()
9282 )
9383 .get ()
@@ -230,7 +220,7 @@ public void delete(String groupInstanceKey) throws IOException, PermitApiError,
230220 * Assign a role to the group, all users in this group will now have this role.
231221 * It will create relation between the group and the resource, relationship between the resource instances and derivation from the member role to this role.
232222 *
233- * @param groupInstanceKey The key of the group to assign the user .
223+ * @param groupInstanceKey The key of the group to assign the role to .
234224 * @param groupAddRole The {@link GroupAddRole} object containing the assignment data.
235225 * @return The {@link GroupRead} object representing the group after assigning the role.
236226 * @throws IOException If an I/O error occurs during the HTTP request.
@@ -281,7 +271,7 @@ public GroupRead assignUserToGroup(String userId, String groupInstanceKey, Strin
281271 }
282272
283273 /**
284- * Remove a role to the group, all users in this group will lose this role.
274+ * Remove a role from the group, all users in this group will lose this role.
285275 *
286276 * @param groupInstanceKey The key of the group to assign the user.
287277 * @param groupAddRole The {@link GroupAddRole} object containing the assignment data.
0 commit comments