2022-03-10 01:31:50 +00:00
|
|
|
import type { IMessageFromServer } from '../../IMessage';
|
2022-03-08 16:25:27 +00:00
|
|
|
import type { IServerRoom, RoomID, RoomType } from '../../IRoom';
|
2022-02-14 16:20:29 +00:00
|
|
|
import type { IUser } from '../../IUser';
|
2022-03-10 01:31:50 +00:00
|
|
|
import { IServerAttachment } from '../../IAttachment';
|
2022-02-14 16:20:29 +00:00
|
|
|
|
|
|
|
export type ImEndpoints = {
|
|
|
|
'im.create': {
|
|
|
|
POST: (
|
|
|
|
params: (
|
|
|
|
| {
|
|
|
|
username: Exclude<IUser['username'], undefined>;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
usernames: string;
|
|
|
|
}
|
|
|
|
) & {
|
|
|
|
excludeSelf?: boolean;
|
|
|
|
}
|
|
|
|
) => {
|
2022-03-08 16:25:27 +00:00
|
|
|
room: {
|
|
|
|
t: RoomType;
|
|
|
|
rid: RoomID;
|
|
|
|
_id: RoomID;
|
|
|
|
usernames: IServerRoom['usernames'];
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
'im.files': {
|
2022-03-10 01:31:50 +00:00
|
|
|
GET: (params: { roomId: IServerRoom['_id']; offset: number; sort: string | { uploadedAt: number } }) => {
|
|
|
|
files: IServerAttachment[];
|
|
|
|
count: number;
|
|
|
|
offset: number;
|
2022-02-14 16:20:29 +00:00
|
|
|
total: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'im.members': {
|
2022-03-08 16:25:27 +00:00
|
|
|
GET: (params: { roomId: IServerRoom['_id']; offset?: number; count?: number; filter?: string; status?: string[] }) => {
|
2022-02-14 16:20:29 +00:00
|
|
|
count: number;
|
|
|
|
offset: number;
|
|
|
|
members: IUser[];
|
|
|
|
total: number;
|
|
|
|
};
|
|
|
|
};
|
2022-02-25 21:32:03 +00:00
|
|
|
'im.history': {
|
|
|
|
GET: (params: { roomId: string; count: number; latest?: string }) => {
|
|
|
|
messages: IMessageFromServer[];
|
|
|
|
};
|
|
|
|
};
|
2022-03-07 12:57:57 +00:00
|
|
|
'im.close': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:44:11 +00:00
|
|
|
'im.kick': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:33:58 +00:00
|
|
|
'im.delete': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:20:12 +00:00
|
|
|
'im.leave': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|