import { Plugin } from '@tinkoff/request-core'; import { Query, QuerySerializer } from '@tinkoff/request-url-utils'; import { HttpMethods } from './constants'; import type { Dispatcher, RequestDuplex } from 'undici/types'; declare module '@tinkoff/request-core/lib/types.h' { interface Request { httpMethod?: keyof typeof HttpMethods | typeof HttpMethods[keyof typeof HttpMethods] | 'get' | 'post' | 'put' | 'delete' | 'head' | 'patch'; url?: string; query?: Query; queryNoCache?: Query; headers?: object; type?: string; payload?: any; attaches?: any[]; timeout?: number; credentials?: RequestCredentials; /** * @deprecated use `credentials` instead */ withCredentials?: boolean; abortPromise?: Promise; signal?: AbortSignal; /** Fetch options */ referrerPolicy?: ReferrerPolicy; /** Priority Hints API, forwarded to fetch as-is. Browser-only effect; no-op in Node. */ priority?: 'auto' | 'high' | 'low'; referrer?: string; keepalive?: boolean; integrity?: string; mode?: RequestMode; redirect?: RequestRedirect; duplex?: RequestDuplex; } interface RequestErrorCode { ERR_HTTP_REQUEST_TIMEOUT: 'ERR_HTTP_REQUEST_TIMEOUT'; ERR_HTTP_ERROR: 'ERR_HTTP_ERROR'; ABORT_ERR: 'ABORT_ERR'; } } declare global { interface RequestInit { priority?: 'auto' | 'high' | 'low'; } } /** * Makes http/https request. * * requestParams: * httpMethod {string} [='get'] * url {string} * query {object} * queryNoCache {object} - query which wont be used in generating cache key * headers {object} * type {string} [='form'] * payload {object} * attaches {array} * timeout {number} * credentials {string} * abortPromise {Promise} * signal {AbortSignal} * * @param {agent} agent set custom agent for fetch in node js. The browser ignores this parameter. * @param {QuerySerializer} querySerializer function that will be used instead of default value to serialize query strings in url * @return {{init: init}} */ declare const _default: ({ agent, querySerializer, }?: { agent?: { http: Dispatcher; https: Dispatcher; }; querySerializer?: QuerySerializer; }) => Plugin; export default _default;