UNPKG

neverbounce

Version:

An API wrapper for the NeverBounce API

97 lines (96 loc) 3.57 kB
import HttpsClient from './HttpsClient.js'; import { ApiResponse, JobCreationResponse, JobDeleteResponse, JobDownloadRequest, JobResultsRequest, JobResultsResponse, JobSearchRequest, JobSearchResponse, JobStatusResponse } from './types.js'; /** * Jobs API endpoints */ declare class Jobs extends HttpsClient { /** * Search for jobs * @param query Search query parameters * @returns Promise with search results */ search(query?: JobSearchRequest): Promise<JobSearchResponse>; /** * Creates a job * @param input Input data (array of emails or remote URL) * @param inputlocation Input location type ('remote_url' or 'supplied') * @param filename Filename for the job * @param runsample Whether to run a sample * @param autoparse Whether to automatically parse * @param autostart Whether to automatically start * @param historicalData Whether to leverage historical data * @param allowManualReview Whether to allow manual review * @param callbackUrl URL to call when job completes * @param callbackHeaders Headers to include in callback request * @returns Promise with job creation response */ create(input: any[] | string, inputlocation?: string, filename?: string, runsample?: boolean, autoparse?: boolean, autostart?: boolean, historicalData?: boolean, allowManualReview?: boolean, callbackUrl?: string, callbackHeaders?: Record<string, string>): Promise<JobCreationResponse>; /** * Starts parsing job after creation * @param jobid Job ID * @param autostart Whether to automatically start * @returns Promise with parse response */ parse(jobid: number, autostart?: boolean): Promise<ApiResponse>; /** * Starts job waiting to be started * @param jobid Job ID * @param runsample Whether to run a sample * @param allowManualReview Whether to allow manual review * @returns Promise with start response */ start(jobid: number, runsample?: boolean, allowManualReview?: boolean): Promise<ApiResponse>; /** * Gets job status * @param jobid Job ID * @returns Promise with job status */ status(jobid: number): Promise<JobStatusResponse>; /** * Retrieves job results * @param jobid Job ID * @param query Additional query parameters * @returns Promise with job results */ results(jobid: number, query?: Omit<JobResultsRequest, 'job_id'>): Promise<JobResultsResponse>; /** * Downloads results as CSV * @param jobid Job ID * @param query Additional query parameters * @returns Promise with CSV data */ download(jobid: number, query?: Omit<JobDownloadRequest, 'job_id'>): Promise<string>; /** * Deletes a job * @param jobid Job ID * @returns Promise with delete response */ delete(jobid: number): Promise<JobDeleteResponse>; /** * Job input type constants */ static readonly remote: string; static readonly supplied: string; /** * Helper object for job types and statuses * @since 4.1.4 */ static readonly helpers: { inputType: { remote: string; supplied: string; }; status: { under_review: string; queued: string; failed: string; complete: string; running: string; parsing: string; waiting: string; waiting_analyzed: string; uploading: string; }; }; } export default Jobs;