Skip to main content
Version: v7.0.0

ClientInstance


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

Preview

class Client<GlobalErrorType, Adapter> {
constructor(options: ClientOptionsType<Client<GlobalErrorType, Adapter>>) {};
url: string;
unstable_onSuccessCallbacks: ResponseInterceptorType<ClientInstance>[];
unstable_onResponseCallbacks: ResponseInterceptorType<ClientInstance>[];
unstable_onRequestCallbacks: RequestInterceptorType[];
unstable_onErrorCallbacks: ResponseInterceptorType<ClientInstance>[];
unstable_onAuthCallbacks: RequestInterceptorType[];
submitDispatcher: Dispatcher<Adapter>;
requestManager: RequestManager;
plugins: PluginInstance[];
options: ClientOptionsType<Client<GlobalErrorType, Adapter>>;
loggerManager: LoggerManager;
logger: LoggerMethods;
isMockerEnabled: boolean;
fetchDispatcher: Dispatcher<Adapter>;
debug: boolean;
cache: Cache<Adapter>;
appManager: AppManager;
adapter: Adapter;
addPlugin(plugin: PluginInstance) => Client<GlobalErrorType, Adapter>;
clear() => void;
createRequest<RequestProperties>(_USE_DOUBLE_INITIALIZATION?: undefined) => <EndpointType, AdapterOptions, MethodType>(params: RequestOptionsType<EndpointType, AdapterOptions, MethodType>) => Request<TypeWithDefaults<RequestProperties, response, undefined, void>, TypeWithDefaults<RequestProperties, payload, undefined, void>, TypeWithDefaults<RequestProperties, queryParams, ExtractAdapterDefaultQueryParamsType<Adapter>, never>, TypeWithDefaults<RequestProperties, error, GlobalErrorType, void>, TypeWithDefaults<RequestProperties, endpoint, EndpointType, void> extends string ? string & TypeWithDefaults<RequestProperties, endpoint, EndpointType, void> : any, Client<GlobalErrorType, ExtractedAdapterType>, false, false, false>;
hydrate(hydrationData: (EmptyTypes | HydrateDataType)[], options?: Partial<HydrationOptions> | (item: HydrateDataType) => Partial<HydrationOptions>) => void;
onAuth(callback: RequestInterceptorType) => Client<GlobalErrorType, Adapter>;
onError<ErrorType>(callback: ResponseInterceptorType<ClientInstance, any, GlobalErrorType | ErrorType>) => Client<GlobalErrorType, Adapter>;
onRequest(callback: RequestInterceptorType) => Client<GlobalErrorType, Adapter>;
onResponse<ErrorType>(callback: ResponseInterceptorType<ClientInstance, any, GlobalErrorType | ErrorType>) => Client<GlobalErrorType, Adapter>;
onSuccess<ErrorType>(callback: ResponseInterceptorType<ClientInstance, any, GlobalErrorType | ErrorType>) => Client<GlobalErrorType, Adapter>;
removeOnAuthInterceptors(callbacks: RequestInterceptorType[]) => Client<GlobalErrorType, Adapter>;
removeOnErrorInterceptors(callbacks: ResponseInterceptorType<ClientInstance, any, (null | GlobalErrorType)>[]) => Client<GlobalErrorType, Adapter>;
removeOnRequestInterceptors(callbacks: RequestInterceptorType[]) => Client<GlobalErrorType, Adapter>;
removeOnResponseInterceptors(callbacks: ResponseInterceptorType<ClientInstance, any, (null | GlobalErrorType)>[]) => Client<GlobalErrorType, Adapter>;
removeOnSuccessInterceptors(callbacks: ResponseInterceptorType<ClientInstance, any, (null | GlobalErrorType)>[]) => Client<GlobalErrorType, Adapter>;
removePlugin(plugin: PluginInstance) => Client<GlobalErrorType, Adapter>;
setAbortKeyMapper(callback: (request: RequestInstance) => string) => Client<GlobalErrorType, Adapter>;
setAdapter<NewAdapter>(adapter: NewAdapter) => Client<GlobalErrorType, NewAdapter>;
setCacheKeyMapper(callback: (request: RequestInstance) => string) => Client<GlobalErrorType, Adapter>;
setDebug(enabled: boolean) => Client<GlobalErrorType, Adapter>;
setEnableGlobalMocking(isMockerEnabled: boolean) => Client<GlobalErrorType, Adapter>;
setLogLevel(severity: LogLevel) => Client<GlobalErrorType, Adapter>;
setLogger(callback: (Client: ClientInstance) => LoggerManager) => Client<GlobalErrorType, Adapter>;
setQueryKeyMapper(callback: (request: RequestInstance) => string) => Client<GlobalErrorType, Adapter>;
setRequestIdMapper(callback: (request: RequestInstance) => string) => Client<GlobalErrorType, Adapter>;
triggerPlugins<Key>(key: Key, data: PluginMethodParameters<Key, Client<Error, HttpAdapterType>>) => Client<GlobalErrorType, Adapter>;
}
On this page