@mirad-work/sms-core
Version:
A framework-agnostic TypeScript SMS service core with provider abstraction for Iranian SMS providers
48 lines • 1.52 kB
TypeScript
import { ISmsMessage, ISmsResponse } from "../interfaces/sms-driver.interface";
import { ISmsConfig } from "../interfaces/sms-config.interface";
import { DriverType } from "../types/driver-types";
import { SmsDriverFactory } from "./sms-driver-factory";
/**
* Main SMS service class - provides a high-level interface for SMS operations
* This is the primary class that applications should use
*/
export declare class SmsService {
private readonly driverFactory;
private readonly config;
constructor(config: ISmsConfig, driverFactory?: SmsDriverFactory);
/**
* Send a template-based SMS message (OTP, verification codes, etc.)
*/
verify(message: ISmsMessage): Promise<ISmsResponse>;
/**
* Get list of available drivers
*/
getAvailableDrivers(): DriverType[];
/**
* Check if a specific driver is available
*/
isDriverAvailable(driverType: DriverType): boolean;
/**
* Get the default driver type
*/
getDefaultDriver(): DriverType;
/**
* Create a template-based SMS message object
*/
createVerificationMessage(to: string, template: string, tokens: Record<string, unknown> | unknown[], options?: {
driver?: DriverType;
}): ISmsMessage;
/**
* Validate SMS message
*/
private validateMessage;
/**
* Validate service configuration
*/
private validateConfig;
/**
* Handle and standardize errors
*/
private handleError;
}
//# sourceMappingURL=sms-service.d.ts.map