import { type BaseAnthropic } from "../client.js"; import { type PromiseOrValue } from "../internal/types.js"; import { type APIResponseProps, type WithRequestID } from "../internal/parse.js"; /** * A subclass of `Promise` providing additional helper methods * for interacting with the SDK. */ export declare class APIPromise extends Promise> { #private; private responsePromise; private parseResponse; private parsedPromise; constructor(client: BaseAnthropic, responsePromise: Promise, parseResponse?: (client: BaseAnthropic, props: APIResponseProps) => PromiseOrValue>); _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise; /** * Gets the raw `Response` instance instead of parsing the response * data. * * If you want to parse the response body but still get the `Response` * instance, you can use {@link withResponse()}. * * 👋 Getting the wrong TypeScript type for `Response`? * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` * to your `tsconfig.json`. */ asResponse(): Promise; /** * Gets the parsed response data, the raw `Response` instance and the ID of the request, * returned via the `request-id` header which is useful for debugging requests and resporting * issues to Anthropic. * * If you just want to get the raw `Response` instance without parsing it, * you can use {@link asResponse()}. * * 👋 Getting the wrong TypeScript type for `Response`? * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` * to your `tsconfig.json`. */ withResponse(): Promise<{ data: T; response: Response; request_id: string | null | undefined; }>; private parse; then, TResult2 = never>(onfulfilled?: ((value: WithRequestID) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise | TResult>; finally(onfinally?: (() => void) | undefined | null): Promise>; } //# sourceMappingURL=api-promise.d.ts.map