searchGroupMembers
Feature Introduction
Explanation
Search for group members of a specific group using keywords.
Note
(1) Only group members have the permission to search; (2) At least one search domain must be specified; (3) Multiple domains are related by "OR".
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<List<GroupMembersInfo>> searchGroupMembers({
required String groupID,
List<String> keywordList = const [],
bool isSearchUserID = false,
bool isSearchMemberNickname = false,
int offset = 0,
int count = 40,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | String | Yes | Group ID |
keywordList | List<String> | Yes | Keywords |
isSearchUserID | bool | Yes | Search by User ID |
isSearchMemberNickname | bool | Yes | Search by User Nickname |
offset | int | Yes | Starting Offset |
count | int | Yes | Total Number to Query |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
~ | List<GroupMembersInfo> | Return upon success |
Code Example
List<GroupMembersInfo> list = await OpenIM.iMManager.groupManager.searchGroupMembers(
groupID: '',
keywordList: ['haha'],
isSearchUserID: true,
isSearchMemberNickname: true,
offset: 0,
count: 20,
);
// todo
Function Prototype
- (void)searchGroupMembers:(OIMSearchGroupMembersParam *)searchParam
onSuccess:(nullable OIMGroupMembersInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Field Name | Field Type | Required | Description |
---|---|---|---|
SearchGroupMembersParam.groupID | NSString | Yes | Group ID |
SearchGroupMembersParam.keywordList | NSArray< NSString *> | Yes | Search keyword, currently supports only one keyword search, cannot be empty |
SearchGroupMembersParam.isSearchUserID | BOOL | No | Whether to search by User ID |
SearchGroupMembersParam.isSearchMemberNickname | BOOL | No | Whether to search by Nickname, default is false |
SearchGroupMembersParam.offset | NSInteger | No | Offset |
SearchGroupMembersParam.count | NSInteger | No | Quantity |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
onSuccess | NSArray< OIMGroupMemberInfo *> | Return upon success |
onFailure | OIMFailureCallback | Return upon failure |
Code Example
OIMSearchGroupMembersParam *param = [OIMSearchGroupMembersParam new];
param.groupID = @"";
param.keywordList = @[];
param.offset = 0;
param.count = 20;
[OIMManager.manager searchGroupMembers:param
onSuccess:^(NSArray<OIMGroupMemberInfo *> * _Nullable groupMembersInfo) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void searchGroupMembers(OnBase<List<GroupMembersInfo>> callBack, String groupID, List<String> keywordList, boolean isSearchUserID, boolean isSearchMemberNickname, int offset, int count)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
callBack | OnBase<List<GroupMembersInfo>> | Yes | Callback Interface |
groupID | String | Yes | Group ID |
keywordList | List<String> | Yes | Keywords |
isSearchUserID | Boolean | Yes | Search by User ID |
isSearchMemberNickname | Boolean | Yes | Search by User Nickname |
offset | int | Yes | Starting Offset |
count | int | Yes | Total Number to Query |
Return Result
Code Example
OpenIMClient.getInstance().groupManager.searchGroupMembers(new OnBase<List<GroupMembersInfo>>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(List<GroupMembersInfo> data) {
}
}, groupID, keywordList, isSearchUserID, isSearchMemberNickname, offset, count);
Function Prototype
IMSDK.searchGroupMembers({
groupID: string;
keywordList: string[];
isSearchUserID: boolean;
isSearchMemberNickname: boolean;
offset: number;
count: number;
}, operationID?: string): Promise<WsResponse<GroupMemberItem[]>>
Input Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
keywordList | string[] | Yes | Search keywords, currently only supports searching with one keyword and cannot be empty |
isSearchUserID | boolean | Yes | Whether to search group member's userID using the keyword |
isSearchMemberNickname | boolean | Yes | Whether to search group member's nickname using the keyword |
offset | number | Yes | Starting offset for pagination |
count | number | Yes | Number of members to fetch per page |
Return Results
Parameter Name | Data Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<GroupMemberItem[]>> | List of searched group member information |
Promise.catch() | Promise<WsResponse> | Failure callback |
Code Sample
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
// use in mini program
// import { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
IMSDK.searchGroupMembers({
groupID: '',
keywordList: ['nickname'],
isSearchUserID: false,
isSearchMemberNickname: true,
offset: 0,
count: 20,
})
.then(({ data }) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('searchGroupMembers', operationID: string, {
groupID: string;
keywordList: string[];
isSearchUserID: boolean;
isSearchMemberNickname: boolean;
offset: number;
count: number;
}): Promise<GroupMemberItem[]>
Input Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for issue tracking. Keep it unique, suggest using current time and a random number. |
keywordList | string[] | Yes | Search keywords, currently only supports searching with one keyword and cannot be empty |
isSearchUserID | boolean | Yes | Whether to search by userID using the keyword |
isSearchNickname | boolean | Yes | Whether to search by nickname using the keyword |
isSearchRemark | boolean | Yes | Whether to search by remarks using the keyword |
Return Results
The function is made Promise compatible via the
openim-uniapp-polyfill
package. Usethen
andcatch
to handle successful and failed callbacks respectively.
Parameter Name | Data Type | Description |
---|---|---|
Promise.then() | Promise<GroupMemberItem[]> | List of searched group member information |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Sample
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('searchGroupMembers', IMSDK.uuid(), {
groupID: '',
keywordList: ['nickname'],
isSearchUserID: false,
isSearchMemberNickname: true,
offset: 0,
count: 20,
})
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.searchGroupMembers({
groupID: string;
keywordList: string[];
isSearchUserID: boolean;
isSearchMemberNickname: boolean;
offset: number;
count: number;
}, operationID: string): Promise<GroupMemberItem[]>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
keywordList | string[] | Yes | Search keyword. Currently, only supports one keyword and cannot be empty. |
isSearchUserID | boolean | Yes | Search by userID using the keyword. |
isSearchNickname | boolean | Yes | Search by nickname using the keyword. |
isSearchRemark | boolean | Yes | Search by remark using the keyword. |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
offset | number | Yes | Starting offset for pagination |
count | number | Yes | Number of members to fetch per page |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<GroupMemberItem[]> | List of searched group member information |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.searchGroupMembers({
groupID: '',
keywordList: ['nickname'],
isSearchUserID: false,
isSearchMemberNickname: true,
offset: 0,
count: 20,
}, 'operationID')
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void SearchGroupMembers(OnBase<List<GroupMember>> cb, SearchGroupMembersParam searchParam)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase<List<GroupMembersInfo>> | Yes | Callback |
searchParam | SearchGroupMembersParam | Yes | Group ID |
Return Result
Code Example
IMSDK.SearchGroupMembers((list,errCode,errMsg)=>{
},new SearchGroupMembersParam(){
});