Switch frontend group and conversation requests to RESTful endpoints.
Update service API paths and message reply payload handling to match the backend route changes. Made-with: Cursor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* 群组服务
|
||||
* 处理群组管理、成员管理、群设置、群公告等功能
|
||||
* 使用新的 API 接口: /api/v1/groups (RESTful action 风格)
|
||||
* 使用 RESTful API: /api/v1/groups
|
||||
*/
|
||||
|
||||
import { api } from './api';
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
// SQLite/内存缓存编排由 groupManager 统一处理
|
||||
class GroupService {
|
||||
async fetchGroupsFromApi(page = 1, pageSize = 20): Promise<GroupListResponse> {
|
||||
const response = await api.get<GroupListResponse>('/groups/list', {
|
||||
const response = await api.get<GroupListResponse>('/groups', {
|
||||
page,
|
||||
page_size: pageSize,
|
||||
});
|
||||
@@ -37,9 +37,7 @@ class GroupService {
|
||||
}
|
||||
|
||||
async fetchGroupFromApi(id: number | string): Promise<GroupResponse> {
|
||||
const response = await api.get<GroupResponse>('/groups/get', {
|
||||
group_id: String(id),
|
||||
});
|
||||
const response = await api.get<GroupResponse>(`/groups/${encodeURIComponent(String(id))}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -49,9 +47,8 @@ class GroupService {
|
||||
pageSize = 50
|
||||
): Promise<GroupMemberListResponse> {
|
||||
const response = await api.get<GroupMemberListResponse>(
|
||||
'/groups/get_members',
|
||||
`/groups/${encodeURIComponent(String(groupId))}/members`,
|
||||
{
|
||||
group_id: String(groupId),
|
||||
page,
|
||||
page_size: pageSize,
|
||||
}
|
||||
@@ -63,16 +60,16 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 创建群组
|
||||
* POST /api/v1/groups/create
|
||||
* POST /api/v1/groups
|
||||
*/
|
||||
async createGroup(data: CreateGroupRequest): Promise<GroupResponse> {
|
||||
const response = await api.post<GroupResponse>('/groups/create', data);
|
||||
const response = await api.post<GroupResponse>('/groups', data);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群组列表
|
||||
* GET /api/v1/groups/list
|
||||
* GET /api/v1/groups
|
||||
*/
|
||||
async getGroups(page = 1, pageSize = 20): Promise<GroupListResponse> {
|
||||
return this.fetchGroupsFromApi(page, pageSize);
|
||||
@@ -80,7 +77,7 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 获取群组详情
|
||||
* GET /api/v1/groups/get?group_id=xxx
|
||||
* GET /api/v1/groups/:id
|
||||
*/
|
||||
async getGroup(id: number | string): Promise<GroupResponse> {
|
||||
return this.fetchGroupFromApi(id);
|
||||
@@ -88,93 +85,82 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 获取当前用户在群组中的成员信息
|
||||
* GET /api/v1/groups/get_my_info?group_id=xxx
|
||||
* GET /api/v1/groups/:id/me
|
||||
*/
|
||||
async getMyMemberInfo(groupId: number | string): Promise<MyMemberInfoResponse> {
|
||||
const response = await api.get<MyMemberInfoResponse>('/groups/get_my_info', {
|
||||
group_id: String(groupId),
|
||||
});
|
||||
const response = await api.get<MyMemberInfoResponse>(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/me`
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解散群组
|
||||
* POST /api/v1/groups/dissolve
|
||||
* Body: { "group_id": "xxx" }
|
||||
* DELETE /api/v1/groups/:id
|
||||
*/
|
||||
async dissolveGroup(id: number | string): Promise<void> {
|
||||
await api.post('/groups/dissolve', {
|
||||
group_id: String(id),
|
||||
});
|
||||
await api.delete(`/groups/${encodeURIComponent(String(id))}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转让群主
|
||||
* POST /api/v1/groups/transfer
|
||||
* Body: { "group_id": "xxx", "new_owner_id": "xxx" }
|
||||
* POST /api/v1/groups/:id/transfer
|
||||
*/
|
||||
async transferOwner(id: number | string, data: TransferOwnerRequest): Promise<void> {
|
||||
await api.post('/groups/transfer', {
|
||||
group_id: String(id),
|
||||
...data,
|
||||
});
|
||||
await api.post(`/groups/${encodeURIComponent(String(id))}/transfer`, data);
|
||||
}
|
||||
|
||||
// ==================== 成员管理 ====================
|
||||
|
||||
/**
|
||||
* 邀请成员加入群组
|
||||
* POST /api/v1/groups/invite_members
|
||||
* Body: { "group_id": "xxx", "user_ids": [...] }
|
||||
* POST /api/v1/groups/:id/invitations
|
||||
*/
|
||||
async inviteMembers(groupId: number | string, data: InviteMembersRequest): Promise<void> {
|
||||
await api.post('/groups/invite_members', {
|
||||
group_id: String(groupId),
|
||||
...data,
|
||||
});
|
||||
await api.post(`/groups/${encodeURIComponent(String(groupId))}/invitations`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请加入群组
|
||||
* POST /api/v1/groups/join
|
||||
* Body: { "group_id": "xxx" }
|
||||
* POST /api/v1/groups/:id/join-requests
|
||||
*/
|
||||
async joinGroup(groupId: number | string): Promise<void> {
|
||||
await api.post('/groups/join', {
|
||||
group_id: String(groupId),
|
||||
});
|
||||
await api.post(`/groups/${encodeURIComponent(String(groupId))}/join-requests`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应群邀请
|
||||
* POST /api/v1/groups/respond_invite
|
||||
* 响应群邀请/申请
|
||||
* POST /api/v1/groups/:id/join-requests/respond
|
||||
*/
|
||||
async respondInvite(data: HandleGroupRequestAction): Promise<void> {
|
||||
await api.post('/groups/respond_invite', data);
|
||||
async respondInvite(groupId: number | string, data: HandleGroupRequestAction): Promise<void> {
|
||||
await api.post(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/join-requests/respond`,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批主动加群申请
|
||||
* POST /api/v1/groups/set_group_add_request
|
||||
* POST /api/v1/groups/:id/join-requests/handle
|
||||
*/
|
||||
async reviewJoinRequest(data: HandleGroupRequestAction): Promise<void> {
|
||||
await api.post('/groups/set_group_add_request', data);
|
||||
async reviewJoinRequest(groupId: number | string, data: HandleGroupRequestAction): Promise<void> {
|
||||
await api.post(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/join-requests/handle`,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出群组
|
||||
* POST /api/v1/groups/set_group_leave
|
||||
* Body: { "group_id": "xxx" }
|
||||
* POST /api/v1/groups/:id/leave
|
||||
*/
|
||||
async leaveGroup(groupId: number | string): Promise<void> {
|
||||
await api.post('/groups/set_group_leave', {
|
||||
group_id: String(groupId),
|
||||
});
|
||||
await api.post(`/groups/${encodeURIComponent(String(groupId))}/leave`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群组成员列表
|
||||
* GET /api/v1/groups/get_members?group_id=xxx
|
||||
* GET /api/v1/groups/:id/members
|
||||
*/
|
||||
async getMembers(groupId: number | string, page = 1, pageSize = 50): Promise<GroupMemberListResponse> {
|
||||
return this.fetchMembersFromApi(groupId, page, pageSize);
|
||||
@@ -182,12 +168,10 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 移除群成员(踢人)
|
||||
* POST /api/v1/groups/set_group_kick
|
||||
* Body: { "group_id": "xxx", "user_id": "xxx", "reject_add_request": false }
|
||||
* POST /api/v1/groups/:id/members/kick
|
||||
*/
|
||||
async removeMember(groupId: number | string, userId: string): Promise<void> {
|
||||
await api.post('/groups/set_group_kick', {
|
||||
group_id: String(groupId),
|
||||
await api.post(`/groups/${encodeURIComponent(String(groupId))}/members/kick`, {
|
||||
user_id: userId,
|
||||
reject_add_request: false,
|
||||
});
|
||||
@@ -195,37 +179,32 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 设置成员角色(设置/取消管理员)
|
||||
* POST /api/v1/groups/set_group_admin
|
||||
* Body: { "group_id": "xxx", "user_id": "xxx", "enable": true }
|
||||
* PUT /api/v1/groups/:id/members/:user_id/admin
|
||||
*/
|
||||
async setMemberRole(
|
||||
groupId: number | string,
|
||||
userId: string,
|
||||
data: SetRoleRequest
|
||||
): Promise<void> {
|
||||
await api.post('/groups/set_group_admin', {
|
||||
group_id: String(groupId),
|
||||
user_id: userId,
|
||||
enable: data.role === 'admin',
|
||||
});
|
||||
await api.put(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/members/${encodeURIComponent(userId)}/admin`,
|
||||
{
|
||||
enable: data.role === 'admin',
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置群昵称
|
||||
* POST /api/v1/groups/set_nickname
|
||||
* Body: { "group_id": "xxx", "nickname": "xxx" }
|
||||
* PUT /api/v1/groups/:id/members/me/nickname
|
||||
*/
|
||||
async setNickname(groupId: number | string, data: SetNicknameRequest): Promise<void> {
|
||||
await api.post('/groups/set_nickname', {
|
||||
group_id: String(groupId),
|
||||
...data,
|
||||
});
|
||||
await api.put(`/groups/${encodeURIComponent(String(groupId))}/members/me/nickname`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁言/解禁成员
|
||||
* POST /api/v1/groups/set_group_ban
|
||||
* Body: { "group_id": "xxx", "user_id": "xxx", "duration": 3600 }
|
||||
* POST /api/v1/groups/:id/members/ban
|
||||
* @param groupId 群组ID
|
||||
* @param userId 用户ID
|
||||
* @param duration 禁言时长(秒),0表示解除禁言
|
||||
@@ -235,8 +214,7 @@ class GroupService {
|
||||
userId: string,
|
||||
duration: number = 0
|
||||
): Promise<void> {
|
||||
await api.post('/groups/set_group_ban', {
|
||||
group_id: String(groupId),
|
||||
await api.post(`/groups/${encodeURIComponent(String(groupId))}/members/ban`, {
|
||||
user_id: userId,
|
||||
duration: duration,
|
||||
});
|
||||
@@ -246,50 +224,43 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 设置全员禁言
|
||||
* POST /api/v1/groups/set_group_whole_ban
|
||||
* Body: { "group_id": "xxx", "enable": true }
|
||||
* PUT /api/v1/groups/:id/ban
|
||||
*/
|
||||
async setMuteAll(groupId: number | string, data: SetMuteAllRequest): Promise<void> {
|
||||
await api.post('/groups/set_group_whole_ban', {
|
||||
group_id: String(groupId),
|
||||
await api.put(`/groups/${encodeURIComponent(String(groupId))}/ban`, {
|
||||
enable: data.mute_all,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置加群方式
|
||||
* POST /api/v1/groups/set_join_type
|
||||
* Body: { "group_id": "xxx", "join_type": 1 }
|
||||
* PUT /api/v1/groups/:id/join-type
|
||||
*/
|
||||
async setJoinType(groupId: number | string, data: SetJoinTypeRequest): Promise<void> {
|
||||
await api.post('/groups/set_join_type', {
|
||||
group_id: String(groupId),
|
||||
...data,
|
||||
});
|
||||
await api.put(`/groups/${encodeURIComponent(String(groupId))}/join-type`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置群名称
|
||||
* POST /api/v1/groups/set_group_name
|
||||
* Body: { "group_id": "xxx", "group_name": "xxx" }
|
||||
* PUT /api/v1/groups/:id/name
|
||||
*/
|
||||
async setGroupName(groupId: number | string, groupName: string): Promise<void> {
|
||||
await api.post('/groups/set_group_name', {
|
||||
group_id: String(groupId),
|
||||
await api.put(`/groups/${encodeURIComponent(String(groupId))}/name`, {
|
||||
group_name: groupName,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置群头像
|
||||
* POST /api/v1/groups/set_group_avatar
|
||||
* Body: { "group_id": "xxx", "avatar": "xxx" }
|
||||
* PUT /api/v1/groups/:id/avatar
|
||||
*/
|
||||
async setGroupAvatar(groupId: number | string, avatarUrl: string): Promise<GroupResponse> {
|
||||
const response = await api.post<GroupResponse>('/groups/set_group_avatar', {
|
||||
group_id: String(groupId),
|
||||
avatar: avatarUrl,
|
||||
});
|
||||
const response = await api.put<GroupResponse>(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/avatar`,
|
||||
{
|
||||
avatar: avatarUrl,
|
||||
}
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -297,26 +268,22 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 创建群公告
|
||||
* POST /api/v1/groups/create_announcement
|
||||
* Body: { "group_id": "xxx", "content": "xxx" }
|
||||
* POST /api/v1/groups/:id/announcements
|
||||
*/
|
||||
async createAnnouncement(
|
||||
groupId: number | string,
|
||||
data: CreateAnnouncementRequest
|
||||
): Promise<GroupAnnouncementResponse> {
|
||||
const response = await api.post<GroupAnnouncementResponse>(
|
||||
'/groups/create_announcement',
|
||||
{
|
||||
group_id: String(groupId),
|
||||
...data,
|
||||
}
|
||||
`/groups/${encodeURIComponent(String(groupId))}/announcements`,
|
||||
data
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群公告列表
|
||||
* GET /api/v1/groups/get_announcements?group_id=xxx
|
||||
* GET /api/v1/groups/:id/announcements
|
||||
*/
|
||||
async getAnnouncements(
|
||||
groupId: number | string,
|
||||
@@ -325,9 +292,8 @@ class GroupService {
|
||||
): Promise<GroupAnnouncementListResponse> {
|
||||
try {
|
||||
const response = await api.get<GroupAnnouncementListResponse>(
|
||||
'/groups/get_announcements',
|
||||
`/groups/${encodeURIComponent(String(groupId))}/announcements`,
|
||||
{
|
||||
group_id: String(groupId),
|
||||
page,
|
||||
page_size: pageSize,
|
||||
}
|
||||
@@ -347,14 +313,12 @@ class GroupService {
|
||||
|
||||
/**
|
||||
* 删除群公告
|
||||
* POST /api/v1/groups/delete_announcement
|
||||
* Body: { "group_id": "xxx", "announcement_id": "xxx" }
|
||||
* DELETE /api/v1/groups/:id/announcements/:announcement_id
|
||||
*/
|
||||
async deleteAnnouncement(groupId: number | string, announcementId: number): Promise<void> {
|
||||
await api.post('/groups/delete_announcement', {
|
||||
group_id: String(groupId),
|
||||
announcement_id: announcementId,
|
||||
});
|
||||
await api.delete(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/announcements/${encodeURIComponent(String(announcementId))}`
|
||||
);
|
||||
}
|
||||
|
||||
// ==================== 兼容旧API的方法(将逐步废弃) ====================
|
||||
|
||||
@@ -34,7 +34,7 @@ class MessageService {
|
||||
page = 1,
|
||||
pageSize = 20
|
||||
): Promise<ConversationListResponse> {
|
||||
const response = await api.get<ConversationListResponse>('/conversations/list', {
|
||||
const response = await api.get<ConversationListResponse>('/conversations', {
|
||||
page,
|
||||
page_size: pageSize,
|
||||
});
|
||||
@@ -56,8 +56,7 @@ class MessageService {
|
||||
|
||||
private async refreshConversationDetailFromServer(id: string): Promise<ConversationDetailResponse> {
|
||||
const response = await api.get<ConversationDetailResponse>(
|
||||
'/conversations/get',
|
||||
{ conversation_id: id }
|
||||
`/conversations/${encodeURIComponent(id)}`
|
||||
);
|
||||
await saveConversationCache(response.data);
|
||||
if (response.data.participants?.length) {
|
||||
@@ -135,11 +134,11 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 创建私聊会话
|
||||
* POST /api/v1/conversations/create
|
||||
* POST /api/v1/conversations
|
||||
* @param userId 目标用户ID (UUID格式)
|
||||
*/
|
||||
async createConversation(userId: string): Promise<ConversationResponse> {
|
||||
const response = await api.post<ConversationResponse>('/conversations/create', {
|
||||
const response = await api.post<ConversationResponse>('/conversations', {
|
||||
user_id: userId,
|
||||
});
|
||||
await saveConversationCache(response.data);
|
||||
@@ -151,7 +150,7 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 获取会话详情
|
||||
* GET /api/v1/conversations/get?conversation_id=xxx
|
||||
* GET /api/v1/conversations/:id
|
||||
*/
|
||||
async getConversationById(id: string): Promise<ConversationDetailResponse> {
|
||||
const cached = await getConversationCache(id);
|
||||
@@ -180,11 +179,10 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 设置会话置顶
|
||||
* POST /api/v1/conversations/set_pinned
|
||||
* PUT /api/v1/conversations/:id/pinned
|
||||
*/
|
||||
async setConversationPinned(conversationId: string, isPinned: boolean): Promise<void> {
|
||||
await api.post('/conversations/set_pinned', {
|
||||
conversation_id: conversationId,
|
||||
await api.put(`/conversations/${encodeURIComponent(conversationId)}/pinned`, {
|
||||
is_pinned: isPinned,
|
||||
});
|
||||
}
|
||||
@@ -193,7 +191,7 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 获取消息列表(支持增量同步和历史消息加载)
|
||||
* GET /api/v1/conversations/get_messages?conversation_id=xxx
|
||||
* GET /api/v1/conversations/:id/messages
|
||||
* @param conversationId 会话ID
|
||||
* @param afterSeq 获取此序号之后的消息(增量同步,获取新消息)
|
||||
* @param beforeSeq 获取此序号之前的历史消息(下拉加载更多,获取旧消息)
|
||||
@@ -205,9 +203,7 @@ class MessageService {
|
||||
beforeSeq?: number,
|
||||
limit?: number
|
||||
): Promise<MessageListResponse> {
|
||||
const params: Record<string, any> = {
|
||||
conversation_id: conversationId,
|
||||
};
|
||||
const params: Record<string, any> = {};
|
||||
if (afterSeq !== undefined) {
|
||||
params.after_seq = afterSeq;
|
||||
}
|
||||
@@ -220,7 +216,7 @@ class MessageService {
|
||||
|
||||
try {
|
||||
const response = await api.get<any>(
|
||||
'/conversations/get_messages',
|
||||
`/conversations/${encodeURIComponent(conversationId)}/messages`,
|
||||
params
|
||||
);
|
||||
|
||||
@@ -255,8 +251,8 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 发送消息(新格式)
|
||||
* POST /api/v1/conversations/send_message
|
||||
* Body: { detail_type, conversation_id, message }
|
||||
* POST /api/v1/conversations/:id/messages
|
||||
* Body: { detail_type, segments }
|
||||
*/
|
||||
async sendMessage(
|
||||
conversationId: string,
|
||||
@@ -271,32 +267,38 @@ class MessageService {
|
||||
return this.sendMessageByAction(
|
||||
detailType,
|
||||
conversationId,
|
||||
data.segments
|
||||
data.segments,
|
||||
data.reply_to_id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 HTTP POST 发送消息(新格式)
|
||||
* 请求格式: POST /api/v1/conversations/send_message
|
||||
* Body: { "detail_type": "private", "conversation_id": "xxx", "segments": [...] }
|
||||
* 请求格式: POST /api/v1/conversations/:id/messages
|
||||
* Body: { "detail_type": "private", "segments": [...] }
|
||||
* @param detailType 消息类型: 'private' 私聊, 'group' 群聊
|
||||
* @param conversationId 会话ID
|
||||
* @param message 消息段数组 [{"type": "text", "data": {"text": "xxx"}}]
|
||||
* @param replyToId 回复的消息ID(可选)
|
||||
* @returns 消息响应
|
||||
*/
|
||||
async sendMessageByAction(
|
||||
detailType: 'private' | 'group',
|
||||
conversationId: string,
|
||||
message: MessageSegment[]
|
||||
message: MessageSegment[],
|
||||
replyToId?: string
|
||||
): Promise<MessageResponse> {
|
||||
try {
|
||||
const body: Record<string, any> = {
|
||||
detail_type: detailType,
|
||||
segments: message,
|
||||
};
|
||||
if (replyToId) {
|
||||
body.reply_to_id = replyToId;
|
||||
}
|
||||
const response = await api.post<MessageResponse>(
|
||||
'/conversations/send_message',
|
||||
{
|
||||
detail_type: detailType,
|
||||
conversation_id: conversationId,
|
||||
segments: message,
|
||||
}
|
||||
`/conversations/${encodeURIComponent(conversationId)}/messages`,
|
||||
body
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
@@ -393,14 +395,8 @@ class MessageService {
|
||||
replyToId: string,
|
||||
detailType: 'private' | 'group' = 'private'
|
||||
): Promise<MessageResponse> {
|
||||
// 添加回复段到消息开头
|
||||
const replySegment: MessageSegment = {
|
||||
type: 'reply',
|
||||
data: {
|
||||
id: replyToId,
|
||||
},
|
||||
};
|
||||
return this.sendMessageByAction(detailType, conversationId, [replySegment, ...segments]);
|
||||
// 使用 reply_to_id 参数发送回复消息
|
||||
return this.sendMessageByAction(detailType, conversationId, segments, replyToId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,13 +422,12 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 标记已读
|
||||
* POST /api/v1/conversations/mark_read
|
||||
* POST /api/v1/conversations/:id/read
|
||||
* @param conversationId 会话ID
|
||||
* @param seq 已读到的消息序号
|
||||
*/
|
||||
async markAsRead(conversationId: string, seq: number): Promise<void> {
|
||||
await api.post('/conversations/mark_read', {
|
||||
conversation_id: conversationId,
|
||||
await api.post(`/conversations/${encodeURIComponent(conversationId)}/read`, {
|
||||
last_read_seq: Number(seq),
|
||||
});
|
||||
// 立即清零本地缓存中的 unread_count,避免回到列表时仍显示旧红点
|
||||
@@ -443,12 +438,10 @@ class MessageService {
|
||||
|
||||
/**
|
||||
* 上报输入状态
|
||||
* POST /api/v1/conversations/typing
|
||||
* POST /api/v1/conversations/:id/typing
|
||||
*/
|
||||
async sendTyping(conversationId: string): Promise<void> {
|
||||
await api.post('/conversations/typing', {
|
||||
conversation_id: conversationId,
|
||||
});
|
||||
await api.post(`/conversations/${encodeURIComponent(conversationId)}/typing`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user