import { request } from '../api/request' ; export enum ChatConverseType { DM = 'DM' , Group = 'Group' } export interface ChatConverseInfo { _id : string ; name : string ; type : ChatConverseType ; members : string [ ] ; } /**
 * 尝试创建私聊会话
 * 如果已创建则返回之前的
 */ export async function createDMConverse ( memberIds ) { const { data } = await request . post ( '/api/chat/converse/createDMConverse' , { memberIds } ) ; return data ; } /**
 * 在多人会话中添加成员
 */ export async function appendDMConverseMembers ( converseId , memberIds ) { const { data } = await request . post ( '/api/chat/converse/appendDMConverseMembers' , { converseId , memberIds } ) ; return data ; } param converseId export async function fetchConverseInfo ( converseId ) { const { data } = await request . get ( '/api/chat/converse/findConverseInfo' , { params : { converseId } } ) ; return data ; } param converseId param lastMessageId export async function updateAck ( converseId , lastMessageId ) { await request . post ( '/api/chat/ack/update' , { converseId , lastMessageId } ) ; } interface AckInfo { userId : string ; converseId : string ; lastMessageId : string ; } /**
 * 获取用户存储在远程的会话信息
 */ export async function fetchUserAck ( ) { const { data } = await request . get ( '/api/chat/ack/all' ) ; return data ; }