From 4d6f21647e2577fd90db5c978a60e7a3050f2461 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 7 Mar 2022 13:07:40 -0300 Subject: [PATCH] Chore: Migrate REST API - joinRoom to Typescript (#3835) * Chore: Migrate REST API - joinRoom to Typescript * join to discussion --- app/definitions/rest/v1/channels.ts | 3 +++ app/lib/rocketchat/services/restApi.ts | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/definitions/rest/v1/channels.ts b/app/definitions/rest/v1/channels.ts index 8b14decb1..88ae895ca 100644 --- a/app/definitions/rest/v1/channels.ts +++ b/app/definitions/rest/v1/channels.ts @@ -52,6 +52,9 @@ export type ChannelsEndpoints = { 'channels.convertToTeam': { POST: (params: { channelId: string; channelName: string }) => { team: ITeam }; }; + 'channels.join': { + POST: (params: { roomId: string; joinCode: string | null }) => { channel: IServerRoomItem }; + }; 'channels.close': { POST: (params: { roomId: string }) => {}; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 728d30dd5..59264a799 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -221,14 +221,11 @@ export const convertTeamToChannel = ({ teamId, selected }: { teamId: string; sel return sdk.post('teams.convertToChannel', params); }; -export const joinRoom = (roomId: string, joinCode: string | null, type: 'c' | 'p'): any => { - // TODO: join code +export const joinRoom = (roomId: string, joinCode: string | null, type: 'c' | 'p') => { // RC 0.48.0 if (type === 'p') { - return sdk.methodCallWrapper('joinRoom', roomId); + return sdk.methodCallWrapper('joinRoom', roomId) as Promise; } - // TODO: missing definitions from server - // @ts-ignore return sdk.post('channels.join', { roomId, joinCode }); };