import { AsyncResult } from "../result.js"; import { HttpMethod, HttpOptions, HttpResponse, SafeJsonError } from "./types.js"; import { Options, OptionsInit, RetryObject } from "got"; import { ZodType, z } from "zod/v3"; //#region lib/util/http/http.d.ts interface InternalJsonUnsafeOptions { url: string | URL; httpOptions?: Opts; } interface InternalHttpOptions extends HttpOptions { json?: HttpOptions['body']; method?: HttpMethod; parseJson?: Options['parseJson']; } declare abstract class HttpBase { private readonly options; protected get baseUrl(): string | undefined; protected hostType: string; constructor(hostType: string, options?: HttpOptions); private request; private _normalizeOptions; /** * Returns Renovate extra options which needs to be removed before passing to got. * @returns extra Renovate options. */ protected extraOptions(): readonly string[]; protected processOptions(_url: URL, _options: InternalHttpOptions): void; protected handleError(_url: string | URL, _httpOptions: HttpOptions, err: Error): never; resolveUrl(requestUrl: string | URL, options?: HttpOptions | undefined): URL; protected calculateRetryDelay({ computedValue }: RetryObject): number; get(url: string, options?: HttpOptions): Promise>; head(url: string, options?: HttpOptions): Promise>; getText(url: string | URL, options?: HttpOptions): Promise>; getBuffer(url: string | URL, options?: HttpOptions): Promise>; protected requestJsonUnsafe(method: HttpMethod, { url, httpOptions: requestOptions }: InternalJsonUnsafeOptions): Promise>; private requestJson; private resolveArgs; getPlain(url: string, options?: Opts): Promise; /** * @deprecated use `getYaml` instead */ getYamlUnchecked(url: string, options?: Opts): Promise>; getYaml>(url: string, schema: Schema): Promise>>; getYaml>(url: string, options: Opts, schema: Schema): Promise>>; getYamlSafe, Schema extends ZodType = ZodType>(url: string, schema: Schema): AsyncResult, SafeJsonError>; getYamlSafe, Schema extends ZodType = ZodType>(url: string, options: Opts, schema: Schema): AsyncResult, SafeJsonError>; /** * Request JSON and return the response without any validation. * * The usage of this method is discouraged, please use `getJson` instead. * * If you're new to Zod schema validation library: * - consult the [documentation of Zod library](https://github.com/colinhacks/zod?tab=readme-ov-file#basic-usage) * - search the Renovate codebase for 'zod' module usage * - take a look at the `schema-utils.ts` file for Renovate-specific schemas and utilities */ getJsonUnchecked(url: string, options?: JSONOpts): Promise>; /** * Request JSON with a Zod schema for the response, * throwing an error if the response is not valid. * * @param url * @param schema Zod schema for the response */ getJson>(url: string, schema: Schema): Promise>>; getJson>(url: string, options: JSONOpts, schema: Schema): Promise>>; /** * Request JSON with a Zod schema for the response, * wrapping response data in a `Result` class. * * @param url * @param schema Zod schema for the response */ getJsonSafe, Schema extends ZodType>(url: string, schema: Schema): AsyncResult, SafeJsonError>; getJsonSafe, Schema extends ZodType>(url: string, options: JSONOpts, schema: Schema): AsyncResult, SafeJsonError>; /** * @deprecated use `head` instead */ headJson(url: string, httpOptions?: JSONOpts): Promise>; postJson(url: string, options?: JSONOpts): Promise>; postJson = ZodType>(url: string, schema: Schema): Promise>>; postJson = ZodType>(url: string, options: JSONOpts, schema: Schema): Promise>>; putJson(url: string, options?: JSONOpts): Promise>; putJson = ZodType>(url: string, schema: Schema): Promise>>; putJson = ZodType>(url: string, options: JSONOpts, schema: Schema): Promise>>; patchJson(url: string, options?: JSONOpts): Promise>; patchJson = ZodType>(url: string, schema: Schema): Promise>>; patchJson = ZodType>(url: string, options: JSONOpts, schema: Schema): Promise>>; deleteJson(url: string, options?: JSONOpts): Promise>; deleteJson = ZodType>(url: string, schema: Schema): Promise>>; deleteJson = ZodType>(url: string, options: JSONOpts, schema: Schema): Promise>>; stream(url: string, options?: HttpOptions): NodeJS.ReadableStream; getToml>(url: string, schema?: Schema): Promise>>; getToml>(url: string, options: JSONOpts, schema: Schema): Promise>>; } //#endregion export { HttpBase, InternalHttpOptions, InternalJsonUnsafeOptions }; //# sourceMappingURL=http.d.ts.map