import { Logger } from '@4lch4/logger'; import { IAppConfig, IBaseQueryParameters, IBaseResponseData, IResponse } from '../interfaces/index.js'; export declare class BaseRoute { /** An instance of my logger utility so each route has access. */ protected logger: Logger; /** The object containing the config properties used by the library. */ protected config: IAppConfig; /** * The instance of Axios that is used for sending requests. It's a private * property so that it can't be modified by any of the routes which extend * this class. */ private client; constructor(config: IAppConfig); /** * Displays all of the usual content of the response object to the console. * This includes the `config`, `data`, `headers`, `request`, `status`, and * `statusText` properties. * * @param res The response object to display. */ private displayResponseObject; /** * Creates an object containing, at least, the `api_key` and `format` * properties from the `config` object, and then adds any additional values * from the user provided `params` object with any duplicate values replacing * the existing values. * * @param params The optional params object provided by the user. * @returns An object containing, at least, the API key and format for the request. */ private getRequestQueryParams; /** * Creates and returns an IRequestConfig object, which extends * `AxiosRequestConfig`, using the provided parameters * * @param method The HTTP method to use for the request. * @param endpoint The endpoint to send the request to. * @param queryParams Any additional parameters to send with the request. * * @returns The IRequestConfig object to pass to Axios for the request. */ private getRequestOptions; /** * Determines what kind of data to return, by checking the value of the * `responseFormat` property of the `config` object, and then returns the * response data in the appropriate format based on the following: * * If the `trimmedResponses` property of the `config` object is set to `true` * (the default value) then only the `data`, `status`, and * `statusText` properties of the response are returned. Otherwise, the * entire response object is returned. * * **_NOTE: The `D` generic type is used to specify the type of data that is * expected to be returned from the API._** * * @param res The AxiosResponse object returned from the API. * * @returns The response data from the API in the format specified in the app config. */ private returnResponse; /** * Create and return the full path to a given endpoint, including any other * provided URL parameters (`urlParams`). * * For example, to get the path for something like `/bill/116/hr/1` then * provide the following values: * * - `endpoint` — `/bill` * - `urlParams` — `[115, 'hr', 1]` * * @param endpoint The base of the endpoint to send the request to. * @param pathParams The optional URL parameters to send with the request. * * @returns A string containing the full endpoint. */ getRequestEndpoint(endpoint: string, pathParams?: Array): string; /** * Sends a request to the Congress API using the provided values and then * (depending on the value of the `trimmedResponses` property of the `config` * object) returns the response data or the entire response object. * * The `D` generic type is used to specify the type of data that is expected * to be returned from the API. For example, if you're making a request to the * `bills` endpoint then you would use `IBill[]` as the type. * * @param method The HTTP method to use for the request. * @param endpoint The endpoint to send the request to. * @param opts The optional path and query params that can modify the request. * * @returns The response from the API. */ sendRequest(method: string, endpoint: string, opts?: IBaseQueryParameters): Promise>; } //# sourceMappingURL=BaseRoute.d.ts.map