会话列表

获取会话列表与单个会话详情;会话按置顶优先、更新时间倒序排列。

平台调用风格

C ABI 约定:im_client_* 返回 int(0 成功,非 0 为 IDL 错误码);char** out_json 由库分配、调用方用 im_string_free 释放;char* out + size_t cap 为调用方缓冲区(0 成功 / -1 参数非法 / -2 缓冲区不足)。

接口一览​

操作语义传输返回
getConversationList会话列表:置顶优先、按 updatedAt 倒序;含未读/提及/草稿/免打扰。REST(客户端)Conversation[]
getConversation单会话详情。REST(客户端)Conversation

本页 2 个操作,其中 1 个在本平台绑定中声明了方法签名,其余为 C ABI 未暴露(见对应小节)。

跨端方法名​

操作AndroidWebElectronmacOSFlutterNative (C ABI)iOS
getConversationListgetConversationListgetConversationListgetConversationListgetConversationListgetConversationListim_client_conversation_listfunc
getConversationgetConversationgetConversationgetConversationgetConversationgetConversation—func

方法名在 GA 平台之间保持一致(规则 A);Native C ABI 只覆盖部分操作,其余操作以 — 标注。

getConversationList​

会话列表:置顶优先、按 updatedAt 倒序;含未读/提及/草稿/免打扰。

im_client_conversation_list(im_client_t*, char** out_json) + im_string_free
REST(客户端)since 1.0.0
返回

Conversation[] 会话列表(置顶优先、updatedAt 倒序;含未读/提及/草稿/免打扰)

示例
C
char* conversations_json = NULL;
int rc = im_client_conversation_list(client, &conversations_json);
if (rc == 0) { /* 解析 conversations_json */ }
im_string_free(conversations_json);

该操作未声明专属错误码;失败时按 SDK 通用错误处理,见 状态码。

getConversation​

单会话详情。

本平台 C ABI 未暴露该方法
REST(客户端)since 1.0.0

本操作未在 native C ABI(include/im_sdk.h)暴露;如需该能力,请使用 Web / Electron / Flutter / Android 绑定,或通过服务端 Open API 完成。

参数
参数类型说明
conversationTypeConversationType必填;会话类型枚举(ConversationType)
targetIdstring必填;目标会话 ID:单聊为对方 userId,群聊为 groupId,聊天室为 chatroomId
返回

Conversation 会话实体(未读数、置顶、草稿、免打扰)

错误码
错误码名称分类HTTP可重试说明
1001INVALID_PARAMETER客户端 / 参数 / 权限400否参数错误

相关文档​