getFriendListPage
Description
info
Get a paginated list of a specified number of friends. offset is the starting index for pagination, and count is the number of records per page.
Note
The count number should not be too large, otherwise the request duration will be too long.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<List<FriendInfo>> getFriendListPage({String? operationID, bool filterBlack = false, int offset = 0, int count = 40,})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| filterBlack | bool | No | Whether to filter out the blocklist |
| offset | int | Yes | Starting index for pagination |
| count | int | Yes | Number of records per page |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| ~ | List< FriendInfo * > | Success |
Code Example
List<FriendInfo> list = await OpenIM.iMManager.friendshipManager.getFriendListPage();
// todo
Function Prototype
- (void)getFriendListPageWithFilterBlack:(BOOL)filterBlack
offset:(NSInteger)offset
count:(NSInteger)count
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 |
| offset | NSInteger | Yes | Starting index for pagination |
| count | NSInteger | Yes | Number of records per page |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | NSArray< OIMFriendInfo * > | Success |
| onFailure | OIMFailureCallback | Failure |
Code Example
[OIMManager.manager getFriendListPageWithFilterBlack: NO
offset:offset
count:count
onSuccess:^(NSArray<OIMFriendInfo *> * _Nullable userInfos) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void getFriendListPage(OnBase<List<UserInfo>> base, int offset, int count, Boolean filterBlack)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| offset | int | Yes | Starting index for pagination |
| count | int | Yes | Number of records per page |
| 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.getFriendListPage(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.getFriendListPage({
offset: number;
count: number;
filterBlack?: boolean;
}, operationID?: string): Promise<WsResponse<FriendUserItem[]>>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| offset | number | Yes | Starting index for pagination |
| count | number | Yes | Number of records per page |
| 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();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
IMSDK.getFriendListPage({ offset, count })
.then(({ data }) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('getFriendListPage', operationID: string, {
offset: number;
count: number;
filterBlack?: boolean;
}): Promise<FriendUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| offset | number | Yes | Starting index for pagination |
| count | number | Yes | Number of records per page |
| filterBlack | boolean | No | 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<WsResponse<FriendUserItem[]>> | List of friend information objects |
| Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('getFriendListPage', IMSDK.uuid(), {
offset,
count,
})
.then((data) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDK.getFriendListPage({
offset: number;
count: number;
filterBlack?: boolean;
}, operationID?: string): Promise<FriendUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| offset | number | Yes | Starting index for pagination |
| count | number | Yes | Number of records per page |
| filterBlack | boolean | No | 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<WsResponse<FriendUserItem[]>> | List of friend information objects |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from "@openim/rn-client-sdk";
OpenIMSDK.getFriendListPage({
offset,
count,
})
.then((data) => {
// Success
})
.catch((error) => {
// Failure
});
Function Prototype
public static void GetFriendListPage(OnBase<List<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.GetFriendListPage((list,errCode,errMsg)=>{
},true);