Chore: Migrate REST API - getRoomCounters to Typescript (#3842)
* Chore: Migrate REST API - getRoomCounters to Typescript * minor tweak
This commit is contained in:
parent
e3f4e9797d
commit
45c0e0630c
|
@ -52,6 +52,17 @@ export type ChannelsEndpoints = {
|
||||||
'channels.convertToTeam': {
|
'channels.convertToTeam': {
|
||||||
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
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': {
|
'channels.join': {
|
||||||
POST: (params: { roomId: string; joinCode: string | null }) => { channel: IServerRoomItem };
|
POST: (params: { roomId: string; joinCode: string | null }) => { channel: IServerRoomItem };
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,6 +46,17 @@ export type GroupsEndpoints = {
|
||||||
'groups.convertToTeam': {
|
'groups.convertToTeam': {
|
||||||
POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
|
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': {
|
'groups.close': {
|
||||||
POST: (params: { roomId: string }) => {};
|
POST: (params: { roomId: string }) => {};
|
||||||
};
|
};
|
||||||
|
|
|
@ -278,10 +278,11 @@ export const toggleRead = (read: boolean, roomId: string) => {
|
||||||
return sdk.post('subscriptions.read', { rid: roomId });
|
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
|
// RC 0.65.0
|
||||||
// TODO: missing definitions from server
|
|
||||||
// @ts-ignore
|
|
||||||
sdk.get(`${roomTypeToApiType(t)}.counters`, { roomId });
|
sdk.get(`${roomTypeToApiType(t)}.counters`, { roomId });
|
||||||
|
|
||||||
export const getChannelInfo = (roomId: string): any =>
|
export const getChannelInfo = (roomId: string): any =>
|
||||||
|
|
Loading…
Reference in New Issue