会话删除与类型免打扰
删除会话记录(只删会话行,不删历史消息)与按会话类型设置提醒级别;类型级设置优先于全局默认,单会话设置优先于类型级设置。
平台调用风格
异步风格:Future<RcResult<T>>;错误码在 res.code,不使用异常表达业务失败。
接口一览
| 操作 | 语义 | 传输 | 返回 |
|---|---|---|---|
deleteConversation | 删除会话记录(列表项/未读/草稿/置顶),历史消息保留;同时从标签移除;幂等。 | REST(客户端) | {removed:bool} |
getConversationTypeNotification | 查询按会话类型默认免打扰级别(0 全部 / 1 仅 @ / 2 免打扰)。 | REST(客户端) | {conversationType:int, level:int} |
setConversationTypeNotification | 设置按会话类型默认免打扰级别(0 全部 / 1 仅 @ / 2 免打扰)。 | REST(客户端) | {conversationType:int, level:int} |
本页 3 个操作,其中 3 个在本平台绑定中声明了方法签名。
跨端方法名
| 操作 | Android | Web | Electron | macOS | Flutter | Native (C ABI) | iOS |
|---|---|---|---|---|---|---|---|
deleteConversation | deleteConversation | deleteConversation | deleteConversation | deleteConversation | deleteConversation | — | func |
getConversationTypeNotification | getConversationTypeNotification | getConversationTypeNotification | getConversationTypeNotification | getConversationTypeNotification | getConversationTypeNotification | — | func |
setConversationTypeNotification | setConversationTypeNotification | setConversationTypeNotification | setConversationTypeNotification | setConversationTypeNotification | setConversationTypeNotification | — | func |
方法名在 GA 平台之间保持一致(规则 A);Native C ABI 只覆盖部分操作,其余操作以 — 标注。
deleteConversation
删除会话记录(列表项/未读/草稿/置顶),历史消息保留;同时从标签移除;幂等。
deleteConversation(int conversationType, String targetId)参数
| 参数 | 类型 | 说明 |
|---|---|---|
conversationType | ConversationType | 必填;会话类型枚举(ConversationType) |
targetId | string | 必填;目标会话 ID:单聊为对方 userId,群聊为 groupId,聊天室为 chatroomId |
返回
{removed:bool} 成功返回的数据;失败时按错误码处理
示例
Dart
final res = await engine.deleteConversation(1, 'user2');
if (res.code != 0) throw Exception(res.msg);该操作未声明专属错误码;失败时按 SDK 通用错误处理,见 状态码。
getConversationTypeNotification
查询按会话类型默认免打扰级别(0 全部 / 1 仅 @ / 2 免打扰)。
getConversationTypeNotification(int conversationType)参数
| 参数 | 类型 | 说明 |
|---|---|---|
conversationType | ConversationType | 必填;会话类型枚举(ConversationType) |
返回
{conversationType:int, level:int} 成功返回的数据;失败时按错误码处理
示例
Dart
final res = await engine.getConversationTypeNotification(1);
if (res.code != 0) throw Exception(res.msg);错误码
| 错误码 | 名称 | 分类 | HTTP | 可重试 | 说明 |
|---|---|---|---|---|---|
1001 | INVALID_PARAMETER | 客户端 / 参数 / 权限 | 400 | 否 | 参数错误 |
setConversationTypeNotification
设置按会话类型默认免打扰级别(0 全部 / 1 仅 @ / 2 免打扰)。
setConversationTypeNotification(int conversationType, int level)参数
| 参数 | 类型 | 说明 |
|---|---|---|
conversationType | ConversationType | 必填;会话类型枚举(ConversationType) |
level | int | 必填;字段含义见类型定义 |
返回
{conversationType:int, level:int} 成功返回的数据;失败时按错误码处理
示例
Dart
final res = await engine.setConversationTypeNotification(1, 0);
if (res.code != 0) throw Exception(res.msg);错误码
| 错误码 | 名称 | 分类 | HTTP | 可重试 | 说明 |
|---|---|---|---|---|---|
1001 | INVALID_PARAMETER | 客户端 / 参数 / 权限 | 400 | 否 | 参数错误 |
相关文档
- 功能列表:103 个操作与签名
- 状态码:错误码与重试策略
- API 参考:类与成员
- IMLib 集成指南