UNPKG

mpesalib

Version:

A robust Node.js library for Safaricom's Daraja API with complete TypeScript support and modern async/await patterns

49 lines 1.26 kB
import { AxiosRequestConfig } from 'axios'; import { MpesaConfig } from '../types'; export declare class HttpClient { private client; private config; private accessToken; private tokenExpiry; constructor(config: MpesaConfig); /** * Get access token from Safaricom OAuth API */ private getAccessToken; /** * Make GET request */ get<T>(url: string, config?: AxiosRequestConfig): Promise<T>; /** * Make POST request */ post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>; /** * Make PUT request */ put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>; /** * Make DELETE request */ delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>; /** * Format error response */ private formatError; /** * Get error message from various error formats */ private getErrorMessage; /** * Clear access token (useful for testing or manual token refresh) */ clearToken(): void; /** * Get current token info (for debugging) */ getTokenInfo(): { token: string | null; expiry: Date | null; }; } //# sourceMappingURL=httpClient.d.ts.map