# Management group

This module is used to manage the Authing group, and can perform operations such as group addition, deletion, modification, group addition/deleting users, group addition/deletion strategies, etc.

# Create group

GroupsManagementClient().create(groupInfo)

Create group

# Parameters

  • groupInfo <CreateGroupParam> group data
  • groupInfo.code <string> group unique identifier
  • groupInfo.name <boolean> group name
  • groupInfo.description <string> description

# Example

String code = "code1";
String name = "name1";
String description = "desc1";
Group group = managementClient.group().create(new CreateGroupParam(code, name, description)).execute();

# Delete group

GroupsManagementClient().delete(code)

Delete group

# Parameters

  • code <string> group unique identifier

# Example

String code = "code1";
CommonMessage message = managementClient.group().delete(code).execute();

# Modify group

GroupsManagementClient().update(groupInfo)

Modify group

# Parameters

  • groupInfo <CreateGroupParam> group data
  • groupInfo.code <string> group unique identifier
  • groupInfo.name <boolean> group name
  • groupInfo.description <string> description
  • groupInfo.newCode <string> new unique identifier

# Example

String code = "code1";
String name = "name1";
String description = "desc1";
String newCode = "code2";
Group group = managementClient.group().update(new UpdateGroupParam(code, name, description, newCode)).execute();

# Get group details

GroupsManagementClient().detail(code)

# Parameters

  • code <string> group unique identifier

# Example

String code = "code1";
Group group = managementClient.group().detail(code).execute();

# Get group list

GroupsManagementClient().list(listParam)

Get group list

# Parameters

  • listParam <GroupsParam> paging request parameters
  • listParam.userId <string> user ID
  • listParam.page <number> page number Default value: 1
  • listParam.limit <number> number per page Default value: 10
  • listParam.sortBy <SortByEnum> sorting rules

# Example

String userId = "userId1";
int page = 1;
int limit = 10;
SortByEnum sortEnum = SortByEnum.CREATEDAT_DESC;
PaginatedGroups groups = managementClient.group().list(new GroupsParam(userId, page, limit, sortEnum)).execute();

# Batch delete groups

GroupsManagementClient().deleteMany(codeList)

Batch delete groups

# Parameters

  • codeList <string[]> group unique identifier list

# Example

ArrayList<String> codeList = new ArrayList<>();
codeList.add("code1");
CommonMessage message = managementClient.group().deleteMany(codeList).execute();

# Get the list of grouped users

GroupsManagementClient().listUsers(groupWithUsersParam)

Get grouped user list

# Parameters

  • groupWithUsersParam <GroupWithUsersParam>
  • groupWithUsersParam.code <string> group unique identifier
  • groupWithUsersParam.page <number> page number Default value: 1
  • groupWithUsersParam.limit <number> number per page Default value: 10

# Example

String code = "code1";
int page = 1;
int limit = 10;
PaginatedUsers users = managementClient.group().listUsers(code, page, limit).execute();

# Add user

GroupsManagementClient().addUsers(addUserToGroupParam)

Add user

# Parameters

  • addUserToGroupParam <AddUserToGroupParam>
  • addUserToGroupParam.code <string> group unique identifier
  • addUserToGroupParam.userIds <string[]> User ID list

# Example

String code = "code1";
List<String> userIds = new ArrayList<>();
userIds.add("userId1");
CommonMessage message = managementClient.group().addUsers(new AddUserToGroupParam(userIds, code)).execute();

# Remove user

GroupsManagementClient().removeUsers(removeUserFromGroupParam)

Remove user

# Parameters

  • removeUserFromGroupParam <RemoveUserFromGroupParam>
  • removeUserFromGroupParam.code <string> group unique identifier
  • removeUserFromGroupParam.userIds <string[]> list of user IDs

# Example

String code = "code1";
List<String> userIds = new ArrayList<>();
userIds.add("userId1");
CommonMessage message = managementClient.group().removeUsers(new RemoveUserFromGroupParam(userIds, code)).execute();