UNPKG

neverbounce

Version:

An API wrapper for the NeverBounce API

34 lines (33 loc) 1.17 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const NeverBounce_js_1 = __importDefault(require("../src/NeverBounce.js")); const dotenv_1 = __importDefault(require("dotenv")); // Load environment variables from .local.env file dotenv_1.default.config(); // Initialize NeverBounce client with API key from environment variables const client = new NeverBounce_js_1.default({ apiKey: process.env.NEVERBOUNCE_API_KEY }); // Get account info client.account.info() .then((resp) => console.log('[THEN]', resp)) .catch((err) => console.log('[THEN] ERROR: ' + err.message)); // Alternative using async/await async function getAccountInfo() { try { const info = await client.account.info(); console.log('[ASYNC] Account Info:', info); } catch (err) { if (err instanceof Error) { console.error('[ASYNC] Error:', err.message); } else { console.error('[ASYNC] Unknown error occurred'); } } } getAccountInfo();