2022-03-02 17:44:42 +00:00
|
|
|
import { ITeam } from '../../ITeam';
|
2022-03-10 15:29:33 +00:00
|
|
|
import type { 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';
|
2022-03-15 00:11:34 +00:00
|
|
|
import { IGetRoomRoles } from '../../IRole';
|
2022-03-10 15:29:33 +00:00
|
|
|
import { IServerAttachment } from '../../IAttachment';
|
2022-03-16 01:37:49 +00:00
|
|
|
import { PaginatedRequest } from '../helpers/PaginatedRequest';
|
2022-02-14 16:20:29 +00:00
|
|
|
|
|
|
|
export type ChannelsEndpoints = {
|
|
|
|
'channels.files': {
|
2022-03-10 15:29:33 +00:00
|
|
|
GET: (params: { roomId: IServerRoom['_id']; offset: number; sort: string | { uploadedAt: number } }) => {
|
|
|
|
files: IServerAttachment[];
|
2022-02-25 21:32:03 +00:00
|
|
|
count: number;
|
2022-03-10 15:29:33 +00:00
|
|
|
offset: number;
|
2022-02-14 16:20:29 +00:00
|
|
|
total: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'channels.members': {
|
2022-03-16 01:37:49 +00:00
|
|
|
GET: (params: {
|
|
|
|
roomId: IServerRoom['_id'];
|
|
|
|
offset?: number;
|
|
|
|
count?: number;
|
|
|
|
filter?: boolean;
|
|
|
|
status?: string[];
|
|
|
|
}) => PaginatedRequest<{
|
2022-02-14 16:20:29 +00:00
|
|
|
members: IUser[];
|
2022-03-16 01:37:49 +00:00
|
|
|
}>;
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|
2022-02-25 21:32:03 +00:00
|
|
|
'channels.history': {
|
|
|
|
GET: (params: { roomId: string; count: number; latest?: string }) => {
|
|
|
|
messages: IMessageFromServer[];
|
|
|
|
};
|
|
|
|
};
|
2022-03-02 21:19:07 +00:00
|
|
|
'channels.archive': {
|
|
|
|
POST: (params: { roomId: string }) => void;
|
|
|
|
};
|
|
|
|
'channels.unarchive': {
|
|
|
|
POST: (params: { roomId: string }) => void;
|
|
|
|
};
|
2022-03-02 19:40:27 +00:00
|
|
|
'channels.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
|
|
|
'channels.convertToTeam': {
|
|
|
|
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
|
|
|
};
|
2022-03-08 13:46:33 +00:00
|
|
|
'channels.info': {
|
2022-03-08 16:25:27 +00:00
|
|
|
GET: (params: { roomId: string }) => { channel: IServerRoom };
|
2022-03-08 13:46:33 +00:00
|
|
|
};
|
2022-03-07 16:48:33 +00:00
|
|
|
'channels.counters': {
|
|
|
|
GET: (params: { roomId: string }) => {
|
|
|
|
joined: boolean;
|
|
|
|
members: number;
|
|
|
|
unreads: number;
|
|
|
|
unreadsFrom: Date;
|
|
|
|
msgs: number;
|
|
|
|
latest: Date;
|
|
|
|
userMentions: number;
|
|
|
|
};
|
|
|
|
};
|
2022-03-07 16:07:40 +00:00
|
|
|
'channels.join': {
|
2022-03-08 16:25:27 +00:00
|
|
|
POST: (params: { roomId: string; joinCode: string | null }) => { channel: IServerRoom };
|
2022-03-07 16:07:40 +00:00
|
|
|
};
|
2022-03-07 12:57:57 +00:00
|
|
|
'channels.close': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:44:11 +00:00
|
|
|
'channels.kick': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:33:58 +00:00
|
|
|
'channels.delete': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 12:20:12 +00:00
|
|
|
'channels.leave': {
|
|
|
|
POST: (params: { roomId: string }) => {};
|
|
|
|
};
|
2022-03-07 14:47:06 +00:00
|
|
|
'channels.addModerator': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
|
|
|
'channels.removeModerator': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
2022-03-07 15:40:38 +00:00
|
|
|
'channels.addOwner': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
|
|
|
'channels.removeOwner': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
2022-03-07 15:52:22 +00:00
|
|
|
'channels.addLeader': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
|
|
|
'channels.removeLeader': {
|
|
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
|
|
};
|
2022-03-15 00:11:34 +00:00
|
|
|
'channels.roles': {
|
|
|
|
GET: (params: { roomId: string }) => { roles: IGetRoomRoles[] };
|
2022-03-15 00:29:48 +00:00
|
|
|
};
|
2022-03-10 15:00:50 +00:00
|
|
|
'channels.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
|
|
|
};
|