getFriendListPage
Feature Introduction
Description
Get the list of the specified number of friends in pages. offset is the offset when getting, count is the number of friends
Note
The count should not be too large, otherwise the request will take 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 | Mandatory | Description |
---|---|---|---|
offset | int | Yes | page offset |
count | int | Yes | page size |
filterBlack | bool | No | if true, the return value will not be include blacklist users. |
Return Values
Parameter Name | Parameter Type | Description |
---|---|---|
~ | List< FriendInfo * > | Success |
Code Example
List<FriendInfo> list = await OpenIM.iMManager.friendshipManager.getFriendList();
// 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 | Mandatory | Description |
---|---|---|---|
offset | NSInteger | Yes | page offset |
count | NSInteger | Yes | page size |
filterBlack | BOOL | No | if true, the return value will not be include blacklist users. |
Return Values
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 | Mandatory | Description |
---|---|---|---|
offset | int | Yes | page offset |
count | int | Yes | page size |
filterBlack | Boolean | No | if true, the return value will not be include blacklist users. |
Return Values
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: request error
}
@Override
public void onSuccess(List<UserInfo> data) {
// todo: request success
}
}, filterBlack);
Function Prototype
IMSDK.getFriendListPage({
offset: number;
count: number;
filterBlack?: boolean;
}, operationID?: string): Promise<WsResponse<FriendUserItem[]>>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
offset | number | Yes | Page pulls the start subscript |
count | number | Yes | The number of pulls per page |
filterBlack | boolean | No | Whether to filter out the blacklist |
operationID | string | No | Operation ID, which is used to locate the problem. Keep it unique. You are advised to use the current time and random number |
Return Values
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<FriendUserItem[]>> | List of friend info |
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 { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
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 | Mandatory | Description |
---|---|---|---|
offset | number | Yes | Page pulls the start subscript |
count | number | Yes | The number of pulls per page |
filterBlack | boolean | No | Whether to filter out the blacklist |
operationID | string | Yes | Operation ID for troubleshooting, recommended unique timestamp |
Return Values
Utilizing the
openim-uniapp-polyfill
package to make the function Promise-based. Usethen
andcatch
to handle successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<FriendUserItem[]>> | List of friend info |
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
OpenIMSDKRN.getFriendListPage({
offset: number;
count: number;
filterBlack?: boolean;
}, operationID: string): Promise<FriendUserItem[]>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
offset | number | Yes | Page pulls the start subscript |
count | number | Yes | The number of pulls per page |
filterBlack | boolean | No | Whether to filter out the blacklist |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<FriendUserItem[]>> | List of friend info |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.getFriendListPage({
offset,
count,
}, 'operationID')
.then((data) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
public static void GetFriendListPage(OnBase<List<FriendInfo>> cb,bool filterBlack)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase<List<FriendInfo>> | Yes | Callback |
filterBlack | bool | No | if true, the return value will not be include blacklist users. |
Code Example
IMSDK.GetFriendList((list,errCode,errMsg)=>{
},true);