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 | number;
|
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?: string;
|
38 | next_event_wait?: number;
|
39 | workflow_id?: number;
|
40 | }
|
41 |
|
42 | export interface RequestResponse {
|
43 | request_id: string;
|
44 | }
|
45 |
|
46 | export enum RequestResponseStatusCode {
|
47 | Success = 0,
|
48 | Throttled,
|
49 | MissingParameters,
|
50 | InvalidCredentials,
|
51 | InternalError,
|
52 | NotProcessed,
|
53 | BlackListedNumber,
|
54 | BlockedAccount,
|
55 | QuotaExceeded,
|
56 | ConcurrentVerificationNumber,
|
57 | TargetNetworkNotSupported,
|
58 | WrongVerificationCode,
|
59 | TooManyRequests,
|
60 | NoMoreEvents,
|
61 | NoRequestFound,
|
62 | }
|
63 |
|
64 | export interface ControlObject {
|
65 | request_id: string;
|
66 | cmd: string;
|
67 | }
|
68 |
|
69 | export interface ControlResponse {
|
70 | status: string;
|
71 | command: string;
|
72 | }
|
73 |
|
74 | export enum ControlResponseStatusCode {
|
75 | Success = 0,
|
76 | CancelOrTriggerNextEvent = 19,
|
77 | }
|
78 |
|
79 | export interface CheckObject {
|
80 | request_id: string;
|
81 | code: string;
|
82 | ip_address?: string;
|
83 | }
|
84 |
|
85 | export interface CheckResponse {
|
86 | request_id: string;
|
87 | event_id: string;
|
88 | status: string;
|
89 | price: string;
|
90 | currency: string;
|
91 | }
|
92 |
|
93 | export class Verify {
|
94 | constructor(credentials: CredentialsObject, options: { [key: string]: any });
|
95 | request(request: RequestObject, callback: (err: VerifyError, data: RequestResponse) => void): void;
|
96 | control(request: ControlObject, callback: (err: VerifyError, data: ControlResponse) => void): void;
|
97 | check(request: CheckObject, callback: (err: VerifyError, data: CheckResponse) => void): void;
|
98 | __proto__: any;
|
99 | [key: string]: any;
|
100 | }
|
101 |
|
102 | /* Nexmo */
|
103 | export default class Nexmo {
|
104 | constructor(credentials: CredentialsObject, options?: { [key: string]: any });
|
105 | public readonly verify: Verify;
|
106 | }
|
107 | }
|