Skip to content

Commit

Permalink
listrows type update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcflight committed Feb 29, 2024
1 parent 9b1a45f commit 0528de9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export type ListRowsOptions = {
[key: string]: unknown;
};

export type ListRowsResponse<T> = {
count: number;
next: null | string;
previous: null | string;
results: T[];
};

export type UpdateRowOptions = {
user_field_names?: boolean;
};
Expand Down Expand Up @@ -60,10 +67,13 @@ export class BaserowSdk {
public async listRows<T extends Record<string, unknown>>(
tableId: number,
options: ListRowsOptions = {},
): Promise<T[]> {
const { data } = await c.get<T[]>(`/database/rows/table/${tableId}/`, {
params: options,
});
): Promise<ListRowsResponse<T>> {
const { data } = await c.get<ListRowsResponse<T>>(
`/database/rows/table/${tableId}/`,
{
params: options,
},
);
return data;
}

Expand Down

0 comments on commit 0528de9

Please sign in to comment.