This topic describes the methods used to manage groups and members.
The options parameter of the IPDSRequestConfig type is encapsulated based on the request config options of axios. For more information, see AxiosRequestConfig.
createGroup
To call this method, you must be granted the administrator permissions or be a group administrator.
Creates a group.
const result = await client.createGroup(params, options)Sample code
await client.createGroup({
group_name: 'test',
description: '',
is_root: true
})Request parameters
Parameter | Type | Required | Description |
params | ICreatGroupReq | Yes | The information about the group. |
options | IPDSRequestConfig | Other request parameters. |
ICreatGroupReq
Parameter | Type | Required | Description |
group_name | string | Yes | The name of the group. |
description | string | The description of the group. | |
is_root | boolean | Specifies whether the group is a root group. | |
parent_group_id | string | The parent group ID. You can specify only one of the parent_group_id and is_root parameters. |
Response parameters
Parameter | Type | Required | Description |
result | IGroupItem | Yes | The returned results. |
IGroupItem
Parameter | Type | Required | Description |
domain_id | string | The domain ID. | |
group_id | string | The group ID. | |
group_name | string | The name of the group. | |
description | string | The description of the group. | |
created_at | number | The time when the group was created. | |
updated_at | number | The time when the group was last updated. |
deleteGroup
To call this method, you must be granted the administrator permissions or be a group administrator.
Deletes a group.
await client.deleteGroup(params, options)Sample code
await client.deleteGroup({
group_id: '0cbfe8de7d7645ea835b1b1a91101e4d'
})Request parameters
Parameter | Type | Required | Description |
params | Object | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
params
Parameter | Type | Required | Description |
group_id | string | Yes | The group ID. |
Response parameters
None
updateGroup
To call this method, you must be granted the administrator permissions or be a group administrator.
Updates a group.
await client.updateGroup(params, options)Sample code
await client.updateGroup({
group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
group_name: 'new_name',
description: 'test'
})Request parameters
Parameter | Type | Required | Description |
params | IUpdateGroupReq | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
IUpdateGroupReq
Parameter | Type | Required | Description |
group_id | string | Yes | The group ID. |
group_name | string | The name of the group. | |
description | string | Specifies whether the group is a root group. |
Response parameters
Parameter | Type | Required | Description |
result | IGroupItem | Yes | The returned results. |
getGroup
Queries the information about a group.
const result = await client.getGroup(params, options)Sample code
const groupInfo = await client.getGroup({
group_id: '0cbfe8de7d7645ea835b1b1a91101e4d'
})Request parameters
Parameter | Type | Required | Description |
params | Object | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
params
Parameter | Type | Required | Description |
group_id | string | Yes | The group ID. |
Response parameters
Parameter | Type | Required | Description |
result | IGroupItem | Yes | The returned results. |
listGroups
Queries a list of groups.
await client.listGroups(params, options)Sample code
await client.listGroups({
limit: 100,
marker:''
})Request parameters
Parameter | Type | Required | Description |
params | IListReq | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
IListReq
Parameter | Type | Required | Description |
limit | number | The maximum number of entries to return. Valid values: 1 to 100. Default value: 100. | |
marker | string | The start identifier of the query. |
Response parameters
Parameter | Type | Required | Description |
result | IListRes | Yes | The returned results. |
IListRes
Parameter | Type | Required | Description |
items | IGroupItem[] | The groups. | |
next_marker | string | The start identifier of the next query. |
searchGroups
Queries a list of groups and sorts the groups in descending order based on the time when a group was last updated.
await client.searchGroups(params, options)const {items=[]} = await client.listGroups({
limit: 100,
marker:'',
group_name: 'test_group_name'
})Request parameters
Parameter | Type | Required | Description |
params | Object | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
params
Parameter | Type | Required | Description |
limit | number | The maximum number of entries to return. Valid values: 1 to 100. Default value: 100. | |
marker | string | The start identifier of the query. | |
group_name | string | The name of the group. |
Response parameters
Parameter | Type | Required | Description |
result | IListRes | Yes | The returned results. |
IListRes
Parameter | Type | Required | Description |
items | IGroupItem[] | The groups. | |
next_marker | string | The start identifier of the next query. |
listGroupMembers
To call this method, you must be granted the administrator permissions or be a group administrator.
Queries the child groups or users in a group.
await client.listGroupMembers(params, options)Sample code
await client.listGroupMembers({
limit: 100,
marker:'',
group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
member_type: 'group'
})Request parameters
Parameter | Type | Required | Description |
params | Object | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
params
Parameter | Type | Required | Description |
limit | number | The maximum number of entries to return. Valid values: 1 to 100. Default value: 100. | |
marker | string | The start identifier of the query. | |
group_id | string | Yes | The group ID. |
member_type | string | Yes | The type of the member. Valid values: user and group. |
Response parameters
Parameter | Type | Required | Description |
result | IListGroupMembersRes | Yes | The returned results. |
IListGroupMembersRes
Parameter | Type | Description |
user_items | IUserItem[] | The users. |
group_items | IGroupItem[] | The groups. |
next_marker | string | The start identifier of the next query. |
addGroupMember
To call this method, you must be granted the administrator permissions or be a group administrator.
Adds a user to a group as a member.
const result = await client.addGroupMember(params, options)Sample code
await client.addGroupMember({
member_id: 'test',
member_type: 'user',
group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
})Request parameters
Parameter | Type | Required | Description |
params | IAddGroupMemberReq | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
IAddGroupMemberReq
Parameter | Type | Required | Description |
group_id | string | Yes | The group ID. |
member_id | string | Yes | The user ID. |
member_type | string | Yes | The type of the member. Set the value to user. To create a child group, call the createGroup method. |
Response parameters
None
removeGroupMember
To call this method, you must be granted the administrator permissions or be a group administrator.
Removes a member from a group.
await client.removeGroupMember(params, options)Sample code
await client.removeGroupMember({
member_id: 'test',
member_type: 'user',
group_id: '0cbfe8de7d7645ea835b1b1a91101e4d',
})Request parameters
Parameter | Type | Required | Description |
params | IRemoveGroupMemberReq | Yes | The request parameters. |
options | IPDSRequestConfig | Other request parameters. |
IRemoveGroupMemberReq
Parameter | Type | Required | Description |
group_id | string | Yes | The group ID. |
member_id | string | Yes | The user ID. |
member_type | string | Yes | The type of the member. You can remove only users from a group. To remove a child group, call the deleteGroup method.
|
Response parameters
None