-
Notifications
You must be signed in to change notification settings - Fork 181
/
vonage.ts
136 lines (116 loc) · 3.61 KB
/
vonage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import { Accounts, Secrets } from '@vonage/accounts';
import { Applications } from '@vonage/applications';
import { Auth, AuthInterface } from '@vonage/auth';
import { ConfigParams } from '@vonage/server-client';
import { Messages } from '@vonage/messages';
import { NumberInsights } from '@vonage/number-insights';
import { Numbers } from '@vonage/numbers';
import { Pricing } from '@vonage/pricing';
import { Redact } from '@vonage/redact';
import { SMS } from '@vonage/sms';
import { Users } from '@vonage/users';
import { Verify } from '@vonage/verify';
import { Verify2 } from '@vonage/verify2';
import { Voice } from '@vonage/voice';
import { Video } from '@vonage/video';
import { Conversations } from '@vonage/conversations';
/**
* Represents the Vonage SDK for interacting with Vonage APIs.
*/
export class Vonage {
/**
* The credentials used for authentication.
*/
protected credentials: AuthInterface;
/**
* Optional configuration parameters.
*/
protected options: ConfigParams;
/**
* Provides access to the Accounts API.
*/
public accounts: Accounts;
/**
* Provides access to the Applications API.
*/
public applications: Applications;
/**
* Provides access to the Messages API.
*/
public messages: Messages;
/**
* Provides access to the Number Insights API.
*/
public numberInsights: NumberInsights;
/**
* Provides access to the Numbers API.
*/
public numbers: Numbers;
/**
* Provides access to the Pricing API.
*/
public pricing: Pricing;
/**
* Provides access to the Redact API.
*/
public redact: Redact;
/**
* Provides access to the Secrets API.
*/
public secrets: Secrets;
/**
* Provides access to the SMS API.
*/
public sms: SMS;
/**
* Provides access to the Users API.
*/
public users: Users;
/**
* Provides access to the Verify V2 API.
*/
public verify2: Verify2;
/**
* Provides access to the Verify API.
*/
public verify: Verify;
/**
* Provides access to the Voice API.
*/
public voice: Voice;
/**
* Provides access to the Video API.
*/
public video: Video;
/**
* Provides access to the Conversations API.
*/
public conversations: Conversations;
/**
* The credentials used for authentication.
* @param {AuthInterface} credentials - The authentication credentials.
* @param {ConfigParams} [options] - Optional configuration parameters.
*/
constructor(credentials: AuthInterface, options?: ConfigParams) {
if (typeof credentials.getQueryParams === 'undefined') {
credentials = new Auth(credentials);
}
this.credentials = credentials;
this.options = options || {};
this.accounts = new Accounts(this.credentials, this.options);
this.applications = new Applications(this.credentials, this.options);
this.messages = new Messages(this.credentials, this.options);
this.numberInsights = new NumberInsights(this.credentials, this.options);
this.numbers = new Numbers(this.credentials, this.options);
this.pricing = new Pricing(this.credentials, this.options);
this.redact = new Redact(this.credentials, this.options);
this.secrets = new Secrets(this.credentials, this.options);
this.sms = new SMS(this.credentials, this.options);
this.users = new Users(this.credentials, this.options);
this.verify = new Verify(this.credentials, this.options);
this.verify2 = new Verify2(this.credentials, this.options);
this.voice = new Voice(this.credentials, this.options);
this.video = new Video(this.credentials, this.options);
this.conversations = new Conversations(this.credentials, this.options);
}
}