UNPKG

n8n-nodes-tess-ai-by-pareto

Version:

n8n community node for interacting with the Tess API by Pareto

22 lines (21 loc) 822 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.tessApiRequest = tessApiRequest; const node_fetch_1 = __importDefault(require("node-fetch")); async function tessApiRequest(method, endpoint, body = {}, token) { const response = await (0, node_fetch_1.default)(`https://api.tess.pareto.io${endpoint}`, { method, headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: method === 'GET' ? undefined : JSON.stringify(body) }); if (!response.ok) { throw new Error(`Tess API error: ${response.statusText}`); } return response.json(); }