getFriendList
Description
info
Get all your friend lists at once. It is recommended to use getFriendListPage to get them paginated.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron
- React-Native
- Unity
Function Prototype
Future<List<FriendInfo>> getFriendList({String? operationID, bool filterBlack = false})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | bool | No | Whether to filter out the blocklist |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| ~ | List< FriendInfo * > | Success |
Code Example
List<FriendInfo> list = await OpenIM.iMManager.friendshipManager.getFriendList();
// todo
Function Prototype
- (void)getFriendListWithFilterBlack:(BOOL)filterBlack
onSuccess:(nullable OIMFriendInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | BOOL | No | Whether to filter out the blocklist |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | NSArray< OIMFriendInfo * > | Success |
| onFailure | OIMFailureCallback | Failure |
Code Example
[OIMManager.manager getFriendListWithFilterBlack: NO,
onSuccess:^(NSArray<OIMFriendInfo *> * _Nullable userInfos) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void getFriendList(OnBase<List<UserInfo>> base, Boolean filterBlack)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | Boolean | No | Whether to filter out the blocklist |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| data | List<UserInfo> | Success |
Code Example
OpenIMClient.getInstance().friendshipManager.getFriendList(new OnBase<List<UserInfo>>() {
@Override
public void onError(int code, String error) {
// todo: handle error information
}
@Override
public void onSuccess(List<UserInfo> data) {
// todo: request successful, returns List<UserInfo>
}
}, filterBlack);
Function Prototype
IMSDK.getFriendList(filterBlack?: boolean, operationID?: string): Promise<WsResponse<FriendUserItem[]>>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | boolean | No | Whether to filter out blocked friends, defaults to not filtering |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse<FriendUserItem[]>> | List of friend information objects |
| Promise.catch() | Promise<WsResponse> | Failure callback |
Code Example
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();
IMSDK.getFriendList()
.then(({ data }) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('getFriendList', operationID: string, filterBlack: boolean): Promise<FriendUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | boolean | Yes | Whether to filter out the blocklist |
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
Use the
openim-uniapp-polyfillpackage to make the function Promise. When calling, you need to usethenandcatchto determine and handle success and failure callbacks.
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<FriendUserItem[]>> | List of friend information objects |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('getFriendList', IMSDK.uuid(), false)
.then((data) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDK.getFriendList(filterBlack: boolean, operationID?: string): Promise<FriendUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | boolean | Yes | Whether to filter out the blocklist |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<FriendUserItem[]>> | List of friend information objects |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from "@openim/rn-client-sdk";
OpenIMSDK.getFriendList(false)
.then((data) => {
// Success
})
.catch((error) => {
// Failure
});
Function Prototype
public static void GetFriendList(OnBase<FriendInfo> cb,bool filterBlack)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| cb | OnBase<List<FriendInfo>> | Yes | Callback |
| filterBlack | bool | Yes | Whether to filter out the blocklist |
Code Example
IMSDK.GetFriendList((list,errCode,errMsg)=>{
},true);