UNPKG

@speedup/notification-sms-smsir

Version:
52 lines (51 loc) 1.29 kB
/** * SMS sender */ import { AxiosInstance } from 'axios'; import ISendConfig from './interfaces/ISendConfig'; import ISenderConfig from './interfaces/ISenderConfig'; import ISendResult from './interfaces/ISendResult'; declare class SMSSender { /** * HTTP client */ protected readonly httpClient: AxiosInstance; /** * Configuration */ protected config: ISenderConfig; /** * Authentication information */ protected readonly cache: { /** * Current credit */ credit: number; /** * Last authentication retry */ lastAuthRetry: number; /** * Current authentication token */ authToken: string; }; constructor(config?: ISenderConfig); /** * Renew the authentication token */ protected renewToken(): Promise<void>; /** * Retrieve current balance */ protected currentBalance(): Promise<number>; /** * Send a message to a specific user * @param phoneNumber Target phone number * @param message Message content * @param config Send configuration */ send(phoneNumber: string, message: string, config?: ISendConfig): Promise<ISendResult>; } export default SMSSender;