import type { AnyStringRecord, ConstructorOf } from '../../@types'; import type { BiuRequestSupportEnvironments } from './const.request'; import type { ResponseUnion, ErrorResponseData } from '../response'; import type { BiuOptions } from './base.request'; interface StaticRequestEngineClass { /** * Indicate whether the class(constructor) is a request engine subclass. */ isRequestEngineClass: true; /** * Indicate which environment the request engine subclass is designed for. */ environment: BiuRequestSupportEnvironments; } export declare type ConstructorOfRequestEngine = ConstructorOf>, contexts: RequestEngineContexts ]> & StaticRequestEngineClass; /** * @param tar anything * @return whether the target is a RequestEngine Class */ export declare const isRequestEngineClass: = ErrorResponseData, SendData = any>(tar: any) => tar is ConstructorOfRequestEngine; /** * @param tar anything * @return whether the target is a RequestEngine instance */ export declare const isRequestEngine: = ErrorResponseData, SendData = any>(tar: any) => tar is RequestEngine; export interface RequestEngineContexts { resolve: (value: ResponseUnion | PromiseLike>) => void; reject: (reason?: any) => void; } /** * The Request Engine base class. Every Request Engine class should extend this class. * * There are four required properties or methods to be implemented: * * @member isRequestEngineClass - should be a `static get` property that always returns `true`. * @member environment - should be a `static get` property that indicates which environment the engine is designed for. * @member environment - should be a `get` property that indicates which environment the engine is designed for. * @member sendRequest - should be a `method` that actually handle the request, send request described by `this._options`, * then invoke `this._resolve` or `this._reject` according to the response. */ export declare abstract class RequestEngine { _options: Required>; _resolve: RequestEngineContexts['resolve']; _reject: RequestEngineContexts['reject']; constructor(options: Required>, contexts: RequestEngineContexts); static get isRequestEngineClass(): true; get isRequestEngine(): true; abstract get environment(): BiuRequestSupportEnvironments; abstract sendRequest(): this; formatParsedDataToResponse(parsedData: any): ResponseUnion; } export {}; //# sourceMappingURL=engine.request.d.ts.map