mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-28 22:42:26 +00:00
24 lines
582 B
TypeScript
24 lines
582 B
TypeScript
import { getClient } from "../../client"
|
|
import { Workspace } from "../workspace"
|
|
|
|
export class Automation {
|
|
constructor(
|
|
public id: number,
|
|
public name: string,
|
|
public workspace: Workspace
|
|
) {}
|
|
}
|
|
|
|
export async function createAutomation(
|
|
automationName: string,
|
|
workspace: Workspace
|
|
): Promise<Automation> {
|
|
const response: any = await getClient(workspace.user).post(
|
|
`applications/workspace/${workspace.id}/`,
|
|
{
|
|
name: automationName,
|
|
type: "automation",
|
|
}
|
|
)
|
|
return new Automation(response.data.id, response.data.name, workspace)
|
|
}
|