用户资料
获取与更新用户资料;资料由应用自有用户体系维护,IM 服务不强制托管。
C ABI 约定:im_client_* 返回 int(0 成功,非 0 为 IDL 错误码);char** out_json 由库分配、调用方用 im_string_free 释放;char* out + size_t cap 为调用方缓冲区(0 成功 / -1 参数非法 / -2 缓冲区不足)。
接口一览
| 操作 | 语义 | 传输 | 返回 |
|---|---|---|---|
getUserProfile | 查询用户资料。 | REST(客户端) | UserProfile |
updateMyUserProfile | 修改本人资料(name/avatarUrl)。 | REST(客户端) | UserProfile |
本页 2 个操作,其中 0 个在本平台绑定中声明了方法签名,其余为 C ABI 未暴露(见对应小节)。
跨端方法名
| 操作 | Android | Web | Electron | macOS | Flutter | Native (C ABI) | iOS |
|---|---|---|---|---|---|---|---|
getUserProfile | getUserProfile | getUserProfile | getUserProfile | getUserProfile | getUserProfile | — | func |
updateMyUserProfile | updateMyUserProfile | updateMyUserProfile | updateMyUserProfile | updateMyUserProfile | updateMyUserProfile | — | func |
方法名在 GA 平台之间保持一致(规则 A);Native C ABI 只覆盖部分操作,其余操作以 — 标注。
本页操作均未在正式 C ABI(include/im_sdk.h)中暴露。C ABI 当前覆盖 18 个操作:init / connect / disconnect / getConnectionStatus / getCurrentUserId / sendTextMessage / sendMessage / recallMessage / sendReadReceipt / getConversationList / getHistoryMessages / getGroupMembers / joinChatroom / leaveChatroom / getChatroomInfo / uploadFile / addEventListener / removeEventListener。其余能力请使用其它平台绑定,或通过服务端 Open API 完成。
| 替代路径 | 说明 |
|---|---|
| 服务端 Open API | 用户模块接口:在服务端批量管理消息、会话、群组与用户 |
| Web / Electron / Flutter / Android 绑定 | 这些绑定覆盖全部 62 个语义 op;可通过服务端中转或由另一进程执行后回调 Native 侧 |
getUserProfile
查询用户资料。
本操作未在 native C ABI(include/im_sdk.h)暴露;如需该能力,请使用 Web / Electron / Flutter / Android 绑定,或通过服务端 Open API 完成。
| 参数 | 类型 | 说明 |
|---|---|---|
userId | string | 必填;用户 ID |
UserProfile 用户资料
| 错误码 | 名称 | 分类 | HTTP | 可重试 | 说明 |
|---|---|---|---|---|---|
1001 | INVALID_PARAMETER | 客户端 / 参数 / 权限 | 400 | 否 | 参数错误 |
1003 | FORBIDDEN | 客户端 / 参数 / 权限 | 403 | 否 | 无权限 |
1004 | USER_NOT_FOUND | 客户端 / 参数 / 权限 | 404 | 否 | 用户不存在 |
updateMyUserProfile
修改本人资料(name/avatarUrl)。
本操作未在 native C ABI(include/im_sdk.h)暴露;如需该能力,请使用 Web / Electron / Flutter / Android 绑定,或通过服务端 Open API 完成。
| 参数 | 类型 | 说明 |
|---|---|---|
profile | {name?:string, avatarUrl?:string} | 必填;待更新的资料字段:{ name?:string, avatarUrl?:string } |
UserProfile 用户资料
| 错误码 | 名称 | 分类 | HTTP | 可重试 | 说明 |
|---|---|---|---|---|---|
1001 | INVALID_PARAMETER | 客户端 / 参数 / 权限 | 400 | 否 | 参数错误 |
1003 | FORBIDDEN | 客户端 / 参数 / 权限 | 403 | 否 | 无权限 |
相关文档
- 功能列表:103 个操作与签名
- 状态码:错误码与重试策略
- API 参考:类与成员
- IMLib 集成指南