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