Chore: Migrate REST API - spotlight to Typescript (#3821)

* Chore: Migrate REST API - spotlight to Typescript

* minor tweak
This commit is contained in:
Reinaldo Neto 2022-03-07 12:16:20 -03:00 committed by GitHub
parent d43da089bf
commit b21d044f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,11 @@
import { IServerRoomItem } from './IRoom';
import { IUser } from './IUser';
export type TSpotlightUser = Pick<IUser, '_id' | 'status' | 'name' | 'username'> & { outside: boolean };
export type ISpotlightRoom = Pick<IServerRoomItem, '_id' | 'name' | 't'> & Partial<Pick<IServerRoomItem, 'lastMessage'>>;
export interface ISpotlight {
users: TSpotlightUser[];
rooms: ISpotlightRoom[];
}

View File

@ -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<ISpotlight> =>
// RC 0.51.0
sdk.methodCallWrapper('spotlight', search, usernames, type);