1 | declare module 'nexmo' {
|
2 |
|
3 | export interface CredentialsObject {
|
4 | apiKey: string;
|
5 | apiSecret: string;
|
6 | applicationId?: string;
|
7 | privateKey?: string;
|
8 | }
|
9 |
|
10 | export interface NexmoApiError {
|
11 | body: { [key: string]: any };
|
12 | headers?: { [key: string]: any };
|
13 | }
|
14 |
|
15 | export interface ParserError {
|
16 | status: string;
|
17 | message: string;
|
18 | body: string;
|
19 | parseError: Error;
|
20 | }
|
21 |
|
22 |
|
23 | export interface VerifyError extends NexmoApiError {
|
24 | status: RequestResponseStatusCode | ControlResponseStatusCode | string;
|
25 | error_text: string;
|
26 | [key: string]: any;
|
27 | }
|
28 |
|
29 | export interface RequestObject {
|
30 | brand: string;
|
31 | number: string;
|
32 | sender_id?: string;
|
33 | country?: string;
|
34 | code_length?: number;
|
35 | lg?: string;
|
36 | require_type?: string;
|
37 | pin_expiry?: number;
|
38 | next_event_wait?: number;
|
39 | workflow_id?: number;
|
40 | }
|
41 |
|
42 | export interface RequestResponse {
|
43 | request_id: string;
|
44 | status: string;
|
45 | }
|
46 |
|
47 | export enum RequestResponseStatusCode {
|
48 | Success = "0",
|
49 | Throttled = "1",
|
50 | MissingParameters = "2",
|
51 | InvalidCredentials = "3",
|
52 | InternalError = "4",
|
53 | NotProcessed = "5",
|
54 | BlackListedNumber = "6",
|
55 | BlockedAccount = "7",
|
56 | QuotaExceeded = "8",
|
57 | ConcurrentVerificationNumber = "9",
|
58 | TargetNetworkNotSupported = "10",
|
59 | WrongVerificationCode = "11",
|
60 | TooManyRequests = "12",
|
61 | NoMoreEvents = "13",
|
62 | NoRequestFound = "14",
|
63 | }
|
64 |
|
65 | export interface ControlObject {
|
66 | request_id: string;
|
67 | cmd: string;
|
68 | }
|
69 |
|
70 | export interface ControlResponse {
|
71 | status: string;
|
72 | command: string;
|
73 | }
|
74 |
|
75 | export enum ControlResponseStatusCode {
|
76 | Success = "0",
|
77 | CancelOrTriggerNextEvent = "19",
|
78 | }
|
79 |
|
80 | export interface CheckObject {
|
81 | request_id: string;
|
82 | code: string;
|
83 | ip_address?: string;
|
84 | }
|
85 |
|
86 | export interface CheckResponse {
|
87 | request_id: string;
|
88 | event_id: string;
|
89 | status: string;
|
90 | price: string;
|
91 | currency: string;
|
92 | }
|
93 |
|
94 | export class Verify {
|
95 | constructor(credentials: CredentialsObject, options: { [key: string]: any });
|
96 | request(request: RequestObject, callback: (err: VerifyError, data: RequestResponse) => void): void;
|
97 | control(request: ControlObject, callback: (err: VerifyError, data: ControlResponse) => void): void;
|
98 | check(request: CheckObject, callback: (err: VerifyError, data: CheckResponse) => void): void;
|
99 | __proto__: any;
|
100 | [key: string]: any;
|
101 | }
|
102 |
|
103 | /* Nexmo */
|
104 | export default class Nexmo {
|
105 | constructor(credentials: CredentialsObject, options?: { [key: string]: any });
|
106 | public readonly verify: Verify;
|
107 | }
|
108 | }
|