/*! * Copyright (c) 2020-2026 Digital Bazaar. All rights reserved. * Copyright (c) 2026 Interop Alliance (Conversion to Typescript). */ import type { KyInstance, Options as KyOptions, Input } from 'ky'; import { type Deferred } from './deferred.js'; export type { Input }; /** Signature of a node-agent to undici-dispatcher converter (or a no-op). */ export type ConvertAgentFn = (options: Record | undefined) => Record | undefined; /** Extended ky Options with legacy agent support and response-parsing control. */ export type HttpClientOptions = KyOptions & { /** @deprecated Pass an undici dispatcher via the `fetch` option instead. */ agent?: unknown; /** @deprecated Pass an undici dispatcher via the `fetch` option instead. */ httpsAgent?: unknown; /** Set to false to skip auto-parsing a JSON response body into `response.data`. */ parseBody?: boolean; }; /** A `Response` augmented with a `.data` property containing the parsed JSON body. */ export interface HttpResponse extends Response { readonly data?: unknown; } /** A callable http client with method shortcuts and `.create()`/`.extend()`. */ export interface HttpClient { (url: Input, options?: HttpClientOptions): Promise; get(url: Input, options?: HttpClientOptions): Promise; post(url: Input, options?: HttpClientOptions): Promise; put(url: Input, options?: HttpClientOptions): Promise; patch(url: Input, options?: HttpClientOptions): Promise; head(url: Input, options?: HttpClientOptions): Promise; delete(url: Input, options?: HttpClientOptions): Promise; /** Create a new instance with entirely fresh defaults (inherits nothing). */ create(options?: HttpClientOptions): HttpClient; /** Create a new instance that inherits this instance's defaults. */ extend(options?: HttpClientOptions): HttpClient; readonly stop: Promise; } export declare const DEFAULT_HEADERS: { readonly Accept: "application/ld+json, application/json"; }; export declare const kyOriginalPromise: Deferred; interface CreateInstanceOptions extends HttpClientOptions { convertAgent?: ConvertAgentFn; /** Internal: the parent ky-promise to inherit from (used by extend()). */ parent?: Deferred; } /** * Returns a custom HttpClient instance. Used to specify default headers and * other default overrides. * * @param options {CreateInstanceOptions} * @param [options.convertAgent] {ConvertAgentFn} - Agent converter (injected by entry points). * @param [options.parent] {Deferred} - Parent ky promise to inherit from. * @param [options.headers] {object} - Default header overrides. * @returns {HttpClient} Custom httpClient instance. */ export declare function createInstance({ convertAgent, parent, headers, ...params }?: CreateInstanceOptions): HttpClient; //# sourceMappingURL=httpClient.d.ts.map