mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-24 16:36:46 +00:00
26 lines
559 B
TypeScript
26 lines
559 B
TypeScript
import { getClient } from "../../client";
|
|
import { Database } from "./database";
|
|
import { User } from "../user";
|
|
|
|
export class Table {
|
|
constructor(
|
|
public id: number,
|
|
public name: string,
|
|
public database: Database
|
|
) {}
|
|
}
|
|
|
|
export async function createTable(
|
|
user: User,
|
|
tableName: string,
|
|
database: Database
|
|
): Promise<Table> {
|
|
const response: any = await getClient(user).post(
|
|
`database/tables/database/${database.id}/`,
|
|
{
|
|
name: tableName,
|
|
}
|
|
);
|
|
return new Table(response.data.id, response.data.name, database);
|
|
}
|