包含与聊天、会话及消息相关的 API 请求。
- Source:
Methods
(inner) getMessagesForConversation(conversationId, params) → {Promise.<object>}
拿到用户会话的消息列表。
Parameters:
Name | Type | Description |
---|---|---|
conversationId |
string | 会话 ID。 |
params |
GetMessagesForConversationQueryParams | 查询参数,包含页码和每页消息数量。 |
- Source:
Returns:
包含会话消息列表的 Promise 对象。
- Type
- Promise.<object>
(inner) getOrCreateConversation(data) → {Promise.<object>}
获取或创建会话。
Parameters:
Name | Type | Description |
---|---|---|
data |
GetOrCreateConversationRequest | 请求体数据,包含对话目标用户的 ID。 |
- Source:
Returns:
包含会话信息的 Promise 对象。
- Type
- Promise.<object>
(inner) getUserConversations() → {Promise.<object>}
拿到用户所有会话列表。
- Source:
Returns:
包含用户会话列表的 Promise 对象。
- Type
- Promise.<object>
(inner) markAsRead(conversationId) → {Promise.<object>}
将消息标记为已读。
Parameters:
Name | Type | Description |
---|---|---|
conversationId |
string | 需要标记为已读的会话 ID。 |
- Source:
Returns:
包含操作结果的 Promise 对象。
- Type
- Promise.<object>
(inner) searchMessage(data) → {Promise.<object>}
搜索会话消息。
Parameters:
Name | Type | Description |
---|---|---|
data |
SearchMessageRequest | 搜索参数,包含会话ID、搜索关键词、页码和每页数量。 |
- Source:
Returns:
包含搜索结果列表的 Promise 对象。
- Type
- Promise.<object>
(inner) sendMessage(conversationData) → {Promise.<object>}
发送私信消息。
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
conversationData |
object | 消息数据。
Properties
|
- Source:
Returns:
包含发送消息结果的 Promise 对象。
- Type
- Promise.<object>
(inner) sendMessageInChannel(data) → {Promise.<object>}
发送频道消息。
Parameters:
Name | Type | Description |
---|---|---|
data |
SendMessageInChannelRequest | 频道消息数据,包含频道ID、内容、消息类型、提及用户ID和回复消息ID。 |
- Source:
Returns:
包含发送消息结果的 Promise 对象。
- Type
- Promise.<object>
(inner) toggleMuteConversation(data) → {Promise.<object>}
静音/解除静音会话。
Parameters:
Name | Type | Description |
---|---|---|
data |
ToggleMuteConversationRequest | 静音操作数据,包含会话ID和静音状态。 |
- Source:
Returns:
包含操作结果的 Promise 对象。
- Type
- Promise.<object>
(inner) uploadImageAPI(data) → {Promise.<object>}
上传消息图片。
Parameters:
Name | Type | Description |
---|---|---|
data |
UploadImageAPIRequest | 图片上传数据,包含会话ID和图片文件。 |
- Source:
Returns:
包含图片上传结果的 Promise 对象。
- Type
- Promise.<object>
Type Definitions
GetMessagesForConversationQueryParams
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
page |
number |
<optional> |
1 | 页码(从 1 开始)。 |
limit |
number |
<optional> |
20 | 每页消息数量。 |
- Source:
GetOrCreateConversationRequest
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
targetUserId |
string | 对话目标用户的 ID。 |
- Source:
SearchMessageRequest
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
conversationId |
string | 会话 ID。 | ||
searchTerm |
string | 搜索关键词。 | ||
page |
number |
<optional> |
1 | 当前页码(默认为 1)。 |
limit |
number |
<optional> |
20 | 每页数量(默认为 20)。 |
- Source:
SendMessageInChannelRequest
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
channelId |
string | 频道 ID。 | ||
content |
string | 消息内容。 | ||
messageType |
string |
<optional> |
'text' | 消息类型,如 text、image 等,默认为 text。 |
mentionIds |
Array.<string> |
<optional> |
被提及的用户ID数组(可选,Swagger中未明确但为常见字段)。 | |
repliedTo |
Array.<string> |
<optional> |
被回复的消息ID数组(可选,根据代码实现推断)。 |
- Source:
SendMessageRequest
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
content |
string | 消息内容。 | |
messageType |
'text' | 'image' | 'file' | 'system' | 消息类型。 | |
repliedTo |
Array.<string> |
<optional> |
被回复的消息ID数组(可选,根据代码实现推断)。 |
- Source:
ToggleMuteConversationRequest
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
conversationId |
string | 会话 ID。 |
mute |
boolean | 是否设为免打扰(true 为设为免打扰,false 为取消)。 |
- Source:
UploadImageAPIRequest
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
conversationId |
string | 会话 ID(私聊或频道)。 |
file |
File | 要上传的图片文件。 |
- Source: