import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs"; import * as core from "../../../../core/index.mjs"; import * as SarvamAI from "../../../index.mjs"; export declare namespace DocAiClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } export declare class DocAiClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: DocAiClient.Options); /** * Creates a direct-upload handle for a file to be processed later. * * **Flow:** * 1. Call this endpoint with the MIME type you will upload (e.g. `application/pdf`). * 2. Upload the file using the returned `method`, `url` and `headers` before `expires_at`. * 3. Pass the returned `upload_id` through the `upload_ids` field on a later digitise or extract job request. * * When `content_type` is set, the upload's `Content-Type` header must match it. * * @param {SarvamAI.DocAiPresignUploadRequest} request * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.TooManyRequestsError} * @throws {@link SarvamAI.ServiceUnavailableError} * * @example * await client.docAi.createUploadUrl() */ createUploadUrl(request?: SarvamAI.DocAiPresignUploadRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise; private __createUploadUrl; /** * Creates and starts a digitise job from files or pre-uploaded handles. Digitise converts documents into structured HTML or Markdown while preserving layout. * * **Input:** Exactly one of `file` and `upload_ids` must be provided. Use `POST /doc-ai/v1/job/upload` to obtain upload IDs. * * **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until a terminal status (`completed`, `partially_completed`, `failed`, `rejected`), then fetch output via the results or download-url endpoints. * * Digitise JSON results include blocks with text, tag and bounding box. * * @param {SarvamAI.DocAiDigitiseRequest} request * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.ContentTooLargeError} * @throws {@link SarvamAI.TooManyRequestsError} * @throws {@link SarvamAI.ServiceUnavailableError} * * @example * import { createReadStream } from "fs"; * await client.docAi.digitise({}) */ digitise(request: SarvamAI.DocAiDigitiseRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise; private __digitise; /** * Creates and starts an extract job from files or pre-uploaded handles. Extract pulls structured fields out of documents according to a schema. * * **Input:** Exactly one of `file` and `upload_ids` must be provided. * * **Schema:** exactly one of `schema` (inline JSON schema) and `config_id` (saved extraction configuration) is required. * * **Processing:** the job runs asynchronously. Poll `GET /doc-ai/v1/job/{job_id}/status` until a terminal status (`completed`, `partially_completed`, `failed`, `rejected`), then fetch output via the results or download-url endpoints. * * Extract results include `result`, plus `annotations` mirroring the result shape where every leaf has `confidence` and `sources`. * * @param {SarvamAI.DocAiExtractRequest} request * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.ForbiddenError} * @throws {@link SarvamAI.ContentTooLargeError} * @throws {@link SarvamAI.TooManyRequestsError} * @throws {@link SarvamAI.ServiceUnavailableError} * * @example * import { createReadStream } from "fs"; * await client.docAi.extract({}) */ extract(request: SarvamAI.DocAiExtractRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise; private __extract; /** * Returns a job's status and page-level usage. * * **Terminal statuses:** `completed`, `partially_completed`, `failed`, `rejected`. Results and download URLs are only available after the job reaches a terminal status. * * @param {string} job_id - The unique identifier of the job * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.NotFoundError} * * @example * await client.docAi.getStatus("job_id") */ getStatus(job_id: string, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise; private __getStatus; /** * Returns terminal job results. Results are never available while a job is running; requesting them before a terminal status returns `409`. * * **Digitise results** include `job_id`, `type`, `status`, `usage` and `documents`. * * **Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`. * * @param {string} job_id - The unique identifier of the job * @param {SarvamAI.DocAiGetResultsRequest} request * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.ConflictError} * * @example * await client.docAi.getResults("20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7", { * format: "json" * }) * * @example * await client.docAi.getResults("20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5", { * format: "json" * }) */ getResults(job_id: string, request?: SarvamAI.DocAiGetResultsRequest, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise; private __getResults; /** * Creates a download URL for a completed job's output. Download the output using the returned `method`, `url` and `headers` before `expires_at`. * * Requesting a download URL before the job reaches a terminal status returns `409`. * * @param {string} job_id - The unique identifier of the job * @param {DocAiClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.ConflictError} * * @example * await client.docAi.getDownloadUrl("job_id") */ getDownloadUrl(job_id: string, requestOptions?: DocAiClient.RequestOptions): core.HttpResponsePromise; private __getDownloadUrl; }