Skip to content

Commit

Permalink
Merge pull request #9 from narthur/return-types
Browse files Browse the repository at this point in the history
Revert "Revert "add return types""
  • Loading branch information
narthur committed Mar 14, 2024
2 parents b92aa3d + 043a61c commit 119b812
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ export class BaserowSdk {
c.defaults.headers.common["Authorization"] = `Token ${databaseToken}`;
}

public async addRow<T extends Record<string, unknown>>(
tableId: number,
input: T,
options: AddRowOptions = {},
): Promise<T> {
const { data } = await c.post<T>(
public async addRow<
T extends Record<string, unknown>,
R extends Record<string, unknown>,
>(tableId: number, input: T, options: AddRowOptions = {}): Promise<R> {
const { data } = await c.post<R>(
`/database/rows/table/${tableId}/`,
input,
{ params: options },
Expand Down Expand Up @@ -77,13 +76,16 @@ export class BaserowSdk {
return data;
}

public async updateRow<T extends Record<string, unknown>>(
public async updateRow<
T extends Record<string, unknown>,
R extends Record<string, unknown>,
>(
tableId: number,
rowId: number,
input: T,
options: UpdateRowOptions = {},
): Promise<T> {
const { data } = await c.patch<T>(
): Promise<R> {
const { data } = await c.patch<R>(
`/database/rows/table/${tableId}/${rowId}/`,
input,
{ params: options },
Expand Down

0 comments on commit 119b812

Please sign in to comment.