getConversationListSplit
功能介绍
说明
分页获取会话列表。
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
函数原型
 Future<List<ConversationInfo>> getConversationListSplit({
    int offset = 0,
    int count = 20,
    String? operationID,
  })
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| offset | int | 是 | 分页拉取起始下标 | 
| count | int | 是 | 一页拉取的数量 | 
返回结果
| 名称 | 类型 | 描述 | 
|---|---|---|
| ~ | List<ConversationInfo> | 成功返回 | 
代码示例
    List<ConversationInfo> list = await OpenIM.iMManager.conversationManager.getConversationListSplit();
    //todo
函数原型
- (void)getConversationListSplitWithOffset:(NSInteger)offset
                                     count:(NSInteger)count
                                 onSuccess:(nullable OIMConversationsInfoCallback)onSuccess
                                 onFailure:(nullable OIMFailureCallback)onFailure;
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| offset | NSInteger | 是 | 分页拉取起始下标 | 
| count | NSInteger | 是 | 一页拉取的数量 | 
返回结果
| 名称 | 类型 | 描述 | 
|---|---|---|
| onSuccess | NSArray< OIMConversationInfo *> | 成功返回 | 
| onFailure | OIMFailureCallback | 失败返回 | 
代码示例
[OIMManager.manager getConversationListSplitWithOffset:0
                                                 count:20
                                             onSuccess:^(NSArray<OIMConversationInfo *> * _Nullable conversations) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
函数原型
public void getConversationListSplit(OnBase<List<ConversationInfo>> base, long offset, long count)
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| base | OnBase<List<ConversationInfo>> | 是 | 回调接口 | 
| offset | int | 是 | 起始偏移量 | 
| count | int | 是 | 数量 | 
代码示例
        OpenIMClient.getInstance().conversationManager.getConversationListSplit(new OnBase<List<ConversationInfo>>() {
            @Override
            public void onError(int code, String error) {
            }
            @Override
            public void onSuccess(List<ConversationInfo> data) {
            }
        },offset,count);
函数原型
IMSDK.getConversationListSplit({
  offset: number;
  count: number;
},operationID?: string): Promise<WsResponse<ConversationItem[]>>
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| offset | number | 是 | 分页拉取起始下标 | 
| count | number | 是 | 一页拉取的数量 | 
返回结果
| 参数名称 | 参数类型 | 描述 | 
|---|---|---|
| Promise.then() | Promise<WsResponse<ConversationItem[]>> | 调用成功回调 | 
| Promise.catch() | Promise<WsResponse> | 调用失败回调 | 
代码示例
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.getConversationListSplit({
  offset: 0,
  count: 20,
})
  .then(({ data }) => {
    // 调用成功
  })
  .catch(({ errCode, errMsg }) => {
    // 调用失败
  });
函数原型
IMSDK.asyncApi('getConversationListSplit', operationID: string, {
  offset: number;
  count: number;
}): Promise<ConversationItem[]>
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| operationID | string | 是 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 | 
| offset | number | 是 | 分页拉取起始下标 | 
| count | number | 是 | 一页拉取的数量 | 
返回结果
通过
openim-uniapp-polyfill包将函数 Promise 化,调用时需要使用then和catch判断并处理成功和失败回调。
| 参数名称 | 参数类型 | 描述 | 
|---|---|---|
| Promise.then() | Promise<ConversationItem[]> | 调用成功回调 | 
| Promise.catch() | Promise<CatchResponse> | 调用失败回调 | 
代码示例
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('getConversationListSplit', IMSDK.uuid(), {
  offset: 0,
  count: 20,
})
  .then((data) => {
    // 调用成功
  })
  .catch(({ errCode, errMsg }) => {
    // 调用失败
  });
函数原型
OpenIMSDKRN.getConversationListSplit({
  offset: number,
  count: number,
}, operationID: string): Promise<ConversationItem[]>
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| operationID | string | 是 | 操作 ID,用于定位问题,保持唯一,建议用当前时间和随机数 | 
| offset | number | 是 | 分页拉取起始下标 | 
| count | number | 是 | 一页拉取的数量 | 
返回结果
| 参数名称 | 参数类型 | 描述 | 
|---|---|---|
| Promise.then() | Promise<ConversationItem[]> | 调用成功回调 | 
| Promise.catch() | Promise<CatchResponse> | 调用失败回调 | 
代码示例
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.getConversationListSplit({
  offset: 0,
  count: 20,
}, 'operationID')
  .then((data) => {
    // 调用成功
  })
  .catch(({ errCode, errMsg }) => {
    // 调用失败
  });
函数原型
public static void GetConversationListSplit(OnBase<List<Conversation>> cb, int offset, int count)
输入参数
| 参数名称 | 参数类型 | 是否必填 | 描述 | 
|---|---|---|---|
| cb | OnBase<List<Conversation>> | 是 | 回调接口 | 
| offset | int | 是 | 起始偏移量 | 
| count | int | 是 | 数量 | 
代码示例
IMSDK.GetConversationListSplit((list,errCode,errMsg)=>{
},offset,count);