/** * Extended Extend client with webhook utilities and polling methods. * This file is protected by .fernignore and will not be overwritten during regeneration. */ import { z } from "zod"; import { ExtendClient as FernClient } from "../Client"; import * as Extend from "../api"; import * as core from "../core"; import { ExtractRunsClient } from "./resources/extractRuns"; import { TypedExtractRun, TypedExtractorReference } from "./resources/extractRuns"; import { ExtractorsClient } from "./resources/extractors"; import { ExtractorVersionsClient } from "./resources/extractorVersions"; import { ClassifyRunsClient } from "./resources/classifyRuns"; import { SplitRunsClient } from "./resources/splitRuns"; import { WorkflowRunsClient } from "./resources/workflowRuns"; import { EditRunsClient } from "./resources/editRuns"; import { ParseRunsClient } from "./resources/parseRuns"; import { Webhooks } from "./webhooks"; import { TypedExtractConfig } from "./schema/configConversion"; /** * Typed extraction request with inline config for the sync extract() method. */ export interface TypedExtractRequestWithConfig extends Omit { config: TypedExtractConfig; extractor?: never; } /** * Typed extraction request with extractor.overrideConfig for the sync extract() method. */ export interface TypedExtractRequestWithExtractor extends Omit { extractor: TypedExtractorReference; config?: never; } /** * Union of typed extract request forms. */ export type TypedExtractRequest = TypedExtractRequestWithConfig | TypedExtractRequestWithExtractor; export declare namespace ExtendClient { type Options = FernClient.Options; type RequestOptions = FernClient.RequestOptions; } /** * The Extend API client with webhook utilities and polling methods. * * @example * ```typescript * import { ExtendClient, extendCurrency } from "extend-ai"; * import { z } from "zod"; * * const client = new ExtendClient({ token: "your-api-key" }); * * // Typed extraction with zod schema * const result = await client.extract({ * file: { url: "https://example.com/invoice.pdf" }, * config: { * schema: z.object({ * invoice_number: z.string().nullable(), * total: extendCurrency(), * }), * baseProcessor: "extraction_performance", * }, * }); * * // result.output.value is fully typed! * console.log(result.output.value.invoice_number); // string | null * console.log(result.output.value.total.amount); // number | null * * // Verify webhooks * const event = client.webhooks.verifyAndParse(body, headers, secret); * ``` */ export declare class ExtendClient extends FernClient { protected _extractRunsClient: ExtractRunsClient | undefined; protected _extractorsClient: ExtractorsClient | undefined; protected _extractorVersionsClient: ExtractorVersionsClient | undefined; protected _classifyRunsClient: ClassifyRunsClient | undefined; protected _splitRunsClient: SplitRunsClient | undefined; protected _workflowRunsClient: WorkflowRunsClient | undefined; protected _editRunsClient: EditRunsClient | undefined; protected _parseRunsClient: ParseRunsClient | undefined; readonly webhooks: Webhooks; get extractRuns(): ExtractRunsClient; get extractors(): ExtractorsClient; get extractorVersions(): ExtractorVersionsClient; get classifyRuns(): ClassifyRunsClient; get splitRuns(): SplitRunsClient; get workflowRuns(): WorkflowRunsClient; get editRuns(): EditRunsClient; get parseRuns(): ParseRunsClient; /** * Extract structured data from a file synchronously with optional typed schema support. * * When you pass a zod schema via `config.schema`, the returned `ExtractRun` * will have fully typed `output.value` based on your schema. * * **Note:** This endpoint waits for completion. For production workloads with large files, * consider using `extractRuns.create()` with webhooks or `extractRuns.createAndPoll()`. * * @example * ```typescript * import { ExtendClient, extendCurrency } from "extend-ai"; * import { z } from "zod"; * * const client = new ExtendClient({ token: "..." }); * * const result = await client.extract({ * file: { url: "https://example.com/invoice.pdf" }, * config: { * schema: z.object({ * invoice_number: z.string().nullable(), * total: extendCurrency(), * }), * baseProcessor: "extraction_performance", * }, * }); * * // result.output.value is fully typed! * console.log(result.output.value.invoice_number); // string | null * console.log(result.output.value.total.amount); // number | null * ``` */ extract(request: TypedExtractRequestWithConfig, requestOptions?: ExtendClient.RequestOptions): core.HttpResponsePromise>>>; extract(request: TypedExtractRequestWithExtractor, requestOptions?: ExtendClient.RequestOptions): core.HttpResponsePromise>>>; extract(request: Extend.ExtractRequest, requestOptions?: ExtendClient.RequestOptions): core.HttpResponsePromise; /** * Converts a potentially typed extract request to the standard API request format. */ private convertExtractRequest; }