import { ApiClient } from './ApiClient'; import { API_BASE_URLS } from './config'; export class TemplateServiceClient { private client: ApiClient; constructor() { this.client = new ApiClient(API_BASE_URLS.template); } async saveTemplate(data: { name: string; description: string; chart_configs: any[]; layout: any[]; theme: string; }): Promise { return this.client.post('/api/v1/templates', data); } async listTemplates(): Promise { return this.client.get('/templates'); } async getTemplate(id: string): Promise { return this.client.get(`/templates/${encodeURIComponent(id)}`); } async updateTemplate(id: string, data: any): Promise { return this.client.put( `/templates/${encodeURIComponent(id)}`, data, ); } async deleteTemplate(id: string): Promise { return this.client.delete(`/templates/${encodeURIComponent(id)}`); } async importTemplate(json: string): Promise { return this.client.post('/templates/import', JSON.parse(json)); } async exportTemplate(id: string): Promise { return this.client.get( `/templates/${encodeURIComponent(id)}/export`, ); } }