From ed716396d05856128442757b1a763f996e3dbb76 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Wed, 16 Feb 2022 10:48:15 -0400 Subject: [PATCH] Chore: Migrate methods/getRooms to TS (#3702) * migrate getRooms to TS * add sdk and set any types * Moved the new variable around and added ts-ignore to follow the pattern from /services/restApi.ts Co-authored-by: Diego Mello --- app/lib/methods/getRooms.js | 9 --------- app/lib/methods/getRooms.ts | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 app/lib/methods/getRooms.js create mode 100644 app/lib/methods/getRooms.ts diff --git a/app/lib/methods/getRooms.js b/app/lib/methods/getRooms.js deleted file mode 100644 index 5004beda0..000000000 --- a/app/lib/methods/getRooms.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function (updatedSince) { - // subscriptions.get: Since RC 0.60.0 - // rooms.get: Since RC 0.62.0 - if (updatedSince) { - updatedSince = updatedSince.toISOString(); - return Promise.all([this.sdk.get('subscriptions.get', { updatedSince }), this.sdk.get('rooms.get', { updatedSince })]); - } - return Promise.all([this.sdk.get('subscriptions.get'), this.sdk.get('rooms.get')]); -} diff --git a/app/lib/methods/getRooms.ts b/app/lib/methods/getRooms.ts new file mode 100644 index 000000000..e4f369975 --- /dev/null +++ b/app/lib/methods/getRooms.ts @@ -0,0 +1,15 @@ +import sdk from '../rocketchat/services/sdk'; + +export default function (updatedSince: Date) { + // subscriptions.get: Since RC 0.60.0 + // rooms.get: Since RC 0.62.0 + if (updatedSince) { + const updatedDate = updatedSince.toISOString(); + // TODO: missing definitions from server + // @ts-ignore + return Promise.all([sdk.get('subscriptions.get', { updatedDate }), sdk.get('rooms.get', { updatedDate })]); + } + // TODO: missing definitions from server + // @ts-ignore + return Promise.all([sdk.get('subscriptions.get'), sdk.get('rooms.get')]); +}