searchGroupMembers
Introduction
Search group members by keyword.
This method could search the group members cached in local storage, according to the keywords provided, supports searching with nickName, remark, user ID and name card.
Do not works with AVChatRoom.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
keywordList | string[] | yes | The keyword list, maximum supports 5 keywords. |
groupIDList | string[] | no | The list of groups, empty means search in all the joined group. |
isSearchMemberUserID | boolean | no | Is search by user ID. |
isSearchMemberNickName | boolean | no | Is search by nickName. |
isSearchMemberRemark | boolean | no | Is search by remark in the group. |
isSearchMemberNameCard | boolean | no | Is search by name card. |
Returned template
V2TimValueCallback<{groupMemberSearchResultItems: StringMap}>
{
code : number
desc : string
data : {
groupMemberSearchResultItems : StringMap// The search result list.
}
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
data | {groupMemberSearchResultItems: StringMap} | The search result list. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const param = {
groupIDList: [],
isSearchMemberNameCard: true,
isSearchMemberRemark: true,
isSearchMemberNickName: true,
isSearchMemberUserID: true,
keywordList: [],
};
const searchGroupMembersRes = await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.searchGroupMembers(param);
if (searchGroupMembersRes.code === 0) {
searchGroupMembersRes.data?.groupMemberSearchResultItems;
}