myinvois-sdk
Version:
TypeScript SDK for interacting with the Malaysia e-invoicing system (MyInvois) API
47 lines (46 loc) • 1.48 kB
TypeScript
import { AxiosRequestConfig } from 'axios';
/**
* HTTP client wrapper around Axios
*/
export declare class HttpClient {
private client;
constructor();
/**
* Make a GET request
* @param url The URL to make the request to
* @param config The Axios request configuration
* @returns A promise resolving to the response data
*/
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
/**
* Make a POST request
* @param url The URL to make the request to
* @param data The data to send
* @param config The Axios request configuration
* @returns A promise resolving to the response data
*/
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
/**
* Make a PUT request
* @param url The URL to make the request to
* @param data The data to send
* @param config The Axios request configuration
* @returns A promise resolving to the response data
*/
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
/**
* Handle errors from Axios
* @param error The error to handle
*/
private handleError;
}
/**
* Custom error class for API errors
*/
export declare class MyInvoisApiError extends Error {
/** The HTTP status code */
statusCode: number;
/** The response data */
responseData: any;
constructor(message: string, statusCode: number, responseData: any);
}