ufimsapi v1.0.5
Classes
Class: SMSAgent
消息服务器客户端代理接口封装对象
Table of contents
Methods
- listGroups
- listRecentChats
- listUsers
- login
- logout
- readChatHistory
- readInstantMessage
- searchInstantMessage
- txInstantMessage
Methods
listGroups
▸ listGroups(offset, limit, filter): Promise<GroupProfile[]>
群组列表
Parameters
| Name | Type | Description |
|---|---|---|
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
filter | string | 模糊查询过滤器(账号、名称、名称拼音首字母) |
Returns
Promise<GroupProfile[]>
群组列表
listRecentChats
▸ listRecentChats(offset, limit): Promise<{ chats: RecentChat[] ; totalNotRead: number }>
所有会话最后消息列表,按最后消息序号降序
Parameters
| Name | Type | Description |
|---|---|---|
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
Returns
Promise<{ chats: RecentChat[] ; totalNotRead: number }>
RecentChat[]数组,参考@see RecentChat
listUsers
▸ listUsers(offset, limit, filter): Promise<UserProfile[]>
用户列表
Parameters
| Name | Type | Description |
|---|---|---|
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
filter | string | 模糊查询过滤器(账号、名称、名称拼音首字母) |
Returns
Promise<UserProfile[]>
用户列表
login
▸ login(acc, password, keepTry): Promise<void>
登录服务器后台
Parameters
| Name | Type | Description |
|---|---|---|
acc | string | 登录账号 |
password | string | 登录密码 |
keepTry | boolean | - |
Returns
Promise<void>
会话数据结构
logout
▸ logout(): Promise<void>
登出系统
Returns
Promise<void>
无
readChatHistory
▸ readChatHistory(peer, baseId, before, limit): Promise<InstantMessage[]>
读取历史会话消息,按消息先后排序,底层自动清除所有接收消息未读标志,并向发送方发送已读确认回执
Parameters
| Name | Type | Description |
|---|---|---|
peer | Object | 群组或会话用户ID |
peer.groupId? | number | - |
peer.userId? | string | - |
baseId | number | 基准消息序号 |
before | boolean | 消息序号before=true时获取baseIndex之前的消息,表示获取baseIndex之后的消息 |
limit | number | 返回记录数限制 |
Returns
Promise<InstantMessage[]>
消息InstantMessage数组,@see InstantMessage
readInstantMessage
▸ readInstantMessage(id, userId, groupId?): Promise<void>
清除制定接收消息未读标志,并向发送方发送已读确认回执
Parameters
| Name | Type | Description |
|---|---|---|
id | number | 消息ID |
userId | string | - |
groupId? | number | - |
Returns
Promise<void>
searchInstantMessage
▸ searchInstantMessage(contentFilter, offset, limit, peer?): Promise<InstantMessage[]>
查询消息
Parameters
| Name | Type | Description |
|---|---|---|
contentFilter | string | 消息内容模糊查询过滤关键字 |
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
peer? | Object | 对方用户或组ID,为空表示所有用户或组 |
peer.groupId? | number | - |
peer.userId? | string | - |
Returns
Promise<InstantMessage[]>
消息InstantMessage数组,@see InstantMessage
txInstantMessage
▸ txInstantMessage(peer, content): Promise<{ id: number ; notRead: number ; ts: number }>
发送消息
Parameters
| Name | Type | Description |
|---|---|---|
peer | Object | 目标群组或用户 |
peer.groupId? | number | - |
peer.userId? | string | - |
content | string | 消息内容 |
Returns
Promise<{ id: number ; notRead: number ; ts: number }>
Enums
Enumeration: MsgCatalog
协议消息分类
Table of contents
Enumeration Members
Enumeration Members
Event
• Event = 2
事件消息
Request
• Request = 0
请求消息
Response
• Response = 1
响应消息
Enumeration: MsgTypes
协议消息类型ID
Table of contents
Enumeration Members
- CmdIMListRecent
- CmdIMRead
- CmdIMReadAck
- CmdIMSearch
- CmdIMTx
- CmdKeepAlive
- CmdListGroups
- CmdListUsers
- EvtIMRead
- EvtIMRx
- RespError
- RespOK
Enumeration Members
CmdIMListRecent
• CmdIMListRecent = 7
CmdIMRead
• CmdIMRead = 5
CmdIMReadAck
• CmdIMReadAck = 6
CmdIMSearch
• CmdIMSearch = 8
CmdIMTx
• CmdIMTx = 4
CmdKeepAlive
• CmdKeepAlive = 1
CmdListGroups
• CmdListGroups = 10
CmdListUsers
• CmdListUsers = 9
EvtIMRead
• EvtIMRead = 12
EvtIMRx
• EvtIMRx = 11
RespError
• RespError = 3
RespOK
• RespOK = 2
ufimsapi
Table of contents
Enumerations
Classes
Type Aliases
Type Aliases
InstantMessage
Ƭ InstantMessage: Object
会话消息数据结构
Type declaration
| Name | Type | Description |
|---|---|---|
attachment? | string | 消息附件 |
content | string | 消息内容 |
groupId? | number | 群组ID,群组消息有效 |
groupName? | string | 群组名称,群组消息有效 |
id | number | 服务器消息顺序号 |
notRead? | number | 发送消息未读用户计数(群消息),互发消息对方已读=0,未读=1 |
notSent? | boolean | 消息是否已发送到服务器,仅对发送消息有效 |
received | boolean | 消息方向,接收消息为true,发送消息为false |
ts? | number | Date | string | 服务器消息时间戳,离线缓存发送消息无效,用于内部消息数据同步 |
userId? | string | 对方用户ID,群发送消息为发送方ID |
userName? | string | 对方用户名称,群发送消息为发送方名称 |
Message
Ƭ Message: Object
协议消息结构
Type declaration
| Name | Type | Description |
|---|---|---|
Catalog | MsgCatalog | 消息分类 |
ErrorMsg? | string | 出错信息 |
InvokeID | number | 调用ID |
MsgType | MsgTypes | 消息具体类型 |
Param? | any | 调用参数 |
Ret? | any | 调用返回结果 |
RecentChat
Ƭ RecentChat: Object
最近会话列表项
Type declaration
| Name | Type | Description |
|---|---|---|
content | string | 最后收发消息内容 |
groupId? | number | 群聊组ID,名称,群组消息有效 |
groupName? | string | 群聊组名称,群组消息有效 |
msgId | number | 会话最后收发消息ID |
notReadCount | number | 会话中本方未读消息计数 |
peerUserId | string | 会话对方用户ID,群组消息时为发送用户ID |
peerUserName | string | 会话对方用户名称,群组消息时为发送用户名称 |
received | boolean | 消息方向,接收消息为true,发送消息为false |
ts | number | Date | string | 消息时间戳 |
ResultOfUserList
Ƭ ResultOfUserList: Object
用户检索列表返回结果数据结构
Type declaration
| Name | Type | Description |
|---|---|---|
items | UserAccount[] | 用户项目列表(offset,rows范围) |
total | number | 满足检索条件用户项目总数 |
UserAccount
Ƭ UserAccount: Object
用户账号
Type declaration
| Name | Type | Description |
|---|---|---|
administrator | boolean | 是否管理员用户 |
bizCode? | string | 登录密码 |
createTime? | string | Date | 创建时间 |
enabled | boolean | 是否启用 |
id? | string | 登录ID |
indexTags? | string | 自定义用户索引,允许多个以逗号分开 |
name | string | 名称 |
namePy? | string | 名称拼音首字母 |
Classes
Class: SMSAgent
消息服务器客户端代理接口封装对象
Table of contents
Methods
- listGroups
- listRecentChats
- listUsers
- login
- logout
- readChatHistory
- readInstantMessage
- searchInstantMessage
- txInstantMessage
- txInstantMessageBulk
Methods
listGroups
▸ listGroups(offset, limit, filter): Promise<GroupProfile[]>
群组列表
Parameters
| Name | Type | Description |
|---|---|---|
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
filter | string | 模糊查询过滤器(账号、名称、名称拼音首字母) |
Returns
Promise<GroupProfile[]>
群组列表
listRecentChats
▸ listRecentChats(offset, limit): Promise<{ chats: RecentChat[] ; totalNotRead: number }>
所有会话最后消息列表,按最后消息序号降序
Parameters
| Name | Type | Description |
|---|---|---|
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
Returns
Promise<{ chats: RecentChat[] ; totalNotRead: number }>
RecentChat[]数组,参考@see RecentChat
listUsers
▸ listUsers(offset, limit, filter): Promise<UserProfile[]>
用户列表
Parameters
| Name | Type | Description |
|---|---|---|
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
filter | string | 模糊查询过滤器(账号、名称、名称拼音首字母) |
Returns
Promise<UserProfile[]>
用户列表
login
▸ login(acc, password, keepTry): Promise<void>
登录服务器后台
Parameters
| Name | Type | Description |
|---|---|---|
acc | string | 登录账号 |
password | string | 登录密码 |
keepTry | boolean | - |
Returns
Promise<void>
会话数据结构
logout
▸ logout(): Promise<void>
登出系统
Returns
Promise<void>
无
readChatHistory
▸ readChatHistory(peer, baseId, before, limit): Promise<InstantMessage[]>
读取历史会话消息,按消息先后排序,底层自动清除所有接收消息未读标志,并向发送方发送已读确认回执
Parameters
| Name | Type | Description |
|---|---|---|
peer | Object | 群组或会话用户ID |
peer.groupId? | number | - |
peer.userId? | string | - |
baseId | number | 基准消息序号 |
before | boolean | 消息序号before=true时获取baseIndex之前的消息,表示获取baseIndex之后的消息 |
limit | number | 返回记录数限制 |
Returns
Promise<InstantMessage[]>
消息InstantMessage数组,@see InstantMessage
readInstantMessage
▸ readInstantMessage(id, userId, groupId?): Promise<number>
清除制定接收消息未读标志,并向发送方发送已读确认回执
Parameters
| Name | Type | Description |
|---|---|---|
id | number | 消息ID |
userId | string | - |
groupId? | number | - |
Returns
Promise<number>
searchInstantMessage
▸ searchInstantMessage(contentFilter, offset, limit, peer?): Promise<InstantMessage[]>
查询消息
Parameters
| Name | Type | Description |
|---|---|---|
contentFilter | string | 消息内容模糊查询过滤关键字 |
offset | number | 记录起始偏移量 |
limit | number | 返回记录数限制 |
peer? | Object | 对方用户或组ID,为空表示所有用户或组 |
peer.groupId? | number | - |
peer.userId? | string | - |
Returns
Promise<InstantMessage[]>
消息InstantMessage数组,@see InstantMessage
txInstantMessage
▸ txInstantMessage(peer, content): Promise<{ id: number ; msgInBoxUpdates: MsgInBox[] ; ts: number }>
发送消息
Parameters
| Name | Type | Description |
|---|---|---|
peer | Object | 目标群组或用户 |
peer.groupId? | number | - |
peer.userId? | string | - |
content | string | 消息内容 |
Returns
Promise<{ id: number ; msgInBoxUpdates: MsgInBox[] ; ts: number }>
txInstantMessageBulk
▸ txInstantMessageBulk(content, attchment, userIds?): Promise<{ id: number ; msgInBoxUpdates: { toUserId: string ; updateVersion: number }[] ; ts: number }>
批量群发消息
Parameters
| Name | Type | Description |
|---|---|---|
content | string | 消息内容 |
attchment | string | 消息附件 |
userIds? | string[] | 目标用户ID列表,缺省为全局广播消息 |
Returns
Promise<{ id: number ; msgInBoxUpdates: { toUserId: string ; updateVersion: number }[] ; ts: number }>
Enums
Enumeration: MsgCatalog
协议消息分类
Table of contents
Enumeration Members
Enumeration Members
Event
• Event = 2
事件消息
Request
• Request = 0
请求消息
Response
• Response = 1
响应消息
Enumeration: MsgTypes
协议消息类型ID
Table of contents
Enumeration Members
- CmdIMListRecent
- CmdIMRead
- CmdIMReadAck
- CmdIMReadAckBulk
- CmdIMSearch
- CmdIMSyncMsgInBox
- CmdIMSyncMsgOutBox
- CmdIMTx
- CmdIMTxBulk
- CmdKeepAlive
- CmdListGroups
- CmdListUsers
- EvtIMRead
- EvtIMRx
- RespError
- RespOK
Enumeration Members
CmdIMListRecent
• CmdIMListRecent = 7
CmdIMRead
• CmdIMRead = 5
CmdIMReadAck
• CmdIMReadAck = 6
CmdIMReadAckBulk
• CmdIMReadAckBulk = 16
CmdIMSearch
• CmdIMSearch = 8
CmdIMSyncMsgInBox
• CmdIMSyncMsgInBox = 15
CmdIMSyncMsgOutBox
• CmdIMSyncMsgOutBox = 14
CmdIMTx
• CmdIMTx = 4
CmdIMTxBulk
• CmdIMTxBulk = 13
CmdKeepAlive
• CmdKeepAlive = 1
CmdListGroups
• CmdListGroups = 10
CmdListUsers
• CmdListUsers = 9
EvtIMRead
• EvtIMRead = 12
EvtIMRx
• EvtIMRx = 11
RespError
• RespError = 3
RespOK
• RespOK = 2
ufimsapi
Table of contents
Enumerations
Classes
Type Aliases
Type Aliases
InstantMessage
Ƭ InstantMessage: Object
会话消息数据结构
Type declaration
| Name | Type | Description |
|---|---|---|
attachment? | string | 消息附件 |
content | string | 消息内容 |
groupId? | number | 群组ID,群组消息有效 |
groupName? | string | 群组名称,群组消息有效 |
id | number | 服务器消息顺序号 |
notRead? | number | 发送消息未读用户计数(群消息),互发消息对方已读=0,未读=1 |
notSent? | boolean | 消息是否已发送到服务器,仅对发送消息有效 |
received | boolean | 消息方向,接收消息为true,发送消息为false |
ts? | number | Date | string | 服务器消息时间戳,离线缓存发送消息无效,用于内部消息数据同步 |
userId? | string | 对方用户ID,群发送消息为发送方ID |
userName? | string | 对方用户名称,群发送消息为发送方名称 |
Message
Ƭ Message: Object
协议消息结构
Type declaration
| Name | Type | Description |
|---|---|---|
Catalog | MsgCatalog | 消息分类 |
ErrorMsg? | string | 出错信息 |
InvokeID | number | 调用ID |
MsgType | MsgTypes | 消息具体类型 |
Param? | any | 调用参数 |
Ret? | any | 调用返回结果 |
ParamCmdIMTxBulk
Ƭ ParamCmdIMTxBulk: Object
群发消息命令参数
Type declaration
| Name | Type | Description |
|---|---|---|
attchment? | string | 消息附件 |
content | string | 消息内容 |
userIds? | string[] | 对方用户ID列表,缺省为全局广播消息 |
RecentChat
Ƭ RecentChat: Object
最近会话列表项
Type declaration
| Name | Type | Description |
|---|---|---|
content | string | 最后收发消息内容 |
groupId? | number | 群聊组ID,名称,群组消息有效 |
groupName? | string | 群聊组名称,群组消息有效 |
msgId | number | 会话最后收发消息ID |
notReadCount | number | 会话中本方未读消息计数 |
peerUserId? | string | 会话对方用户ID,群组消息时为发送用户ID |
peerUserName? | string | 会话对方用户名称,群组消息时为发送用户名称 |
received | boolean | 消息方向,接收消息为true,发送消息为false |
ts | number | Date | string | 消息时间戳 |
ResultOfUserList
Ƭ ResultOfUserList: Object
用户检索列表返回结果数据结构
Type declaration
| Name | Type | Description |
|---|---|---|
items | UserAccount[] | 用户项目列表(offset,rows范围) |
total | number | 满足检索条件用户项目总数 |
UserAccount
Ƭ UserAccount: Object
用户账号
Type declaration
| Name | Type | Description |
|---|---|---|
administrator | boolean | 是否管理员用户 |
bizCode? | string | 登录密码 |
createTime? | string | Date | 创建时间 |
enabled | boolean | 是否启用 |
id? | string | 登录ID |
indexTags? | string | 自定义用户索引,允许多个以逗号分开 |
name | string | 名称 |
namePy? | string | 名称拼音首字母 |