import { Response } from 'superagent'; import { Throttle } from './throttle'; export type CallbackHandler = (err: any, res?: Response) => void; export interface Logger { log: (line: string) => any; } export interface RequestCache { get(key: string): Promise; put(key: string, timeout: number, value: T): Promise; } export interface RequestOptions { /** optionally specify a url to overwrite the original url */ url?: string; /** optionally specify extra query parameters to append to the request */ queryParameters?: any; /** an optional cache instance to use for this request, only valid */ cache?: RequestCache; /** The number of seconds to cache for (defaults to 300 if a cache is specified and no value is provided) */ cacheTimeout?: number; /** Custom rules for request-specific throttling, overrides the client's throttling rules */ throttle?: Throttle; } export interface ClientOptions { url?: string; throttle?: Throttle; accessToken?: string; apiKey?: string; logger?: Logger; } /** * Fleet API Service * @class BaseClient */ export declare class BaseClient { url: string; throttle: Throttle; /** Set the access token when the user had been authenticated */ private accessToken; /** Set the api key to be used to authenticate requests */ private apiKey; /** Set the logger if you'd like to log every request made */ logger: Logger; private headers; protected errorHandlers: CallbackHandler[]; constructor(opts?: ClientOptions); _addErrorHandler(handler: CallbackHandler): void; setAccessToken(accessToken: string): void; setHeader(key: string, value: string): void; protected request(method: string, url: string, body: any, headers: any, queryParameters: any, form: any, throttle?: Throttle): Promise; }