UNPKG

amberflo-metering-typescript

Version:
27 lines (26 loc) 1.14 kB
import { AxiosInstance } from "axios"; import { IAxiosRetryConfig } from 'axios-retry'; export default class BaseClient { /** * Base Amberflo API client. Abstracts away the actual API calls and * logging. */ apiKey: string; axiosInstance: AxiosInstance; signature: string; debug: boolean; /** * Initialize a new `BaseClient` * `name`: Name of the client for logging purposes. * `debug`: Whether to issue debug level logs or not. * `retry`: Whether to retry idempotent requests on 5xx or network errors, or retry configuration (see https://github.com/softonic/axios-retry). */ constructor(apiKey: string, debug: boolean, name: string, retry?: boolean | IAxiosRetryConfig); private log; logInfo(message: string, ...args: any[]): void; logDebug(message: string, ...args: any[]): void; logError(message: string, ...args: any[]): void; doGet<TResponse>(path: string, params?: any): Promise<TResponse>; doPost<TResponse>(path: string, payload: any, params?: any): Promise<TResponse>; doPut<TResponse>(path: string, payload: any): Promise<TResponse>; }