import { ITeam } from '../../ITeam';
import type { IMessageFromServer } from '../../IMessage';
import type { IServerRoom } from '../../IRoom';
import type { IUser } from '../../IUser';
import { IGetRoomRoles } from '../../IRole';
import { IServerAttachment } from '../../IAttachment';
import { PaginatedRequest } from '../helpers/PaginatedRequest';
export type ChannelsEndpoints = {
'channels.files': {
GET: (params: { roomId: IServerRoom['_id']; offset: number; sort: string | { uploadedAt: number } }) => {
files: IServerAttachment[];
count: number;
offset: number;
total: number;
};
'channels.members': {
GET: (params: {
roomId: IServerRoom['_id'];
offset?: number;
count?: number;
filter?: boolean;
status?: string[];
}) => PaginatedRequest<{
members: IUser[];
}>;
'channels.history': {
GET: (params: { roomId: string; count: number; latest?: string }) => {
messages: IMessageFromServer[];
'channels.archive': {
POST: (params: { roomId: string }) => void;
'channels.unarchive': {
'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': {
'channels.leave': {
'channels.addModerator': {
'channels.removeModerator': {
'channels.addOwner': {
'channels.removeOwner': {
'channels.addLeader': {
'channels.removeLeader': {
'channels.roles': {
GET: (params: { roomId: string }) => { roles: IGetRoomRoles[] };
'channels.messages': {
query: { 'mentions._id': { $in: string[] } } | { 'starred._id': { $in: string[] } } | { pinned: boolean };
sort: { ts: number };