会话列表
获取会话列表与单个会话详情;会话按置顶优先、更新时间倒序排列。
平台调用风格
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 未暴露(见对应小节)。
跨端方法名
| 操作 | Android | Web | Electron | macOS | Flutter | Native (C ABI) | iOS |
|---|---|---|---|---|---|---|---|
getConversationList | getConversationList | getConversationList | getConversationList | getConversationList | getConversationList | im_client_conversation_list | func |
getConversation | getConversation | getConversation | getConversation | getConversation | getConversation | — | func |
方法名在 GA 平台之间保持一致(规则 A);Native C ABI 只覆盖部分操作,其余操作以 — 标注。
getConversationList
会话列表:置顶优先、按 updatedAt 倒序;含未读/提及/草稿/免打扰。
im_client_conversation_list(im_client_t*, char** out_json) + im_string_free返回
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 未暴露该方法
本操作未在 native C ABI(include/im_sdk.h)暴露;如需该能力,请使用 Web / Electron / Flutter / Android 绑定,或通过服务端 Open API 完成。
参数
| 参数 | 类型 | 说明 |
|---|---|---|
conversationType | ConversationType | 必填;会话类型枚举(ConversationType) |
targetId | string | 必填;目标会话 ID:单聊为对方 userId,群聊为 groupId,聊天室为 chatroomId |
返回
Conversation 会话实体(未读数、置顶、草稿、免打扰)
错误码
| 错误码 | 名称 | 分类 | HTTP | 可重试 | 说明 |
|---|---|---|---|---|---|
1001 | INVALID_PARAMETER | 客户端 / 参数 / 权限 | 400 | 否 | 参数错误 |
相关文档
- 功能列表:103 个操作与签名
- 状态码:错误码与重试策略
- API 参考:类与成员
- IMLib 集成指南