From c794baa39dadb5bf6cf36273773094050a497afb Mon Sep 17 00:00:00 2001 From: Boldizsar Mezei Date: Wed, 17 Jan 2024 16:48:44 +0100 Subject: [PATCH] Get top func --- packages/sdk/src/https/datasets/Dataset.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/sdk/src/https/datasets/Dataset.ts b/packages/sdk/src/https/datasets/Dataset.ts index d0a11da7ad..cf31278fa4 100644 --- a/packages/sdk/src/https/datasets/Dataset.ts +++ b/packages/sdk/src/https/datasets/Dataset.ts @@ -124,6 +124,21 @@ export abstract class DatasetClass extends BaseDataSetClas return fetchLive(this.apiKey, url); }; + getTop = async (startAfter?: string, limit?: number): Promise => { + const params: GetManyAdvancedRequest = { + dataset: this.dataset, + fieldName: [], + fieldValue: [], + operator: [], + startAfter, + limit, + orderBy: ['createdOn'], + orderByDir: ['desc'], + }; + const url = this.origin + ApiRoutes.GET_MANY_ADVANCED; + return await wrappedFetch(this.apiKey, url, { ...params }); + }; + getTopLive = (startAfter?: string, limit?: number): Observable => { const params: GetManyAdvancedRequest = { dataset: this.dataset,