UNPKG

fcx-minddale-ts

Version:

TypeScript client SDK for the headless micro CRM, Minddale.

31 lines (30 loc) 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MinddaleClient = void 0; const axios_1 = __importDefault(require("axios")); class MinddaleClient { constructor(apiKey, baseUrl, timeout) { this.client = axios_1.default.create({ timeout: timeout || MinddaleClient.TIMEOUT, baseURL: baseUrl || MinddaleClient.BASE_URL, headers: { 'Content-Type': 'application/json', Authorization: `Minddale ${apiKey}`, }, }); } async get(endpoint) { const response = await this.client.get(endpoint); return response.data; } async post(endpoint, data) { const response = await this.client.post(endpoint, data); return response.data; } } exports.MinddaleClient = MinddaleClient; MinddaleClient.TIMEOUT = 5000; MinddaleClient.BASE_URL = 'https://api.minddale.com';