import { HttpExceptionHandler, HandleHttpExceptionOutput } from './exception/exception-handlers'; import { PublicApiClientException } from './exception'; export declare enum HttpClientSecurity { TOKEN = "token", API_KEY = "apikey" } export declare type Headers = Record; export declare abstract class AbstractHttpClient { /** * Base path for HTTP calls */ protected basePath: string; /** * Current path for HTTP calls */ protected path: string; /** * Token to authenticate the user */ protected token: string; /** * ArrowSphere API URL */ protected url: string; /** * Defines header information for http requests */ protected headers: Headers; /** * Http Exceptions Handlers */ protected httpExceptionHandlers: HttpExceptionHandler[]; /** * Security used to auth on server * Default to API_KEY to handle * the existing codebase */ protected security: HttpClientSecurity; setToken(token: string): this; setUrl(url: string): this; setSecurity(security: HttpClientSecurity): this; /** * Warning: can remove useful headers, prefer use mergeHeaders() * @param headers - Set headers information */ setHeaders(headers: Record): this; /** * Will merge existing headers with those in parameters. * If There is key equality, the header passed as parameter has priority. * @param headers - Merge headers information */ mergeHeaders(headers: Record): this; removeHeader(headerKey: string): this; /** * Allow to register error/exception handler. * Handlers can be developed in another projects as long as they respect the interface HttpExceptionHandler. */ registerHttpExceptionHandler(handler: HttpExceptionHandler): this; /** * Allow to set error handlers. */ setHttpExceptionHandlers(handlers: HttpExceptionHandler[]): this; /** * Will find appropriate ErrorHandlers and apply them to the error in order of registering. */ protected handleError(error: PublicApiClientException): Promise; protected mapToPublicApiException(error: any): PublicApiClientException; }