UNPKG

f5-conx-core

Version:

F5 SDK for JavaScript with Typescript type definitions

68 lines (67 loc) 2.16 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import { AxiosInstance, AxiosProxyConfig, AxiosRequestConfig } from 'axios'; import { AxiosResponseWithTimings, uuidAxiosRequestConfig } from "./utils/httpModels"; /** * Class for making all external HTTP calls * @constructor options.rejectUnauthorized - set to false to allow self-signed certs (default true) */ export declare class ExtHttp { /** * http user agent to identify connections * * set via process.env.F5_CONX_CORE_EXT_HTTP_AGENT * * default => 'F5 Conx Core' */ userAgent: string; /** * event emitter instance */ events: EventEmitter; /** * axios instance for making all external https calls */ axios: AxiosInstance; /** * cache directory for default download directory */ cacheDir: string; /** * external https proxy configuration settings, based on axios proxy config * # in dev */ proxy: AxiosProxyConfig | undefined; constructor(options?: { rejectUnauthorized?: boolean; eventEmitter?: EventEmitter; }); /** * core external axios instance * @param reqBase */ createAxiosInstance(reqBase?: uuidAxiosRequestConfig): AxiosInstance; /** * Make External HTTP request * * @param url absolute url * @param options axios options * * @returns request response */ makeRequest(options: AxiosRequestConfig): Promise<AxiosResponseWithTimings>; /** * download file from external (not f5) * @param url fully qualified URL * @param fileName (optional) destination file name - if you want it different than url * @param destPath (optional) where to put the file (default is local project cache folder) * @param options axios requestion options */ download(url: string, fileName?: string, destPath?: string, options?: AxiosRequestConfig): Promise<AxiosResponseWithTimings>; /** * * @param url * @param localSourcePathFilename */ upload(url: string, localSourcePathFilename: string): Promise<AxiosResponseWithTimings>; }