# Manage Groups
This module is used to manage Authing groups, and can perform operations such as group addition, deletion, modification, group addition/deleting users, group addition/deletion strategies, etc.
Please use the module in the following way instead of initializing the module directly:
import {ManagementClient} from "authing-js-sdk"
const managementClient = new ManagementClient({
userPoolId: "YOUR_USERPOOL_ID",
secret: "YOUR_USERPOOL_SECRET",
})
managementClient.groups.list // Get group list
managementClient.groups.create // Create group
managementClient.groups.listUsers // Get the list of grouped users
# Create group
GroupsManagementClient().create(code, name, description)
Create group
# Parameters
code
<string> group unique identifiername
<string> group namedescription
<string> description
# Example
managementClient.groups.create('group','group xxx')
# return value
Promise<DeepPartial<Group>>
# Delete group
GroupsManagementClient().delete(code)
Delete group
# Parameters
code
<string> group unique identifier
# Example
managementClient.groups.delete('rolea')
# return value
Promise<CommonMessage>
# Modify group
GroupsManagementClient().update(code, input)
Modify group
# Parameters
code
<string> group unique identifierinput
<Object>input.name
<string> new nameinput.description
<string> new description informationinput.newCode
<string> New unique identifier
# Example
managementClient.groups.update('group', {newCode:'newcode'})
# return value
Promise<DeepPartial<Group>>
# Get group details
GroupsManagementClient().detail(code)
Get group details
# Parameters
code
<string> group unique identifier
# Example
managementClient.groups.detail('manager')
# return value
Promise<DeepPartial<Group>>
group details
# Get group list
GroupsManagementClient().list(page, limit)
Get group list
# Parameters
page
<number> Page number The default value is:1
.limit
<number> Number per page The default value is10
.
# Example
managementClient.groups.list(1, 10)
# return value
Promise<DeepPartial<PaginatedGroups>>
# Batch delete groups
GroupsManagementClient().deleteMany(codeList)
Batch delete groups
# Parameters
codeList
<string[]> group unique identifier list
# Example
managementClient.groups.deleteMany(['groupa','groupb'])
# return value
Promise<CommonMessage>
# Get the list of grouped users
GroupsManagementClient().listUsers(code, page, limit)
Get grouped user list
# Parameters
code
<string> group unique identifierpage
<number> Page number The default value is:1
.limit
<number> Number per page The default value is10
.
# Example
managementClient.groups.listUsers(code)
# return value
Promise<DeepPartial<PaginatedUsers>>
# Add user
GroupsManagementClient().addUsers(code, userIds)
Add user
# Parameters
code
<string> group unique identifieruserIds
<string[]> list of user IDs
# Example
managementClient.groups.addUsers(code, ['USERID1','USERID2'])
# return value
Promise<CommonMessage>
# Remove user
GroupsManagementClient().removeUsers(code, userIds)
Remove user
# Parameters
code
<string> group unique identifieruserIds
<string[]> list of user IDs
# Example
managementClient.groups.removeUsers(code, ['USERID1','USERID2'])
# return value
Promise<CommonMessage>