import { QueryString } from "./helpers/utils"; import HttpHeaders from "./http/http-headers"; export declare type Txt = string | number | boolean; export declare type BodyParser = "json" | "text" | "formData" | "arrayBuffer" | "blob"; export declare type HttpMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD"; export declare type RawHeaders = { [key: string]: Txt; }; export declare type HermesResponse = { error: null; headers: { [key: string]: string; }; readonly data: Body; readonly ok: true; readonly redirected: boolean; readonly status: number; readonly statusText: string; readonly type: ResponseType; readonly url: string; } | { error: string | number | null; headers: { [key: string]: string; }; readonly data: Body; readonly ok: false; readonly redirected: boolean; readonly status: number; readonly statusText: string; readonly type: ResponseType; readonly url: string; }; export declare type InterceptedRequest = { abort: boolean; request: FetchParams; }; export declare type RequestInterceptor = (request: FetchParams) => Promise; export declare type SuccessInterceptor = (response: HermesResponse) => Promise>; export declare type ErrorInterceptor = (response: HermesResponse) => Promise>; export declare type FetchParams = { body?: any; method?: HttpMethods; cache?: RequestCache; statusCodeRetry?: number[]; controller?: AbortController; cors?: "same-origin" | "cors" | "no-cors"; credentials?: "include" | "omit" | "same-origin"; headers?: HttpHeaders; query?: QueryString; redirect?: "follow" | "error" | "manual"; referrer?: string; referrerPolicy?: ReferrerPolicy; retries?: number; retryInterval?: number; timeout?: number; avoidDuplicateRequests?: boolean; }; export declare type Interceptor = (response: HermesResponse | HermesResponse) => Promise | HermesResponse>; export declare type Config = Partial<{ baseUrl: string; avoidDuplicateRequests: boolean; }> & Omit; export declare type RequestConfig = Partial<{ method: HttpMethods; query: QueryString<{ [key: string]: string; }>; headers: HttpHeaders; avoidDuplicateRequests?: boolean; }> & Omit; declare global { namespace NodeJS { interface Global { fetch: typeof fetch & { Request: Omit & { method: HttpMethods; }; Response: Response; }; Headers: Headers; Request: Omit & { method: HttpMethods; }; Response: Response; AbortController: AbortController; } } } export declare type HermesClient = ((url: string, params: FetchParams) => Promise>) & { get: (url: string, params: FetchParams) => Promise>; post: (url: string, body: any, params: FetchParams) => Promise>; put: (url: string, body: any, params: FetchParams) => Promise>; patch: (url: string, body: any, params: FetchParams) => Promise>; delete: (url: string, params: FetchParams) => Promise>; }; //# sourceMappingURL=types.d.ts.map