Skip to content

Commit

Permalink
added types
Browse files Browse the repository at this point in the history
  • Loading branch information
sreeteja06 committed Jan 28, 2021
1 parent 628b3fc commit 9aac70e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msg91-lib",
"version": "2.0.1",
"version": "2.0.2",
"description": "Unofficial msg91 library to send OTP & messages",
"main": "index.js",
"scripts": {
Expand All @@ -11,6 +11,7 @@
"url": "git+https://github.com/sumitsk20/msg91-lib.git"
},
"homepage": "https://github.com/sumitsk20/msg91-lib/tree/v2.x",
"types": "./types/index.d.ts",
"keywords": [
"msg91",
"otp",
Expand Down
29 changes: 29 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
interface IMsg91OtpConstructorArgs {
authKey: string;
templateId: string;
baseUrl?: string;
apiVersion?: string;
otpExpiry?: number;
otpLength?: number;
}

interface IMsg91SendOtpArgs {
templateId?: string;
expiry?: number;
otpLength?: number;
email?: string;
invisible?: 0 | 1;
extra_param: any;
}

declare class Msg91Otp {
constructor(args: IMsg91OtpConstructorArgs);

send(contactNumber: string | number, args?: IMsg91SendOtpArgs): Promise<any>;

retry(contactNumber: string | number, retryType?: string): Promise<any>;

verify(contactNumber: string | number, otp: number | string): Promise<any>;
}

export { Msg91Otp as msg91OTP };

0 comments on commit 9aac70e

Please sign in to comment.