/** * Extended Extractors client with Zod schema support. * * Allows passing Zod schemas in the `config.schema` field for * `create()` and `update()` methods. The Zod schema is automatically * converted to JSON Schema before sending to the API. * * @example * ```typescript * import { ExtendClient, extendDate, extendCurrency } from "extend-ai"; * import { z } from "zod"; * * const client = new ExtendClient({ token: "..." }); * * const extractor = await client.extractors.create({ * name: "Invoice Extractor", * config: { * schema: z.object({ * vendor: z.string().nullable(), * invoice_date: extendDate(), * total: extendCurrency(), * }), * }, * }); * ``` */ import { z } from "zod"; import { ExtractorsClient as GeneratedExtractorsClient } from "../../../api/resources/extractors/client/Client"; import * as Extend from "../../../api"; import * as core from "../../../core"; import { TypedExtractConfig } from "../../schema/configConversion"; /** * Extractor create request with a typed Zod schema in config. * * Note: `cloneExtractorId` is excluded because it is mutually exclusive with `config`. * The API will reject requests that provide both. */ export interface TypedExtractorsCreateRequest extends Omit { /** The configuration for the extractor, with a Zod schema. */ config: TypedExtractConfig; } /** * Extractor update request with a typed Zod schema in config. */ export interface TypedExtractorsUpdateRequest extends Omit { /** The new configuration for the extractor, with a Zod schema. */ config: TypedExtractConfig; } export declare class ExtractorsClient extends GeneratedExtractorsClient { /** * Create a new extractor. * * Accepts a Zod schema in `config.schema` which will be automatically * converted to JSON Schema before sending to the API. * * @example * ```typescript * // With Zod schema * const extractor = await client.extractors.create({ * name: "Invoice Extractor", * config: { * schema: z.object({ * vendor: z.string().nullable(), * total: extendCurrency(), * }), * }, * }); * * // With JSON Schema (standard) * const extractor = await client.extractors.create({ * name: "Invoice Extractor", * config: { * schema: { type: "object", properties: { vendor: { type: "string" } } }, * }, * }); * ``` */ create(request: TypedExtractorsCreateRequest, requestOptions?: GeneratedExtractorsClient.RequestOptions): core.HttpResponsePromise; create(request: Extend.ExtractorsCreateRequest, requestOptions?: GeneratedExtractorsClient.RequestOptions): core.HttpResponsePromise; /** * Update an existing extractor. * * Accepts a Zod schema in `config.schema` which will be automatically * converted to JSON Schema before sending to the API. * * @example * ```typescript * const extractor = await client.extractors.update("ex_abc123", { * config: { * schema: z.object({ * vendor: z.string().nullable(), * total: extendCurrency(), * }), * }, * }); * ``` */ update(id: string, request: TypedExtractorsUpdateRequest, requestOptions?: GeneratedExtractorsClient.RequestOptions): core.HttpResponsePromise; update(id: string, request?: Extend.ExtractorsUpdateRequest, requestOptions?: GeneratedExtractorsClient.RequestOptions): core.HttpResponsePromise; /** * Converts a potentially typed create request to the standard API request format. */ private convertCreateRequest; /** * Converts a potentially typed update request to the standard API request format. */ private convertUpdateRequest; }