import type { DocumentIntelligenceClient } from "./client/Client.mjs"; import type * as SarvamAI from "../../index.mjs"; export interface DocumentIntelligenceJobOptions { /** Language code (e.g., "hi-IN", "en-IN") */ language?: SarvamAI.DocDigitizationSupportedLanguage; /** Output format ("html", "md", or "json") */ outputFormat?: SarvamAI.DocDigitizationOutputFormat; /** Webhook callback URL */ callbackUrl?: string; /** Polling interval in milliseconds for waitUntilComplete (default: 2000) */ pollingIntervalMs?: number; /** Maximum polling attempts for waitUntilComplete (default: 150 = 5 minutes at 2s intervals) */ maxPollingAttempts?: number; } export interface PageMetrics { totalPages: number; pagesProcessed: number; pagesSucceeded: number; pagesFailed: number; pageErrors: SarvamAI.DocDigitizationPageError[]; } /** * A convenience wrapper around a Document Intelligence job that provides * a fluent API matching the Python SDK. * * @example * ```typescript * const job = await client.documentIntelligence.createJob({ * language: "hi-IN", * outputFormat: "html" * }); * * await job.uploadFile("./document.pdf"); * await job.start(); * const status = await job.waitUntilComplete(); * const metrics = job.getPageMetrics(); * await job.downloadOutput("./output.html"); * ``` */ export declare class DocumentIntelligenceJob { private _client; private _jobId; private _status; private _pollingIntervalMs; private _maxPollingAttempts; constructor(client: DocumentIntelligenceClient, jobId: string, options?: DocumentIntelligenceJobOptions); /** The unique job ID */ get jobId(): string; /** Alias for jobId (Python SDK compatibility) */ get job_id(): string; /** The last fetched status (may be null if not yet polled) */ get status(): SarvamAI.DocDigitizationJobStatusResponse | null; /** * Upload a file to the job using a presigned URL. * Supports file path (Node.js) or File/Blob (browser). */ uploadFile(file: string | File | Blob): Promise; /** * Start processing the job. */ start(): Promise; /** * Get the current status of the job. */ getStatus(): Promise; /** * Poll until the job completes (Completed, PartiallyCompleted, or Failed). */ waitUntilComplete(): Promise; /** * Get page-level metrics from the last status. */ getPageMetrics(): PageMetrics; /** * Download the output file(s) to the specified path. * The output is a ZIP file containing the processed documents. * * @param outputPath - Path where the output file will be saved * @returns The path to the downloaded file */ downloadOutput(outputPath: string): Promise; /** * Get download links for the output files. */ getDownloadLinks(): Promise; private _sleep; }