diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index 88ae895ca9..839067cf12 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -52,6 +52,17 @@ export type ChannelsEndpoints = { 'channels.convertToTeam': { POST: (params: { channelId: string; channelName: string }) => { team: ITeam }; }; + '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: IServerRoomItem }; }; diff --git a/app/definitions/rest/v1/groups.ts b/app/definitions/rest/v1/groups.ts index 80de882afa..68c6095589 100644 --- a/app/definitions/rest/v1/groups.ts +++ b/app/definitions/rest/v1/groups.ts @@ -46,6 +46,17 @@ export type GroupsEndpoints = { 'groups.convertToTeam': { POST: (params: { roomId: string; roomName: string }) => { team: ITeam }; }; + 'groups.counters': { + GET: (params: { roomId: string }) => { + joined: boolean; + members: number; + unreads: number; + unreadsFrom: Date; + msgs: number; + latest: Date; + userMentions: number; + }; + }; 'groups.close': { POST: (params: { roomId: string }) => {}; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index e231c5e554..0175a9d12e 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -278,10 +278,11 @@ export const toggleRead = (read: boolean, roomId: string) => { return sdk.post('subscriptions.read', { rid: roomId }); }; -export const getRoomCounters = (roomId: string, t: RoomTypes): any => +export const getRoomCounters = ( + roomId: string, + t: SubscriptionType.CHANNEL | SubscriptionType.GROUP | SubscriptionType.OMNICHANNEL +) => // RC 0.65.0 - // TODO: missing definitions from server - // @ts-ignore sdk.get(`${roomTypeToApiType(t)}.counters`, { roomId }); export const getChannelInfo = (roomId: string): any =>