113 lines
2.8 KiB
TypeScript
113 lines
2.8 KiB
TypeScript
import { ITeam } from '../../ITeam';
|
|
import type { IMessage, IMessageFromServer } from '../../IMessage';
|
|
import type { IServerRoom } from '../../IRoom';
|
|
import type { IUser } from '../../IUser';
|
|
|
|
export type ChannelsEndpoints = {
|
|
'channels.files': {
|
|
GET: (params: {
|
|
roomId: IServerRoom['_id'];
|
|
offset: number;
|
|
count: number;
|
|
sort: string | { uploadedAt: number };
|
|
query: string;
|
|
}) => {
|
|
files: IMessage[];
|
|
total: number;
|
|
};
|
|
};
|
|
'channels.members': {
|
|
GET: (params: { roomId: IServerRoom['_id']; offset?: number; count?: number; filter?: string; status?: string[] }) => {
|
|
count: number;
|
|
offset: number;
|
|
members: IUser[];
|
|
total: number;
|
|
};
|
|
};
|
|
'channels.history': {
|
|
GET: (params: { roomId: string; count: number; latest?: string }) => {
|
|
messages: IMessageFromServer[];
|
|
};
|
|
};
|
|
'channels.archive': {
|
|
POST: (params: { roomId: string }) => void;
|
|
};
|
|
'channels.unarchive': {
|
|
POST: (params: { roomId: string }) => void;
|
|
};
|
|
'channels.create': {
|
|
POST: (params: {
|
|
name: string;
|
|
members: string[];
|
|
readOnly: boolean;
|
|
extraData: {
|
|
broadcast: boolean;
|
|
encrypted: boolean;
|
|
teamId?: string;
|
|
};
|
|
}) => {
|
|
group: Partial<IServerRoom>;
|
|
};
|
|
};
|
|
'channels.convertToTeam': {
|
|
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
|
};
|
|
'channels.info': {
|
|
GET: (params: { roomId: string }) => { channel: IServerRoom };
|
|
};
|
|
'channels.counters': {
|
|
GET: (params: { roomId: string }) => {
|
|
joined: boolean;
|
|
members: number;
|
|
unreads: number;
|
|
unreadsFrom: Date;
|
|
msgs: number;
|
|
latest: Date;
|
|
userMentions: number;
|
|
};
|
|
};
|
|
'channels.join': {
|
|
POST: (params: { roomId: string; joinCode: string | null }) => { channel: IServerRoom };
|
|
};
|
|
'channels.close': {
|
|
POST: (params: { roomId: string }) => {};
|
|
};
|
|
'channels.kick': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'channels.delete': {
|
|
POST: (params: { roomId: string }) => {};
|
|
};
|
|
'channels.leave': {
|
|
POST: (params: { roomId: string }) => {};
|
|
};
|
|
'channels.addModerator': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'channels.removeModerator': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'channels.addOwner': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'channels.removeOwner': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'channels.addLeader': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'channels.removeLeader': {
|
|
POST: (params: { roomId: string; userId: string }) => {};
|
|
};
|
|
'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[];
|
|
};
|
|
};
|
|
};
|