/// import { URL } from 'url'; export * from 'cross-fetch'; export type FetchResponseOptions = { customErrorMessage?: string; timeout?: number; bodyLimit?: number; handlesBom?: boolean; }; /** * Process fetch http response * @param res - Response object * @param expectedStatusCode - Expected status code * @param errMsg - Error message if status code does not satisfy */ export declare function handleFetchResponse(res: Response, expectedStatusCode?: number | number[], options?: FetchResponseOptions): Promise; /** * Invoker for `fetch` */ export type InvokeFetch = (reqInfo?: RequestInfo, reqInit?: RequestInit) => Promise; /** * Interceptor for `fetch` */ export type FetchInterceptor = (next: InvokeFetch, info: RequestInfo | URL, init: RequestInit) => Promise; /** * Options to get an instance of `Fetch` */ export interface FetchOptions extends RequestInit { /** * An interceptor function that intercepts `fetch` */ interceptor?: FetchInterceptor; /** * Optional access token */ accessToken?: string; timeout?: number; } /** * Merge http request headers for fetch * @param headersList - A list of headers * @returns */ export declare function mergeHeaders(...headersList: (HeadersInit | undefined)[]): Headers; /** * Get an http client given options * @param options - Fetch options */ export declare function getFetch(options?: FetchOptions): typeof globalThis.fetch; /** * Get an http client with access token or authorization header * @param accessToken - Access token or authorization header * @param options - Got options */ export declare function getFetchWithAuth(accessToken: string, options?: FetchOptions): typeof globalThis.fetch; export interface JsonRpcResponse { jsonrpc: '2.0'; result?: T; error?: object; id: number; } /** * Invoke a json-rpc 2.0 method * @param url - URL of the json-rpc endpoint * @param method - Method name * @param params - An array of parameters * @param options - Http client options */ export declare function invokeJsonRpcFetch(url: string, method: string, params: unknown[], options?: FetchOptions): Promise; /** * Create a basic authorization header * @param id - Client id or user name * @param secret - Client secret or password * @returns */ export declare function buildBasicAuthHeader(id?: string, secret?: string, scheme?: string): string;