From b21d044f138498759b9e8ef129f1683030e16378 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 7 Mar 2022 12:16:20 -0300 Subject: [PATCH] Chore: Migrate REST API - spotlight to Typescript (#3821) * Chore: Migrate REST API - spotlight to Typescript * minor tweak --- app/definitions/ISpotlight.ts | 11 +++++++++++ app/lib/rocketchat/services/restApi.ts | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/definitions/ISpotlight.ts diff --git a/app/definitions/ISpotlight.ts b/app/definitions/ISpotlight.ts new file mode 100644 index 00000000..8a055775 --- /dev/null +++ b/app/definitions/ISpotlight.ts @@ -0,0 +1,11 @@ +import { IServerRoomItem } from './IRoom'; +import { IUser } from './IUser'; + +export type TSpotlightUser = Pick & { outside: boolean }; + +export type ISpotlightRoom = Pick & Partial>; + +export interface ISpotlight { + users: TSpotlightUser[]; + rooms: ISpotlightRoom[]; +} diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index de888e3a..33a31bd3 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -2,6 +2,7 @@ import sdk from './sdk'; import { TEAM_TYPE } from '../../../definitions/ITeam'; import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType'; import { SubscriptionType, INotificationPreferences } from '../../../definitions'; +import { ISpotlight } from '../../../definitions/ISpotlight'; export const createChannel = ({ name, @@ -72,7 +73,7 @@ export const forgotPassword = (email: string) => export const sendConfirmationEmail = (email: string): Promise<{ message: string; success: boolean }> => sdk.methodCallWrapper('sendConfirmationEmail', email); -export const spotlight = (search: string, usernames: string, type: { users: boolean; rooms: boolean }) => +export const spotlight = (search: string, usernames: string[], type: { users: boolean; rooms: boolean }): Promise => // RC 0.51.0 sdk.methodCallWrapper('spotlight', search, usernames, type);