UNPKG

plazbot

Version:

Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.

35 lines (34 loc) 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Template = void 0; const http_1 = require("./http"); class Template extends http_1.PlazbotHttp { constructor(options) { super(options); } async getTemplates() { const response = await this.http.get('/api/template', { params: { workspaceId: this.workspaceId }, }); this.throwIfError(response, 'Error retrieving templates'); return response.data; } async getActiveTemplates() { const response = await this.http.get('/api/template/actives', { params: { workspaceId: this.workspaceId }, }); this.throwIfError(response, 'Error retrieving active templates'); return response.data; } async getTemplate(id) { if (!id) { throw new Error("Template ID is required."); } const response = await this.http.get(`/api/template/${id}`, { params: { workspaceId: this.workspaceId }, }); this.throwIfError(response, 'Error retrieving template'); return response.data; } } exports.Template = Template;