Skip to main content
Version: v7.0.0

AdapterInstance

Base Adapter


Import
import { AdapterInstance } from "@hyper-fetch/core"

Preview

class Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType> {
constructor(options: { defaultExtra: Extra; defaultMethod: MethodType; defaultRequestOptions?: RequestOptionsType<EndpointType, AdapterOptions, MethodType>; name: string; systemErrorExtra: Extra; systemErrorStatus: StatusType }) {};
unstable_queryParamsMapperConfig: Parameters<QueryParamsMapperType>[1];
unstable_queryParamsMapper: QueryParamsMapperType;
unstable_payloadMapperConfig: Parameters<PayloadMapperType>[1];
unstable_payloadMapper: PayloadMapperType;
unstable_headerMapperConfig: Parameters<HeaderMapperType>[1];
unstable_headerMapper: HeaderMapperType;
unstable_endpointMapperConfig: Parameters<EndpointMapperType>[1];
unstable_endpointMapper: EndpointMapperType;
systemErrorStatus: StatusType;
systemErrorExtra: Extra;
options: { defaultExtra: Extra; defaultMethod: MethodType; defaultRequestOptions?: RequestOptionsType<EndpointType, AdapterOptions, MethodType>; name: string; systemErrorExtra: Extra; systemErrorStatus: StatusType };
name: string;
logger: LoggerMethods;
initialized: boolean;
defaultRequestOptions: RequestOptionsType<EndpointType, AdapterOptions, MethodType>;
defaultMethod: MethodType;
defaultExtra: Extra;
client: ClientInstance;
unstable_devtoolsEndpointGetter() => (endpoint: string) => string;
unstable_fetcher() => AdapterFetcherType<Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>>;
unstable_getAdapterDefaults() => (request: ExtendRequest<RequestInstance, { client: Client<any, Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>> }>) => AdapterOptions;
unstable_getRequestDefaults() => (options: RequestOptionsType<EndpointType, AdapterOptions, MethodType>) => Partial<RequestOptionsType<EndpointType, AdapterOptions, MethodType>>;
unstable_internalErrorMapping() => (error: TimeoutError | AbortError | DeletedError | RequestProcessingError | UnexpectedError) => any;
unstable_onInitializeCallback() => (options: { client: ClientInstance }) => void;
fetch(request: ExtendRequest<RequestInstance, { client: Client<any, Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>> }>, requestId: string) => Promise<RequestResponseType<RequestInstance>>;
initialize(client: ClientInstance) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
onInitialize(callback: (options: { client: ClientInstance }) => void) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setAdapterDefaults(callback: (request: ExtendRequest<RequestInstance, { client: Client<any, Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>> }>) => AdapterOptions) => this;
setDefaultExtra(extra: Extra) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setDefaultMethod(method: MethodType) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setDevtoolsEndpointGetter(callback: (endpoint: string) => string) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setEndpointMapper<NewEndpointMapper>(endpointMapper: NewEndpointMapper) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, NewEndpointMapper, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setEndpointMapperConfig<NewEndpointMapperConfig>(config: NewEndpointMapperConfig) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setFetcher(fetcher: AdapterFetcherType<Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>>) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setHeaderMapper<NewMapper>(headerMapper: NewMapper) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, NewMapper, PayloadMapperType>;
setHeaderMapperConfig<NewHeaderMapperConfig>(config: NewHeaderMapperConfig) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setInternalErrorMapping(callback: (error: TimeoutError | AbortError | DeletedError | RequestProcessingError | UnexpectedError) => any) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setPayloadMapper<NewMapper>(payloadMapper: NewMapper) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, NewMapper>;
setPayloadMapperConfig<NewPayloadMapperConfig>(config: NewPayloadMapperConfig) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setQueryParamsMapper<NewQueryParamsMapper>(queryParamsMapper: NewQueryParamsMapper) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, NewQueryParamsMapper, HeaderMapperType, PayloadMapperType>;
setQueryParamsMapperConfig<NewQueryParamsMapperConfig>(config: NewQueryParamsMapperConfig) => Adapter<AdapterOptions, MethodType, StatusType, Extra, QueryParams, DefaultQueryParams, EndpointType, EndpointMapperType, QueryParamsMapperType, HeaderMapperType, PayloadMapperType>;
setRequestDefaults(callback: undefined | (options: RequestOptionsType<EndpointType, AdapterOptions, MethodType>) => Partial<RequestOptionsType<EndpointType, AdapterOptions, MethodType>>) => this;
}
On this page