import type { Hookable } from 'hookable'; import type { FetchContext, FetchError, FetchOptions } from 'ofetch'; import type { ErrorResponse, MediaType, OkStatus, OperationRequestBodyContent, ResponseContent, ResponseObjectMap, SuccessResponse } from 'openapi-typescript-helpers'; export type FetchResponseData, Media extends MediaType = MediaType> = SuccessResponse, Media>; export type FetchResponseError> = FetchError, MediaType>>; export type MethodOption = 'get' extends keyof P ? { method?: M; } : { method: M; }; export type ParamsOption = T extends { parameters?: any; query?: any; } ? T['parameters'] : Record; export type RequestBodyOption = OperationRequestBodyContent extends never ? { body?: never; } : undefined extends OperationRequestBodyContent ? { body?: OperationRequestBodyContent; } : { body: OperationRequestBodyContent; }; export interface AcceptMediaTypeOption { accept?: M | M[]; } export interface BodySerializerOption { bodySerializer?: (body: TBody) => any; } export type FilterMethods = { [K in keyof Omit as T[K] extends never | undefined ? never : K]: T[K]; }; export type ExtractMediaType = ResponseObjectMap extends Record ? { [S in OkStatus]: Extract[S]>, MediaType>; }[OkStatus] : never; type OpenFetchOptions = MethodOption & ParamsOption & RequestBodyOption & AcceptMediaTypeOption & Omit & BodySerializerOption['body']>; export type OpenFetchClient = , Methods extends FilterMethods, Method extends Extract | Uppercase>, LowercasedMethod extends (Lowercase extends keyof Methods ? Lowercase : never), DefaultMethod extends ('get' extends LowercasedMethod ? 'get' : LowercasedMethod), Media extends ExtractMediaType, ResT = Methods[DefaultMethod] extends Record ? FetchResponseData : never>(url: ReqT, options?: OpenFetchOptions) => Promise; export declare function openFetchRequestInterceptor(ctx: FetchContext): void; export declare function createOpenFetch(options: FetchOptions | ((options: FetchOptions) => FetchOptions), localFetch?: typeof globalThis.$fetch, hookIdentifier?: string, hooks?: Hookable | null): OpenFetchClient; export declare function fillPath(path: string, params?: Record): string; export {};