@vtex/api
Version:
VTEX I/O API client
34 lines (33 loc) • 1.7 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { AxiosResponse } from 'axios';
import { IncomingMessage } from 'http';
import { IOContext } from '../service/worker/runtime/typings';
import { InstanceOptions, IOResponse, RequestConfig } from './typings';
type ClientOptions = IOContext & Partial<InstanceOptions>;
export declare class HttpClient {
name: string;
private logger;
private cacheableType;
private memoizable;
private runMiddlewares;
constructor(opts: ClientOptions);
get: <T = any>(url: string, config?: RequestConfig) => Promise<T>;
getRaw: <T = any>(url: string, config?: RequestConfig) => Promise<IOResponse<T>>;
getWithBody: <T = any>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
getBuffer: (url: string, config?: RequestConfig) => Promise<{
data: Buffer;
headers: any;
}>;
getStream: (url: string, config?: RequestConfig) => Promise<IncomingMessage>;
put: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
putRaw: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<IOResponse<T>>;
post: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
postRaw: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<IOResponse<T>>;
patch: <T = void>(url: string, data?: any, config?: RequestConfig) => Promise<T>;
head: (url: string, config?: RequestConfig) => Promise<IOResponse<void>>;
delete: <T = void>(url: string, config?: RequestConfig) => Promise<IOResponse<T>>;
protected request: (config: RequestConfig) => Promise<AxiosResponse>;
private getConfig;
}
export {};