From 1da4f01dcb0cc4ece932a3101da8051691021eb1 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Wed, 2 Mar 2022 16:17:42 -0400 Subject: [PATCH] Chore: Migrate REST API - createTeam to TS (#3788) * Migrate `teams.create` REST API to TypeScript --- app/definitions/rest/v1/teams.ts | 9 +++++++++ app/lib/rocketchat/services/restApi.ts | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/definitions/rest/v1/teams.ts b/app/definitions/rest/v1/teams.ts index 29047149d..cc6bfd620 100644 --- a/app/definitions/rest/v1/teams.ts +++ b/app/definitions/rest/v1/teams.ts @@ -1,7 +1,16 @@ import { IRoom } from '../../IRoom'; +import { ITeam, TEAM_TYPE } from '../../ITeam'; export type TeamsEndpoints = { 'teams.removeRoom': { POST: (params: { roomId: string; teamId: string }) => { room: IRoom }; }; + 'teams.create': { + POST: (params: { + name: string; + users: string[]; + type: TEAM_TYPE; + room: { readOnly: boolean; extraData: { broadcast: boolean; encrypted: boolean } }; + }) => { team: ITeam }; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 19217ef12..b5947efae 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -148,7 +148,7 @@ export const createTeam = ({ readOnly: boolean; broadcast: boolean; encrypted: boolean; -}): any => { +}) => { const params = { name, users, @@ -162,8 +162,6 @@ export const createTeam = ({ } }; // RC 3.13.0 - // TODO: missing definitions from server - // @ts-ignore return sdk.post('teams.create', params); }; export const addRoomsToTeam = ({ teamId, rooms }: { teamId: string; rooms: string[] }): any =>