import type { Options as GotOptions, OptionsInit as GotOptionsInit } from 'got'; import type { Options as KyOptions } from 'ky'; import type { Jsonifiable, Jsonify } from 'type-fest'; import type { OpenapiV3 } from '../../../types/openapi.type.js'; import type { GenericOutput, TypescriptOutput } from '../../cst/cst.js'; import { type Hooks, Node } from '../../cst/node.js'; import type { SchemaOptions } from '../base.js'; import { RestClientBuilder } from './builder.js'; export interface RestClientOptions { filename?: string | undefined; /** * Toggles whether the given operationId should be preferred over the generated value. * * @defaultValue true */ preferOperationId?: boolean; /** * @defaultValue false */ strict?: boolean; /** * Toggles whether optional fields will be allowed to be null. Some Rest APIs implicitly return null on optional fields. * * @defaultValue false */ optionalNullable?: boolean; /** * Toggle whether intersection types are allowed. In a lot of cases, intersection types aren't properly defined, and will break validation by jsonschema * You can choose to allow them, but keep in mind to verify the behavior. * * @defaultValue false */ allowIntersectionTypes?: boolean; /** * Toggles whether an Either interface is generated or exceptions are used. * * @defaultValue true */ useEither?: boolean; /** * Toggles whether the content type header should always be part of the request. * * @defaultValue false */ explicitContentNegotiation?: boolean; /** * Whether the validators should be compiled. * * @defaultValue undefined */ compile?: boolean; /** * Whether to check format types with https://ajv.js.org/packages/ajv-formats.html * @defaultValue true */ formats?: boolean; /** * Allows for a transformation of the standardized openapi schema (swagger gets automatically converted to * openapiv3). */ transformOpenapi?: (openapi: OpenapiV3) => OpenapiV3; /** * The client to use for the rest client. * * @defaultValue 'got' */ client?: 'got' | 'ky'; /** * Whether to use zod for the rest client. * * @defaultValue ajv */ validator?: 'zod/v3' | 'zod/v4' | 'ajv'; options?: Options; } export declare class RestclientType extends Node { _type: "restclient"; _children: Node[]; _options: RestClientOptions; _builder: RestClientBuilder; _canReference: false; private constructor(); static from(definition: OpenapiV3, options: SchemaOptions>): Promise>; targetPath(sourcePath: string): string; _hooks: Hooks; get _output(): (TypescriptOutput | GenericOutput)[]; } /** * Create a new `CustomType` instance with the given options. * * ### Example * ```ts * export const petStore = got .get('https://petstore3.swagger.io/api/v3/openapi.json') .json() .then((data) => $restclient(data, { strict: false })) * ``` * * @param schema - The JSON Draft 7 schema. * @param options - Additional options to pass to the tuple. * * @group Schema */ export declare function $restclient(definition: unknown, options?: Omit, 'options'> & { client?: 'got'; options?: Jsonify>; }): Promise; export declare function $restclient(definition: unknown, options: Omit, 'options'> & { client: 'ky'; options?: Jsonify>; }): Promise;