neverbounce
Version:
An API wrapper for the NeverBounce API
73 lines (72 loc) • 2.17 kB
TypeScript
import { SingleVerificationResponse, VerificationFlags } from './types.js';
/**
* Verification Object class for handling verification results
*/
declare class VerificationObject {
private response;
/**
* Constructor
* @param response Verification response from API
*/
constructor(response: SingleVerificationResponse);
/**
* Get the full response object
* @returns The verification response
*/
getResponse(): SingleVerificationResponse;
/**
* Returns result
* @returns The verification result
*/
getResult(): string | number;
/**
* Returns text code
* @returns The numeric result code
*/
getNumericResult(): number | string;
/**
* Returns true if result is of specified types
* @param codes Verification result codes to check
* @returns Whether the result matches any of the specified codes
*/
is(codes: string | number | Array<string | number>): boolean;
/**
* Returns true if result is NOT of specified types
* @param codes Verification result codes to check
* @returns Whether the result does not match any of the specified codes
*/
not(codes: string | number | Array<string | number>): boolean;
/**
* Returns true if the flag was returned
* @param flag Flag to check
* @returns Whether the flag is present
*/
hasFlag(flag: string): boolean;
/**
* Result code constants
*/
static readonly valid: number;
static readonly invalid: number;
static readonly disposable: number;
static readonly catchall: number;
static readonly unknown: number;
/**
* Helper object for result codes and flags
* @since 4.1.4
*/
static readonly helpers: {
[key: string]: any;
[key: number]: string;
valid: number;
invalid: number;
disposable: number;
catchall: number;
unknown: number;
flags: VerificationFlags;
};
/**
* @deprecated 4.1.4 Will be removed in next minor release
*/
static readonly numericCodes: Record<string, number>;
}
export default VerificationObject;