From 892e919768e843d7936eccadcc5b54908f51bc44 Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Mon, 7 Mar 2022 09:20:12 -0300 Subject: [PATCH] Chore: Migrate REST API - leaveRoom to Typescript (#3833) * chore: add rest api type * remove any --- app/definitions/rest/v1/channels.ts | 3 +++ app/definitions/rest/v1/groups.ts | 3 +++ app/definitions/rest/v1/im.ts | 3 +++ app/lib/rocketchat/services/restApi.ts | 4 +--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index 6692f0a9c..acdd87e26 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -52,4 +52,7 @@ export type ChannelsEndpoints = { 'channels.convertToTeam': { POST: (params: { channelId: string; channelName: string }) => { team: ITeam }; }; + 'channels.leave': { + POST: (params: { roomId: string }) => {}; + }; }; diff --git a/app/definitions/rest/v1/groups.ts b/app/definitions/rest/v1/groups.ts index 966a6759a..8d77cb3a8 100644 --- a/app/definitions/rest/v1/groups.ts +++ b/app/definitions/rest/v1/groups.ts @@ -46,4 +46,7 @@ export type GroupsEndpoints = { 'groups.convertToTeam': { POST: (params: { roomId: string; roomName: string }) => { team: ITeam }; }; + 'groups.leave': { + POST: (params: { roomId: string }) => {}; + }; }; diff --git a/app/definitions/rest/v1/im.ts b/app/definitions/rest/v1/im.ts index b2927b03c..5bdc274e3 100644 --- a/app/definitions/rest/v1/im.ts +++ b/app/definitions/rest/v1/im.ts @@ -38,4 +38,7 @@ export type ImEndpoints = { messages: IMessageFromServer[]; }; }; + 'im.leave': { + POST: (params: { roomId: string }) => {}; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 8f0d074d4..96331c20a 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -428,10 +428,8 @@ export const toggleBlockUser = (rid: string, blocked: string, block: boolean): P return sdk.methodCallWrapper('unblockUser', { rid, blocked }); }; -export const leaveRoom = (roomId: string, t: RoomTypes): any => +export const leaveRoom = (roomId: string, t: RoomTypes) => // RC 0.48.0 - // TODO: missing definitions from server - // @ts-ignore sdk.post(`${roomTypeToApiType(t)}.leave`, { roomId }); export const deleteRoom = (roomId: string, t: RoomTypes): any =>