SDK 公开面与文档覆盖
本页回答一个具体问题:这个平台导出的每个公开方法、事件、枚举与数据类型,在文档中心的哪一页被说明?页面由 SDK 制品公开面(api-surface 快照)与 IDL 绑定声明生成,逐项给出签名与文档位置;差异(多余/缺失的方法)如实标注,不做静默补齐。
契约(IDL 语义操作)是语义权威:方法名、参数、返回、错误码、示例都以功能页为准。
制品快照用于确认该平台是否真的导出了该方法;快照与实现不一致时,页面标注差异而不是猜测。
本页只做索引与核对,不重复功能页的参数表与示例。
来源与口径
| 项 | 内容 |
|---|---|
| 制品公开面 | 已读取该平台的 api-surface 快照(103 个公开方法) |
| 契约语义 | IDL 1.0.0 的 103 个语义操作 + 16 个事件 |
| 绑定签名 | 来自 IDL 绑定声明的方法签名(各平台语言风格) |
| 口径说明 | iOS 以 Swift + Objective-C 双接口交付:制品快照与绑定声明逐项对应 62 个语义操作与 10 个 IMKit 组件。 |
覆盖摘要
| 类别 | 数量 | 文档承载位置 |
|---|---|---|
| IDL 语义操作 | 103 | 功能页(每操作:说明 + 参数表 + 返回值 + 错误码 + 示例) |
| 绑定便捷方法 | 0 | — |
| 事件 | 16 | 本页事件表 + 连接监听 |
| 枚举 / 常量 | 1 | API 参考「枚举」各页 |
| 数据类型 | 58 | API 参考「类」各页 + 方法参数/返回值表 |
公开方法索引
下表逐项列出本平台导出的公开方法(IDL 语义操作在前,绑定便捷方法在后),并给出承载页面。功能页内的每个操作都有独立的参数表、返回值、错误码与可运行示例。
| 方法 | 本平台签名 / 形态 | 文档位置 |
|---|---|---|
init | static func client(options: IMPClientOptions) -> IMPClient | 建立连接 |
connect | func connect(token: String) async -> RcResult<IMPConnectResult> | 建立连接 |
disconnect | func disconnect() async -> RcResult<Void> | 建立连接 |
getConnectionStatus | func getConnectionStatus() -> IMPConnectionStatus | 建立连接 |
getCurrentUserId | func getCurrentUserId() -> String | 连接监听 |
addEventListener | func addEventListener(_ event: IMPEvent, listener: IMPEventListener) -> Void | 连接监听 |
removeEventListener | func removeEventListener(_ event: IMPEvent, listener: IMPEventListener) -> Void | 连接监听 |
sendMessage | func sendMessage(conversationType: IMPConversationType, targetId: String, content: IMPMessageContent, options: IMPSendOptions?) async -> RcResult<IMPMessage> | 发送消息 |
sendTextMessage | func sendTextMessage(conversationType: IMPConversationType, targetId: String, text: String, options: IMPTextSendOptions?) async -> RcResult<IMPMessage> | 发送消息 |
sendImageMessage | func sendImageMessage(conversationType: IMPConversationType, targetId: String, content: IMPImageContent, options: IMPSendOptions?) async -> RcResult<IMPMessage> | 发送消息 |
sendFileMessage | func sendFileMessage(conversationType: IMPConversationType, targetId: String, content: IMPFileContent, options: IMPSendOptions?) async -> RcResult<IMPMessage> | 发送消息 |
sendVoiceMessage | func sendVoiceMessage(conversationType: IMPConversationType, targetId: String, content: IMPVoiceContent, options: IMPSendOptions?) async -> RcResult<IMPMessage> | 发送消息 |
sendLocationMessage | func sendLocationMessage(conversationType: IMPConversationType, targetId: String, content: IMPLocationContent, options: IMPSendOptions?) async -> RcResult<IMPMessage> | 发送消息 |
sendTypingStatus | func sendTypingStatus(conversationType: IMPConversationType, targetId: String, typing: Bool) async -> RcResult<Void> | 输入状态 |
recallMessage | func recallMessage(messageId: String) async -> RcResult<IMPMessage> | 消息管理 |
sendReadReceipt | func sendReadReceipt(conversationType: IMPConversationType, targetId: String, messageIds: [String]) async -> RcResult<IMPSendReadReceiptResult> | 已读回执 |
getMessageReadCount | func getMessageReadCount(messageId: String) async -> RcResult<IMPMessageReadCount> | 已读回执 |
getMessageReadUsers | func getMessageReadUsers(messageId: String, options: IMPPageOptions?) async -> RcResult<IMPMessageReadUsers> | 已读回执 |
getMessageReadDetail | func getMessageReadDetail(messageId: String, options: IMPPageOptions?) async -> RcResult<IMPMessageReadDetail> | API 参考索引 |
searchMessages | func searchMessages(options: IMPSearchMessagesOptions) async -> RcResult<IMPMessageSearchResult> | 消息管理 |
getConversationList | func getConversationList() async -> RcResult<[IMPConversation]> | 会话列表 |
getConversation | func getConversation(conversationType: IMPConversationType, targetId: String) async -> RcResult<IMPConversation> | 会话列表 |
getHistoryMessages | func getHistoryMessages(conversationType: IMPConversationType, targetId: String, options: IMPHistoryOptions?) async -> RcResult<IMPHistoryPage> | 历史消息 |
clearUnreadCount | func clearUnreadCount(conversationType: IMPConversationType, targetId: String) async -> RcResult<Void> | 未读数 |
setConversationToTop | func setConversationToTop(conversationType: IMPConversationType, targetId: String, isTop: Bool) async -> RcResult<Void> | 置顶与免打扰 |
saveTextMessageDraft | func saveTextMessageDraft(conversationType: IMPConversationType, targetId: String, draft: String) async -> RcResult<Void> | 草稿 |
getTextMessageDraft | func getTextMessageDraft(conversationType: IMPConversationType, targetId: String) async -> RcResult<String> | 草稿 |
clearTextMessageDraft | func clearTextMessageDraft(conversationType: IMPConversationType, targetId: String) async -> RcResult<Void> | 草稿 |
setConversationNotificationLevel | func setConversationNotificationLevel(conversationType: IMPConversationType, targetId: String, level: IMPNotificationLevel) async -> RcResult<Void> | 置顶与免打扰 |
getUserProfile | func getUserProfile(userId: String) async -> RcResult<IMPUserProfile> | 用户资料 |
updateMyUserProfile | func updateMyUserProfile(profile: IMPUserProfileUpdate) async -> RcResult<IMPUserProfile> | 用户资料 |
getOnlineStatus | func getOnlineStatus(userId: String) async -> RcResult<IMPUserOnlineStatus> | 在线状态 |
getOnlineStatusBatch | func getOnlineStatusBatch(userIds: [String]) async -> RcResult<IMPUserOnlineStatusBatch> | 在线状态 |
searchUsers | func searchUsers(keyword: String, options: IMPPageOptions?) async -> RcResult<IMPUserSearchResult> | 好友列表 |
sendFriendRequest | func sendFriendRequest(toUserId: String, message: String?) async -> RcResult<IMPFriendRequest> | 好友请求 |
getFriendRequests | func getFriendRequests(options: IMPFriendRequestQuery?) async -> RcResult<[IMPFriendRequest]> | 好友请求 |
acceptFriendRequest | func acceptFriendRequest(requestId: String) async -> RcResult<IMPFriendRequest> | 好友请求 |
rejectFriendRequest | func rejectFriendRequest(requestId: String) async -> RcResult<IMPFriendRequest> | 好友请求 |
getFriends | func getFriends() async -> RcResult<[IMPFriend]> | 好友列表 |
deleteFriend | func deleteFriend(friendId: String) async -> RcResult<Void> | 好友列表 |
setFriendRemark | func setFriendRemark(friendId: String, remark: String) async -> RcResult<Void> | 好友列表 |
getBlacklist | func getBlacklist() async -> RcResult<[IMPBlacklistEntry]> | 黑名单 |
addToBlacklist | func addToBlacklist(userId: String) async -> RcResult<Void> | 黑名单 |
removeFromBlacklist | func removeFromBlacklist(userId: String) async -> RcResult<Void> | 黑名单 |
createGroup | func createGroup(_ options: IMPCreateGroupOptions) async -> RcResult<IMPGroup> | 创建群组 |
getGroupsInfo | func getGroupsInfo(groupIds: [String]) async -> RcResult<[IMPGroup]> | 创建群组 |
getGroupMembers | func getGroupMembers(groupId: String) async -> RcResult<[IMPGroupMember]> | 群成员 |
addGroupMembers | func addGroupMembers(groupId: String, userIds: [String]) async -> RcResult<IMPAddGroupMembersResult> | 群成员 |
removeGroupMembers | func removeGroupMembers(groupId: String, userIds: [String]) async -> RcResult<IMPRemoveGroupMembersResult> | 群成员 |
quitGroup | func quitGroup(groupId: String) async -> RcResult<Void> | 群成员 |
updateGroupName | func updateGroupName(groupId: String, name: String) async -> RcResult<IMPGroup> | 群管理 |
updateGroupNotice | func updateGroupNotice(groupId: String, notice: String) async -> RcResult<IMPGroup> | 群管理 |
transferGroupOwner | func transferGroupOwner(groupId: String, newOwner: String) async -> RcResult<IMPGroup> | 群管理 |
addGroupAdmin | func addGroupAdmin(groupId: String, userId: String) async -> RcResult<IMPGroup> | 群管理 |
removeGroupAdmin | func removeGroupAdmin(groupId: String, userId: String) async -> RcResult<IMPGroup> | 群管理 |
muteGroupMember | func muteGroupMember(groupId: String, userId: String, mutedUntil: UInt64) async -> RcResult<IMPMuteGroupMemberResult> | 群管理 |
createChatroom | func createChatroom(options: IMPCreateChatroomOptions) async -> RcResult<IMPChatroom> | 加入与退出 |
joinChatroom | func joinChatroom(chatroomId: String) async -> RcResult<IMPChatroom> | 加入与退出 |
leaveChatroom | func leaveChatroom(chatroomId: String) async -> RcResult<Void> | 加入与退出 |
getChatroomInfo | func getChatroomInfo(chatroomId: String) async -> RcResult<IMPChatroom> | 聊天室信息 |
getChatroomMembers | func getChatroomMembers(chatroomId: String, options: IMPPageOptions?) async -> RcResult<IMPChatroomMembersPage> | 聊天室信息 |
getSystemMessages | func getSystemMessages(options: IMPHistoryOptions?) async -> RcResult<IMPHistoryPage> | 系统通知 |
uploadFile | func uploadFile(data: Data, name: String, mime: String?) async -> RcResult<IMPUploadResult> | 文件上传 |
updateMessageExpansion | func updateMessageExpansion(messageId: String, expansion: [String: String]) async -> RcResult<IMPExpansion> | 消息进阶 |
removeMessageExpansion | func removeMessageExpansion(messageId: String, keys: [String]) async -> RcResult<IMPExpansion> | 消息进阶 |
addMessageReaction | func addMessageReaction(_ param: IMPUpdateMessageReactionParam) async -> RcResult<IMPMessageReaction> | 消息进阶 |
removeMessageReaction | func removeMessageReaction(_ param: IMPUpdateMessageReactionParam) async -> RcResult<IMPReactionRemoval> | 消息进阶 |
batchGetMessageReactionSummaries | func batchGetMessageReactionSummaries(_ param: IMPMessageReactionSummaryQuery) async -> RcResult<[String: [IMPMessageReactionSummary]]> | 消息进阶 |
getMessageReactions | func getMessageReactions(_ param: IMPGetMessageReactionsParam) async -> RcResult<IMPMessageReactionPage> | 消息进阶 |
getMessageReactionUsers | func getMessageReactionUsers(_ param: IMPGetMessageReactionUsersParam) async -> RcResult<IMPMessageReactionUserPage> | 消息进阶 |
createConversationTag | func createConversationTag(_ param: IMPCreateConversationTagParam) async -> RcResult<IMPConversationTag> | 会话标签与分组 |
updateConversationTag | func updateConversationTag(_ param: IMPUpdateConversationTagParam) async -> RcResult<IMPConversationTag> | 会话标签与分组 |
deleteConversationTag | func deleteConversationTag(tagId: String) async -> RcResult<Void> | 会话标签与分组 |
getConversationTags | func getConversationTags() async -> RcResult<[IMPConversationTag]> | 会话标签与分组 |
addConversationsToTag | func addConversationsToTag(_ param: IMPTagConversationsParam) async -> RcResult<IMPConversationTagMembershipResult> | 会话标签与分组 |
removeConversationsFromTag | func removeConversationsFromTag(_ param: IMPTagConversationsParam) async -> RcResult<IMPConversationTagMembershipResult> | 会话标签与分组 |
getConversationsFromTagByPage | func getConversationsFromTagByPage(_ param: IMPTagConversationsPageParam) async -> RcResult<IMPConversationTagPage> | 会话标签与分组 |
getTagsFromConversation | func getTagsFromConversation(conversationType: Int, targetId: String) async -> RcResult<[IMPConversationTag]> | 会话标签与分组 |
getUnreadCountByTag | func getUnreadCountByTag(tagId: String) async -> RcResult<IMPConversationTagUnread> | 会话标签与分组 |
setConversationToTopInTag | func setConversationToTopInTag(_ param: IMPTagTopParam) async -> RcResult<Void> | 会话标签与分组 |
deleteConversation | func deleteConversation(conversationType: Int, targetId: String) async -> RcResult<Bool> | 会话删除与类型免打扰 |
getConversationTypeNotification | func getConversationTypeNotification(conversationType: Int) async -> RcResult<IMPConversationTypeNotification> | 会话删除与类型免打扰 |
setConversationTypeNotification | func setConversationTypeNotification(conversationType: Int, level: Int) async -> RcResult<IMPConversationTypeNotification> | 会话删除与类型免打扰 |
startStreamMessage | func startStreamMessage(_ param: IMPStartStreamMessageParam) async -> RcResult<IMPStreamMessage> | 消息进阶 |
appendStreamMessage | func appendStreamMessage(streamId: String, delta: String, seq: UInt32?) async -> RcResult<IMPStreamMessage> | 消息进阶 |
completeStreamMessage | func completeStreamMessage(streamId: String) async -> RcResult<IMPStreamCompleteResult> | 消息进阶 |
getStreamMessage | func getStreamMessage(streamId: String) async -> RcResult<IMPStreamMessage> | 消息进阶 |
getMessageExpansion | func getMessageExpansion(messageId: String) async -> RcResult<IMPMessageExpansion> | 消息进阶 |
combineMessages | func combineMessages(_ messages: [IMPMessage], options: IMPCombineMessagesOptions?) -> RcResult<IMPCombineContent> | 消息进阶 |
subscribePresence | func subscribePresence(userIds: [String]) async -> RcResult<IMPPresenceSubscription> | 在线状态订阅与推送令牌 |
unsubscribePresence | func unsubscribePresence(userIds: [String]) async -> RcResult<IMPPresenceSubscription> | 在线状态订阅与推送令牌 |
getPresenceSubscriptions | func getPresenceSubscriptions() async -> RcResult<IMPPresenceSubscription> | 在线状态订阅与推送令牌 |
registerPushToken | func registerPushToken(options: IMPRegisterPushTokenOptions) async -> RcResult<IMPPushToken> | 在线状态订阅与推送令牌 |
unregisterPushToken | func unregisterPushToken(tokenId: String) async -> RcResult<IMPUnregisterPushTokenResult> | 在线状态订阅与推送令牌 |
getPushTokens | func getPushTokens() async -> RcResult<IMPPushTokenListResult> | 在线状态订阅与推送令牌 |
createSupergroupChannel | func createSupergroupChannel(params: IMPCreateSupergroupChannelParams) async -> RcResult<IMPSupergroupChannel> | 超级群频道与用户组 |
listSupergroupChannels | func listSupergroupChannels(groupId: String) async -> RcResult<IMPSupergroupChannelListResult> | 超级群频道与用户组 |
joinSupergroupChannel | func joinSupergroupChannel(channelId: String, options: IMPSupergroupChannelOptions?) async -> RcResult<IMPJoinSupergroupChannelResult> | 超级群频道与用户组 |
leaveSupergroupChannel | func leaveSupergroupChannel(channelId: String, options: IMPSupergroupChannelOptions?) async -> RcResult<IMPLeaveSupergroupChannelResult> | 超级群频道与用户组 |
bindUserGroupToChannel | func bindUserGroupToChannel(channelId: String, userGroupId: String, options: IMPSupergroupChannelOptions?) async -> RcResult<IMPBindUserGroupToChannelResult> | 超级群频道与用户组 |
createUserGroup | func createUserGroup(params: IMPCreateUserGroupParams) async -> RcResult<IMPUserGroup> | 超级群频道与用户组 |
listUserGroups | func listUserGroups(groupId: String) async -> RcResult<IMPUserGroupListResult> | 超级群频道与用户组 |
getUserGroupsByUser | func getUserGroupsByUser(userId: String, options: IMPSupergroupChannelOptions?) async -> RcResult<IMPUserGroupListResult> | 超级群频道与用户组 |
事件索引
事件名在所有 GA 平台一致(Web 为小写下划线常量值,原生平台为枚举成员)。事件订阅方式见连接监听页;载荷字段来自 IDL 事件定义。
| 事件 | 载荷 | 本平台导出 | 文档位置 |
|---|---|---|---|
CONNECTING | {attempt:int} | 是 | API 参考 · 事件载荷 |
CONNECTED | {userId:string, sessionId?:string} | 是 | API 参考 · 事件载荷 |
DISCONNECT | {code:int, reason:string} | 是 | API 参考 · 事件载荷 |
SUSPEND | {code:int, reason:string} | 是 | API 参考 · 事件载荷 |
MESSAGES | {messages:Message[]} | 是 | API 参考 · 事件载荷 |
CONVERSATION | {conversation:Conversation} | 是 | API 参考 · 事件载荷 |
MESSAGE_RECALLED | {message:Message} | 是 | API 参考 · 事件载荷 |
READ_RECEIPT | ReadReceipt | 是 | API 参考 · 事件载荷 |
TYPING | {conversationType:ConversationType,targetId:string,userId:string,typing:bool,timestamp:int64} | 是 | API 参考 · 事件载荷 |
MESSAGE_REACTION_CHANGED | {messageId:string,conversationType:ConversationType,targetId:string,reactionId:string,operation:added|removed|cleared,userId:string,reactionTime:int64,totalCount:uint32,users:string[]?} | 是 | API 参考 · 事件载荷 |
MESSAGE_EXPANSION_CHANGED | {messageId:string,conversationType:ConversationType,targetId:string,updated:Record<string,string>?,removed:string[]?,timestamp:int64} | 是 | API 参考 · 事件载荷 |
STREAM_MESSAGE_CHANGED | {streamId:string,messageId:string,conversationType:ConversationType,targetId:string,senderId:string,delta:string,seq:uint32,text:string,status:streaming|ended,complete:bool,timestamp:int64} | 是 | API 参考 · 事件载荷 |
PRESENCE_CHANGED | {userId:string,online:bool,lastSeenAt:int64,timestamp:int64,reason:connect|disconnect|kick|deactivate} | 是 | API 参考 · 事件载荷 |
FRIEND_EVENT | {kind:FriendEventKind,request?:FriendRequest,fromUserId?:string,toUserId?:string,timestamp:int64} | 是 | API 参考 · 事件载荷 |
CHATROOM_EVENT | {chatroomId:string,kind:ChatroomEventKind,userId?:string,onlineCount?:uint32,chatroom?:Chatroom,timestamp:int64} | 是 | API 参考 · 事件载荷 |
KICKED | {code:int,reason:string} | 是 | API 参考 · 事件载荷 |
枚举与常量索引
枚举取值在 API 参考的「枚举」页逐项列出(名称、取值、语义),错误码另有状态码页。
| 常量 / 枚举 | 取值数 | 文档位置 |
|---|---|---|
CONTENT_TYPE_COMBINE | — | 状态码与错误处理 |
数据类型索引
公开数据类型分两类:有独立页面的核心结构(消息、会话、群组、内容联合体等),以及只作为参数/返回结构出现的选项与结果对象(字段在对应方法的参数表与返回值中说明)。
| 类型 | 文档位置 |
|---|---|
Chatroom | 数据结构 · Chatroom |
ChatroomMember | 数据结构 · ChatroomMember |
ConnectionStatus | 枚举 · ConnectionStatus |
Conversation | 数据结构 · Conversation |
ConversationType | 枚举 · ConversationType |
Friend | 数据结构 · Friend |
FriendRequest | 数据结构 · FriendRequest |
Group | 数据结构 · Group |
GroupMember | 数据结构 · GroupMember |
GroupType | 枚举 · GroupType |
Message | 数据结构 · Message |
NotificationLevel | 枚举 · NotificationLevel |
UserProfile | 数据结构 · UserProfile |
随方法说明的类型
ChannelType、CombineContent、Config、Content、ConversationRef、ConversationTag、ConversationTagConversation、Conversations、Count、Counts、CurrentUserReacted、GroupId、Groups、IMClient、Id、Ids、Inactive、Indexed、Info、JoinPolicy、Joined、MaxChars、Member、Members、MentionedInfo、MessageReadDetailItem、More、Ms、MsgId、Names、Policy、PushToken、Quote、ReactionSummary、Seq、StreamMessage、SupergroupChannel、Time、Token、Total、Type、Until、Url、UserGroup、Version