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 DocumentTranslationClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } export declare class DocumentTranslationClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: DocumentTranslationClient.Options); /** * ## Document Translation * * Create a document translation job. Returns a `job_id` and a short-lived signed `upload_url`. * * **Flow:** * 1. `POST /translate/document/jobs` with source/target languages and options. * 2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: `. * 3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline. * 4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes. * 5. `POST /translate/document/jobs/{job_id}/export?lang=` to enqueue an async export for each target language (exports in the uploaded file's format by default). * 6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`. * * A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response. * * @param {SarvamAI.CreateDocumentJobRequest} request * @param {DocumentTranslationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.documentTranslation.create({ * job_name: "chapter1", * source_language_code: "en-IN", * target_language_codes: ["hi-IN", "ta-IN"], * original_filename: "chapter1.pdf", * genre: "NON_FICTION", * use_native_numerals: true * }) */ create(request: SarvamAI.CreateDocumentJobRequest, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise; private __create; /** * Start the translation pipeline after the file has been uploaded to the signed `upload_url`. Idempotent. * * @param {string} job_id - The `job_id` returned by POST /translate/document/jobs. * @param {DocumentTranslationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.PaymentRequiredError} * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.documentTranslation.start("550e8400-e29b-41d4-a716-446655440000") */ start(job_id: string, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise; private __start; /** * Poll the progress of a document translation job. * * @param {string} job_id - The `job_id` returned by POST /translate/document/jobs. * @param {DocumentTranslationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.documentTranslation.getLiveStatus("550e8400-e29b-41d4-a716-446655440000") * * @example * await client.documentTranslation.getLiveStatus("660e8400-e29b-41d4-a716-446655440001") */ getLiveStatus(job_id: string, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise; private __getLiveStatus; /** * Enqueue an async export for one target language. * * Returns `202 Accepted` with `export_state=Pending`. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`. * * - When `format` is omitted, the export uses the uploaded file's native format. * - **PDF uploads** may optionally set `format` to `pdf`, `docx`, `html`, `txt`, or `epub`. * - **Microsoft Office uploads** always export in the original format only (for example, xlsx in → xlsx out). * - Optional `fit_line_height` / `fit_font_shrink` tune PDF/DOCX shrink-to-fit. * - Returns `409` when an export for the same language and format is already `Pending` or `Running`. * * @param {string} job_id - The `job_id` returned by POST /translate/document/jobs. * @param {SarvamAI.DocumentTranslationTriggerExportRequest} request * @param {DocumentTranslationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.ConflictError} * @throws {@link SarvamAI.InternalServerError} * @throws {@link SarvamAI.ServiceUnavailableError} * * @example * await client.documentTranslation.triggerExport("550e8400-e29b-41d4-a716-446655440000", { * lang: "hi-IN" * }) */ triggerExport(job_id: string, request: SarvamAI.DocumentTranslationTriggerExportRequest, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise; private __triggerExport; /** * Poll async export status and retrieve a signed `download_url` when `export_state` is `Completed`. * * Provide either `export_id` (from the trigger response) or `lang` (returns the latest export for that language). * * > Signed download URLs are time-limited (~24h). Re-fetch this endpoint for a fresh URL rather than caching long-term. * * @param {string} job_id - The `job_id` returned by POST /translate/document/jobs. * @param {SarvamAI.DocumentTranslationGetExportStatusRequest} request * @param {DocumentTranslationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link SarvamAI.BadRequestError} * @throws {@link SarvamAI.UnauthorizedError} * @throws {@link SarvamAI.NotFoundError} * @throws {@link SarvamAI.InternalServerError} * * @example * await client.documentTranslation.getExportStatus("550e8400-e29b-41d4-a716-446655440000", { * export_id: "exp_1a2b3c4d" * }) * * @example * await client.documentTranslation.getExportStatus("550e8400-e29b-41d4-a716-446655440000", { * lang: "hi-IN" * }) */ getExportStatus(job_id: string, request?: SarvamAI.DocumentTranslationGetExportStatusRequest, requestOptions?: DocumentTranslationClient.RequestOptions): core.HttpResponsePromise; private __getExportStatus; }