2022-02-14 16:20:29 +00:00
|
|
|
import type { IMessage } from '../../IMessage';
|
|
|
|
import type { IRoom } from '../../IRoom';
|
2022-02-15 18:50:55 +00:00
|
|
|
import { PaginatedResult } from '../helpers/PaginatedResult';
|
2022-02-14 16:20:29 +00:00
|
|
|
|
|
|
|
export type ChatEndpoints = {
|
|
|
|
'chat.getMessage': {
|
|
|
|
GET: (params: { msgId: IMessage['_id'] }) => {
|
|
|
|
message: IMessage;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'chat.followMessage': {
|
|
|
|
POST: (params: { mid: IMessage['_id'] }) => void;
|
|
|
|
};
|
2022-03-05 03:08:26 +00:00
|
|
|
'chat.unStarMessage': {
|
|
|
|
POST: (params: { messageId: IMessage['_id'] }) => void;
|
|
|
|
};
|
|
|
|
'chat.starMessage': {
|
|
|
|
POST: (params: { messageId: IMessage['_id'] }) => void;
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
'chat.unfollowMessage': {
|
|
|
|
POST: (params: { mid: IMessage['_id'] }) => void;
|
|
|
|
};
|
2022-03-05 03:17:24 +00:00
|
|
|
'chat.unPinMessage': {
|
|
|
|
POST: (params: { messageId: IMessage['_id'] }) => void;
|
|
|
|
};
|
|
|
|
'chat.pinMessage': {
|
|
|
|
POST: (params: { messageId: IMessage['_id'] }) => void;
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
'chat.getDiscussions': {
|
|
|
|
GET: (params: { roomId: IRoom['_id']; text?: string; offset: number; count: number }) => {
|
|
|
|
messages: IMessage[];
|
|
|
|
total: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'chat.getThreadsList': {
|
2022-02-15 18:50:55 +00:00
|
|
|
GET: (params: {
|
|
|
|
rid: IRoom['_id'];
|
|
|
|
type: 'unread' | 'following' | 'all';
|
|
|
|
text?: string;
|
|
|
|
offset: number;
|
|
|
|
count: number;
|
|
|
|
}) => PaginatedResult<{
|
2022-02-14 16:20:29 +00:00
|
|
|
threads: IMessage[];
|
|
|
|
total: number;
|
2022-02-15 18:50:55 +00:00
|
|
|
}>;
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|
2022-03-02 21:45:05 +00:00
|
|
|
'chat.delete': {
|
|
|
|
POST: (params: { msgId: string; roomId: string }) => {
|
|
|
|
_id: string;
|
|
|
|
ts: string;
|
|
|
|
message: Pick<IMessage, '_id' | 'rid' | 'u'>;
|
|
|
|
};
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|