import { Interceptors } from './middleware/Interceptors'; import { RequestHeader, RequestHeaders, ResponseWrapper } from '../../types/request.types'; import { WithRequired } from '../../types'; import { AbstractEndpoint } from '../endpoint/AbstractEndpoint'; import { ClientConfig, ClientOptions, ClientRequest, EndpointPath, EndpointResponse, EndpointResponseBody, PaginatedEndpointResponse, Options, OptionsWithBody, OptionsWithoutBody } from './AbstractClient.types'; export declare const BASE_URL = "https://api.myparcel.nl"; export declare abstract class AbstractClient { /** * Interceptors for request and response. * * @protected */ interceptors: { request: Interceptors | OptionsWithoutBody>; response: Interceptors>>; }; /** * Executes the request. Should return a promise containing the response json as object. */ protected abstract request: ClientRequest; /** * Base URL to make requests to. * * @protected */ protected baseUrl: string; /** * Headers to use with requests. * * @protected */ protected headers: RequestHeaders; /** * @protected */ protected parameters: Record; /** * Additional client specific options. * * @protected */ protected options: ClientOptions; /** * Array of headers that are required. Client will throw an error if any are missing. * * @private */ private _requiredHeaders; protected constructor(config?: ClientConfig); get requiredHeaders(): (RequestHeader | string)[]; set requiredHeaders(value: (RequestHeader | string)[]); /** * Prepare and execute the final request and handle the response. */ doRequest(endpoint: E, options: Options): Promise>; getResponseBody(endpoint: E, response: EndpointResponse): EndpointResponse | PaginatedEndpointResponse; /** * Gets default and custom headers. * * @protected */ protected getHeaders(): RequestHeaders; /** * Uses the base url, endpoint and options to create the final request url. * * @protected */ protected createUrl(endpoint: E, options: Options): string; /** * Replace path variables in an url path. Deletes optional parameters if * they're not passed. * * @protected */ protected substitutePath(urlPath: string, pathVariables?: EndpointPath): string; /** * Validates headers passed in options. * * @protected */ protected validateHeaders(endpoint: E, options: WithRequired, 'headers'>): void; /** * Executes transformations on options before request. * * @protected */ protected normalizeOptions(endpoint: E, options: Options): WithRequired, 'headers'>; }