UNPKG

neverbounce

Version:

An API wrapper for the NeverBounce API

34 lines (33 loc) 1.26 kB
import HttpsClient from './HttpsClient.js'; import VerificationObject from './VerificationObject.js'; /** * Single email verification API endpoints */ class Single extends HttpsClient { /** * 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(response); } } export default Single;