2022-03-02 17:44:42 +00:00
|
|
|
import { ITeam } from '../../ITeam';
|
2022-02-25 21:32:03 +00:00
|
|
|
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
2022-03-08 16:25:27 +00:00
|
|
|
import type { IServerRoom } from '../../IRoom';
|
2022-02-14 16:20:29 +00:00
|
|
|
import type { IUser } from '../../IUser';
|
|
|
|
|
|
|
|
export type GroupsEndpoints = {
|
|
|
|
'groups.files': {
|
2022-03-08 16:25:27 +00:00
|
|
|
GET: (params: { roomId: IServerRoom['_id']; count: number; sort: string | { uploadedAt: number }; query: string }) => {
|
2022-02-14 16:20:29 +00:00
|
|
|
files: IMessage[];
|
|
|
|
total: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'groups.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
|
|
|
'groups.history': {
|
|
|
|
GET: (params: { roomId: string; count: number; latest?: string }) => {
|
|
|
|
messages: IMessageFromServer[];
|
|
|
|
};
|
|
|
|
};
|
2022-03-02 21:19:07 +00:00
|
|
|
'groups.archive': {
|
|
|
|
POST: (params: { roomId: string }) => void;
|
|
|
|
};
|
|
|
|
'groups.unarchive': {
|
|
|
|
POST: (params: { roomId: string }) => void;
|
|
|
|
};
|
2022-03-02 19:40:27 +00:00
|
|
|
'groups.create': {
|
|
|
|
POST: (params: {
|
|
|
|
name: string;
|
|
|
|
members: string[];
|
|
|
|
readOnly: boolean;
|
|
|
|
extraData: {
|
|
|
|
broadcast: boolean;
|
|
|
|
encrypted: boolean;
|
|
|
|
teamId?: string;
|
|
|
|
};
|
|
|
|
}) => {
|
2022-03-08 16:25:27 +00:00
|
|
|
group: Partial<IServerRoom>;
|
2022-03-02 19:40:27 +00:00
|
|
|
};
|
|
|
|
};
|
2022-03-02 17:44:42 +00:00
|
|
|
'groups.convertToTeam': {
|
|
|
|
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
|
|
|
|
};
|
2022-03-07 16:48:33 +00:00
|
|
|
'groups.counters': {
|
|
|
|
GET: (params: { roomId: string }) => {
|
|
|
|
joined: boolean;
|
|
|
|
members: number;
|
|
|
|
unreads: number;
|
|
|
|
unreadsFrom: Date;
|
|
|
|
msgs: number;
|
|
|
|
latest: Date;
|
|
|
|
userMentions: number;
|
|
|
|
};
|
|
|
|
};
|
2022-03-07 12:57:57 +00:00
|
|
|
'groups.close': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:44:11 +00:00
|
|
|
'groups.kick': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:33:58 +00:00
|
|
|
'groups.delete': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:20:12 +00:00
|
|
|
'groups.leave': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-10 15:00:50 +00:00
|
|
|
'groups.messages': {
|
|
|
|
GET: (params: {
|
|
|
|
roomId: IServerRoom['_id'];
|
|
|
|
query: { 'mentions._id': { $in: string[] } } | { 'starred._id': { $in: string[] } } | { pinned: boolean };
|
|
|
|
offset: number;
|
|
|
|
sort: { ts: number };
|
|
|
|
}) => {
|
|
|
|
messages: IMessageFromServer[];
|
|
|
|
};
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|