@mirad-work/sms-core
Version:
A framework-agnostic TypeScript SMS service core with provider abstraction for Iranian SMS providers
48 lines • 1.57 kB
TypeScript
import { ISmsDriver } from "../interfaces/sms-driver.interface";
import { ISmsConfig } from "../interfaces/sms-config.interface";
import { IHttpClient } from "../interfaces/http-client.interface";
import { DriverType } from "../types/driver-types";
/**
* Factory class for creating SMS driver instances
* Implements the Factory pattern for driver instantiation
*/
export declare class SmsDriverFactory {
private readonly config;
private readonly httpClient;
private readonly driverInstances;
constructor(config: ISmsConfig, httpClient?: IHttpClient);
/**
* Create a driver instance for the specified driver type
* Uses singleton pattern to reuse driver instances
*/
createDriver(driverType?: DriverType): ISmsDriver;
/**
* Clear driver cache (useful for testing or config changes)
*/
clearCache(): void;
/**
* Get list of available drivers based on configuration
*/
getAvailableDrivers(): DriverType[];
/**
* Check if a driver is available and properly configured
*/
isDriverAvailable(driverType: DriverType): boolean;
/**
* Instantiate the actual driver based on type
*/
private instantiateDriver;
/**
* Validate the main configuration
*/
private validateConfig;
/**
* Validate configuration for a specific driver
*/
private validateDriverConfig;
/**
* Validate basic driver configuration (url, apiKey, lineNumber)
*/
private validateBasicDriverConfig;
}
//# sourceMappingURL=sms-driver-factory.d.ts.map