UNPKG

@kwikpik/server-libs

Version:

Kwikpik-Server-Libs ===================================================================================================================================================================================================

45 lines (44 loc) 1.38 kB
import axios from "axios"; import { HttpResponseTypes, HttpStatusCodes } from "../constants"; export interface ResponseInterface<T> { responseType: HttpResponseTypes; statusCode: HttpStatusCodes; data: T; } export declare class HTTPModule { private axiosInstance; constructor(baseURL: string, headers?: Record<string, any>); static constructWithBaseURL(baseURL: string): HTTPModule; post<S, T>( path: string, body: S, headers?: Record<string, any>, params?: Record<string, any> ): Promise<ResponseInterface<T> | ResponseInterface<string>>; get<T>( path: string, headers?: Record<string, any>, params?: Record<string, any> ): Promise<ResponseInterface<T> | ResponseInterface<string>>; patch<S, T>( path: string, body: S, headers?: Record<string, any>, params?: Record<string, any> ): Promise<ResponseInterface<T> | ResponseInterface<string>>; put<S, T>( path: string, body: S, headers?: Record<string, any>, params?: Record<string, any> ): Promise<ResponseInterface<T> | ResponseInterface<string>>; delete<T>( path: string, headers?: Record<string, any>, params?: Record<string, any> ): Promise<ResponseInterface<T> | ResponseInterface<string>>; getHeaders(): axios.HeadersDefaults & { [key: string]: axios.AxiosHeaderValue; }; } //# sourceMappingURL=http.d.ts.map