netgsm-otp
Version:
Unofficial Node.js/TypeScript client for NetGSM OTP SMS service
60 lines (59 loc) • 1.47 kB
TypeScript
/**
* NetGSM OTP SMS Service Client
* Unofficial TypeScript client for NetGSM OTP SMS service
*/
interface NetGsmOtpOptions {
usercode: string;
password: string;
msgheader: string;
appkey: string;
}
interface SendOtpOptions {
phoneNumber: string;
message: string;
code?: string;
}
/**
* NetGSM OTP SMS Client
*/
export declare class NetGsmOtp {
private usercode;
private password;
private msgheader;
private appkey;
private apiUrl;
/**
* Create a new NetGsmOtp instance
* @param options Authentication options
*/
constructor(options: NetGsmOtpOptions);
/**
* Validate a phone number
* @param phoneNumber The phone number to validate
* @returns True if the phone number is valid, false otherwise
*/
private isValidPhoneNumber;
/**
* Send an OTP SMS message
* @param options Options for sending OTP
* @returns Promise with the response from NetGSM API
*/
sendOtp(options: SendOtpOptions): Promise<{
success: boolean;
message: string;
code?: string;
}>;
/**
* Build the XML payload for the API request
* @param options Options for sending OTP
* @returns XML string
*/
private buildXmlPayload;
/**
* Parse the response from NetGSM API
* @param responseText Response text from the API
* @returns Parsed response object
*/
private parseResponse;
}
export {};