/// import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; import ApiConfigInterface from '../faces/lib/api'; export default class Api { private trustedHosts; private _config; get config(): ApiConfigInterface; /** * @deprecated Use `api.config` instead * @returns {ApiConfigInterface} - The API configuration. */ getConfig(): ApiConfigInterface; constructor(config?: ApiConfigInterface, trustedHosts?: string[]); /** * Do a GET request to the selected gateway * @param {string} endpoint - API endpoint * @param {AxiosRequestConfig} config? - Axios configuration * @returns {AxiosResponse} - Promise which resolves on the axios response */ get(endpoint: string, config?: AxiosRequestConfig): Promise; /** * Do a POST request to the selected gateway * @param {string} endpoint - API endpoint * @param {Buffer|string|object} body - Body content to post * @param {AxiosRequestConfig} config? - Axios configuration * @returns {AxiosResponse} - Promise which resolves on the axios response */ post(endpoint: string, body: Buffer | string | object, config?: AxiosRequestConfig): Promise; /** * Get an AxiosInstance with the base configuration setup to fire off * a request to the network. * @returns {AxiosInstance} */ request(): AxiosInstance; /** * * @param {string} endpoint - API endpoint * @param {'get'|'post'} type - GET | POST * @param {AxiosRequestConfig} config - Axios config * @param {Buffer|string|object} body? * @returns {AxiosResponse} - Promise which resolves on the axios response * @private */ private doRequest; /** * Merge the default configuration with the user provided configuration * @param {ApiConfigInterface} config * @returns {ApiConfigInterface} * @private */ private mergeDefaults; }