import api from "@/lib/api-client"; import { ITemplate } from "@/ee/template/types/template.types"; import { IPagination } from "@/lib/types.ts"; export async function getTemplates(params?: { spaceId?: string; cursor?: string; limit?: number; }): Promise> { const req = await api.post("/templates", params); return req.data; } export async function getTemplateById( templateId: string, ): Promise { const req = await api.post("/templates/info", { templateId }); return req.data; } export async function createTemplate( data: Partial, ): Promise { const req = await api.post("/templates/create", data); return req.data; } export async function updateTemplate( data: Partial & { templateId: string }, ): Promise { const req = await api.post("/templates/update", data); return req.data; } export async function deleteTemplate(templateId: string): Promise { await api.post("/templates/delete", { templateId }); } export async function useTemplate(data: { templateId: string; spaceId: string; parentPageId?: string; }): Promise { const req = await api.post("/templates/use", data); return req.data; }