Skip to content

Commit

Permalink
Merge pull request #2761 from build-5/impr/2757-get-top
Browse files Browse the repository at this point in the history
Get top func
  • Loading branch information
adamunchained authored Jan 17, 2024
2 parents 2e2575b + c794baa commit 9d60f7d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/sdk/src/https/datasets/Dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ export abstract class DatasetClass<D extends Dataset, T> extends BaseDataSetClas
return fetchLive<T[]>(this.apiKey, url);
};

getTop = async (startAfter?: string, limit?: number): Promise<T[]> => {
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<T[]>(this.apiKey, url, { ...params });
};

getTopLive = (startAfter?: string, limit?: number): Observable<T[]> => {
const params: GetManyAdvancedRequest = {
dataset: this.dataset,
Expand Down

0 comments on commit 9d60f7d

Please sign in to comment.