From 5d284532018eeab7776a1d2a3e4b2bbce8ab4d44 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Thu, 10 Mar 2022 09:25:25 -0300 Subject: [PATCH] Chore: Migrate REST API - getAvatarSuggestion to Typescript (#3869) --- app/definitions/IProfileViewInterfaces.ts | 16 +++++++++------- app/lib/rocketchat/services/restApi.ts | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/definitions/IProfileViewInterfaces.ts b/app/definitions/IProfileViewInterfaces.ts index 491f7b201..ba6d0659b 100644 --- a/app/definitions/IProfileViewInterfaces.ts +++ b/app/definitions/IProfileViewInterfaces.ts @@ -57,6 +57,14 @@ export interface IAvatar { service?: any; } +export interface IAvatarSuggestion { + [service: string]: { + url: string; + blob: string; + contentType: string; + }; +} + export interface IProfileViewState { saving: boolean; name: string; @@ -66,13 +74,7 @@ export interface IProfileViewState { currentPassword: string | null; avatarUrl: string | null; avatar: IAvatar; - avatarSuggestions: { - [service: string]: { - url: string; - blob: string; - contentType: string; - }; - }; + avatarSuggestions: IAvatarSuggestion; customFields: { [key: string | number]: string; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 5c834ae5a..268f2140c 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -3,7 +3,7 @@ import { TEAM_TYPE } from '../../../definitions/ITeam'; import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType'; import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions'; import { ISpotlight } from '../../../definitions/ISpotlight'; -import { IParams } from '../../../definitions/IProfileViewInterfaces'; +import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces'; export const createChannel = ({ name, @@ -566,7 +566,7 @@ export const getRoomRoles = (roomId: string, type: SubscriptionType): any => // @ts-ignore sdk.get(`${roomTypeToApiType(type)}.roles`, { roomId }); -export const getAvatarSuggestion = () => +export const getAvatarSuggestion = (): Promise => // RC 0.51.0 sdk.methodCallWrapper('getAvatarSuggestion');