UNPKG

neverbounce

Version:

An API wrapper for the NeverBounce API

39 lines (38 loc) 1.56 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const HttpsClient_js_1 = __importDefault(require("./HttpsClient.js")); const VerificationObject_js_1 = __importDefault(require("./VerificationObject.js")); /** * Single email verification API endpoints */ class Single extends HttpsClient_js_1.default { /** * Performs the verification of a single email * @param email Email address to verify * @param address_info Whether to include address info in the response * @param credits_info Whether to include credits info in the response * @param timeout Timeout for the verification in milliseconds * @param historicalData Whether to leverage historical data * @returns Promise with verification object */ async check(email, address_info, credits_info, timeout, historicalData) { const data = { email, address_info: address_info || undefined, credits_info: credits_info || undefined, timeout: timeout || undefined }; if (historicalData !== undefined) { data.request_meta_data = { leverage_historical_data: historicalData ? 1 : 0 }; } const response = await this.request({ method: 'GET', path: 'single/check' }, data); return new VerificationObject_js_1.default(response); } } exports.default = Single;