UNPKG

@davidbolaji/termii-node

Version:

Node.js SDK for Termii API – send SMS, voice, OTP, and manage messaging with ease.

45 lines 1.88 kB
import { HttpClient } from "../../http/HttpClient"; import { SendTokenRequest, SendTokenResponse, VoiceTokenRequest, VoiceTokenResponse, VoiceCallRequest, VoiceCallResponse } from "../../types/tokenService.type"; import { EmailTokenService } from "./EmailTokenService"; import { InAppTokenService } from "./InAppTokenService"; import { VerifyTokenService } from "./VerifyTokenService"; /** * Utility type that forces TypeScript to expand an interface * so IntelliSense shows its full shape instead of just the alias. */ type Expand<T> = { [K in keyof T]: T[K]; } & {}; /** * Service for sending and verifying OTP tokens (SMS, WhatsApp, or Voice) */ export declare class TokenService { private http; readonly email: EmailTokenService; readonly verify: VerifyTokenService; readonly inApp: InAppTokenService; constructor(http: HttpClient); /** * Send a one-time password (OTP) token via SMS, WhatsApp, or Email * * @param payload - Request payload with OTP configuration and message * @returns Expanded `SendTokenResponse` containing PIN details */ sendToken(payload: Expand<SendTokenRequest>): Promise<Expand<SendTokenResponse>>; /** * Send a one-time password (OTP) token via Voice call * * @param payload - Request payload with phone number and OTP parameters * @returns Expanded `VoiceTokenResponse` with OTP call details */ sendVoiceToken(payload: Expand<VoiceTokenRequest>): Promise<Expand<VoiceTokenResponse>>; /** * Initiate a direct voice call delivering a numeric code * * @param payload - Request containing phone number and numeric code * @returns Expanded `VoiceCallResponse` with call status */ sendVoiceCall(payload: Expand<VoiceCallRequest>): Promise<Expand<VoiceCallResponse>>; } export {}; //# sourceMappingURL=TokenService.d.ts.map