UNPKG

ippanel-node-sdk

Version:
101 lines (87 loc) 2.51 kB
/** * Type definitions for ippanel-node-sdk */ import { AxiosInstance } from 'axios'; /** * Meta information returned from the API */ export interface Meta { status: boolean; message: string; message_parameters: any[]; message_code: string; } /** * Response structure from send operations */ export interface SendResponse { data: any; meta: Meta; } /** * ippanel API client */ export class Client { /** * Create a new ippanel client * @param apiKey - Your ippanel API key * @param baseUrl - Optional custom API base URL */ constructor(apiKey: string, baseUrl?: string); /** * The API key used for authentication */ apiKey: string; /** * Base URL for API requests */ baseUrl: string; /** * HTTP client for making API requests */ httpClient: AxiosInstance; /** * Send a web service message * @param message - The message to send * @param sender - The sender number * @param recipients - Array of recipient phone numbers * @returns A promise resolving to the API response */ sendWebservice(message: string, sender: string, recipients: string[]): Promise<SendResponse>; /** * Send a message using a predefined pattern * @param patternCode - The pattern code * @param sender - The sender number * @param recipient - The recipient phone number * @param params - Pattern parameters * @returns A promise resolving to the API response */ sendPattern(patternCode: string, sender: string, recipient: string, params: Record<string, any>): Promise<SendResponse>; /** * Send a verification OTP (VOTP) message * @param code - The OTP code * @param recipient - The recipient phone number * @returns A promise resolving to the API response */ sendVOTP(code: number, recipient: string): Promise<SendResponse>; /** * Set a custom HTTP client or override HTTP client settings * @param httpClient - Custom HTTP client or settings */ setHttpClient(httpClient: AxiosInstance): void; /** * Make a POST request to the API * @private * @param path - API endpoint path * @param payload - Request payload * @returns A promise resolving to the API response */ private _post(path: string, payload: any): Promise<SendResponse>; } /** * Create a new ippanel client * @param apiKey - Your ippanel API key * @param baseUrl - Optional custom API base URL * @returns A new Client instance */ export function createClient(apiKey: string, baseUrl?: string): Client;