import type { WithRawResponse } from "./RawResponse.js"; /** * A promise that returns the parsed response and lets you retrieve the raw response too. */ export declare class HttpResponsePromise extends Promise { private innerPromise; private unwrappedPromise; private constructor(); /** * Creates an `HttpResponsePromise` from a function that returns a promise. * * @param fn - A function that returns a promise resolving to a `WithRawResponse` object. * @param args - Arguments to pass to the function. * @returns An `HttpResponsePromise` instance. */ static fromFunction Promise>, T>(fn: F, ...args: Parameters): HttpResponsePromise; /** * Creates a function that returns an `HttpResponsePromise` from a function that returns a promise. * * @param fn - A function that returns a promise resolving to a `WithRawResponse` object. * @returns A function that returns an `HttpResponsePromise` instance. */ static interceptFunction Promise>, T = Awaited>["data"]>(fn: F): (...args: Parameters) => HttpResponsePromise; /** * Creates an `HttpResponsePromise` from an existing promise. * * @param promise - A promise resolving to a `WithRawResponse` object. * @returns An `HttpResponsePromise` instance. */ static fromPromise(promise: Promise>): HttpResponsePromise; /** * Creates an `HttpResponsePromise` from an executor function. * * @param executor - A function that takes resolve and reject callbacks to create a promise. * @returns An `HttpResponsePromise` instance. */ static fromExecutor(executor: (resolve: (value: WithRawResponse) => void, reject: (reason?: unknown) => void) => void): HttpResponsePromise; /** * Creates an `HttpResponsePromise` from a resolved result. * * @param result - A `WithRawResponse` object to resolve immediately. * @returns An `HttpResponsePromise` instance. */ static fromResult(result: WithRawResponse): HttpResponsePromise; private unwrap; /** @inheritdoc */ then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null): Promise; /** @inheritdoc */ catch(onrejected?: ((reason: unknown) => TResult | PromiseLike) | null): Promise; /** @inheritdoc */ finally(onfinally?: (() => void) | null): Promise; /** * Retrieves the data and raw response. * * @returns A promise resolving to a `WithRawResponse` object. */ withRawResponse(): Promise>; }