/** * INVYONE Template CRUD API 클라이언트 */ import { apiClient } from './client'; /** 템플릿 목록 조회 */ export async function getTemplateList(params?: Record): Promise> { const res = await apiClient.get('/templates', { params }); return res.data.data; } /** 템플릿 상세 조회 */ export async function getTemplateInfo(templateId: string): Promise | null> { const res = await apiClient.get(`/templates/${templateId}`); if (!res.data.success) return null; return res.data.data; } /** 템플릿 생성 — template_id 반환 */ export async function insertTemplate(data: Record): Promise> { const res = await apiClient.post('/templates', data); return res.data.data; } /** 템플릿 수정 */ export async function updateTemplate(templateId: string, data: Record): Promise { await apiClient.put(`/templates/${templateId}`, data); } /** 템플릿 게시 (draft → published) */ export async function publishTemplate(templateId: string): Promise { await apiClient.put(`/templates/${templateId}/publish`); } /** 템플릿 삭제 (소프트) */ export async function deleteTemplate(templateId: string): Promise { await apiClient.delete(`/templates/${templateId}`); }