twilio 3.82.1 → 3.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/lib/rest/Oauth.d.ts +32 -0
  2. package/lib/rest/Oauth.js +79 -0
  3. package/lib/rest/Supersim.d.ts +2 -0
  4. package/lib/rest/Supersim.js +9 -0
  5. package/lib/rest/Twilio.d.ts +2 -0
  6. package/lib/rest/Twilio.js +14 -0
  7. package/lib/rest/api/v2010/account/conference/participant.d.ts +16 -2
  8. package/lib/rest/api/v2010/account/conference/participant.js +28 -5
  9. package/lib/rest/api/v2010/account/message.d.ts +2 -0
  10. package/lib/rest/api/v2010/account/message.js +3 -0
  11. package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
  12. package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
  13. package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
  14. package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
  15. package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
  16. package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
  17. package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
  18. package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
  19. package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
  20. package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
  21. package/lib/rest/oauth/V1.d.ts +34 -0
  22. package/lib/rest/oauth/V1.js +80 -0
  23. package/lib/rest/oauth/v1/oauth.d.ts +115 -0
  24. package/lib/rest/oauth/v1/oauth.js +299 -0
  25. package/lib/rest/oauth/v1/openidDiscovery.d.ts +137 -0
  26. package/lib/rest/oauth/v1/openidDiscovery.js +329 -0
  27. package/lib/rest/oauth/v1/token.d.ts +115 -0
  28. package/lib/rest/oauth/v1/token.js +265 -0
  29. package/lib/rest/oauth/v1/userInfo.d.ts +123 -0
  30. package/lib/rest/oauth/v1/userInfo.js +308 -0
  31. package/lib/rest/supersim/V1.d.ts +3 -0
  32. package/lib/rest/supersim/V1.js +12 -0
  33. package/lib/rest/supersim/v1/settingsUpdate.d.ts +261 -0
  34. package/lib/rest/supersim/v1/settingsUpdate.js +466 -0
  35. package/lib/rest/verify/v2/service/accessToken.d.ts +0 -12
  36. package/lib/rest/verify/v2/service/accessToken.js +0 -12
  37. package/lib/rest/verify/v2/service/entity/challenge/notification.d.ts +0 -9
  38. package/lib/rest/verify/v2/service/entity/challenge/notification.js +0 -9
  39. package/lib/rest/verify/v2/service/entity/challenge.d.ts +0 -12
  40. package/lib/rest/verify/v2/service/entity/challenge.js +0 -12
  41. package/lib/rest/verify/v2/service/entity/factor.d.ts +0 -12
  42. package/lib/rest/verify/v2/service/entity/factor.js +0 -12
  43. package/lib/rest/verify/v2/service/entity/newFactor.d.ts +0 -9
  44. package/lib/rest/verify/v2/service/entity/newFactor.js +0 -9
  45. package/lib/rest/verify/v2/service/entity.d.ts +0 -12
  46. package/lib/rest/verify/v2/service/entity.js +0 -12
  47. package/lib/rest/verify/v2/service/webhook.d.ts +0 -12
  48. package/lib/rest/verify/v2/service/webhook.js +0 -12
  49. package/lib/rest/verify/v2/template.d.ts +2 -0
  50. package/lib/rest/verify/v2/template.js +2 -0
  51. package/lib/twiml/VoiceResponse.d.ts +31 -1
  52. package/lib/twiml/VoiceResponse.js +34 -2
  53. package/package.json +1 -1
@@ -0,0 +1,329 @@
1
+ 'use strict';
2
+
3
+ /* jshint ignore:start */
4
+ /**
5
+ * This code was generated by
6
+ * \ / _ _ _| _ _
7
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
8
+ * / /
9
+ */
10
+ /* jshint ignore:end */
11
+
12
+ var Q = require('q'); /* jshint ignore:line */
13
+ var _ = require('lodash'); /* jshint ignore:line */
14
+ var util = require('util'); /* jshint ignore:line */
15
+ var Page = require('../../../base/Page'); /* jshint ignore:line */
16
+ var values = require('../../../base/values'); /* jshint ignore:line */
17
+
18
+ var OpenidDiscoveryList;
19
+ var OpenidDiscoveryPage;
20
+ var OpenidDiscoveryInstance;
21
+ var OpenidDiscoveryContext;
22
+
23
+ /* jshint ignore:start */
24
+ /**
25
+ * Initialize the OpenidDiscoveryList
26
+ *
27
+ * @constructor Twilio.Oauth.V1.OpenidDiscoveryList
28
+ *
29
+ * @param {Twilio.Oauth.V1} version - Version of the resource
30
+ */
31
+ /* jshint ignore:end */
32
+ OpenidDiscoveryList = function OpenidDiscoveryList(version) {
33
+ /* jshint ignore:start */
34
+ /**
35
+ * @function openidDiscovery
36
+ * @memberof Twilio.Oauth.V1#
37
+ *
38
+ * @param {string} sid - sid of instance
39
+ *
40
+ * @returns {Twilio.Oauth.V1.OpenidDiscoveryContext}
41
+ */
42
+ /* jshint ignore:end */
43
+ function OpenidDiscoveryListInstance(sid) {
44
+ return OpenidDiscoveryListInstance.get(sid);
45
+ }
46
+
47
+ OpenidDiscoveryListInstance._version = version;
48
+ // Path Solution
49
+ OpenidDiscoveryListInstance._solution = {};
50
+ /* jshint ignore:start */
51
+ /**
52
+ * Constructs a openid_discovery
53
+ *
54
+ * @function get
55
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryList#
56
+ *
57
+ * @returns {Twilio.Oauth.V1.OpenidDiscoveryContext}
58
+ */
59
+ /* jshint ignore:end */
60
+ OpenidDiscoveryListInstance.get = function get() {
61
+ return new OpenidDiscoveryContext(this._version);
62
+ };
63
+
64
+ /* jshint ignore:start */
65
+ /**
66
+ * Provide a user-friendly representation
67
+ *
68
+ * @function toJSON
69
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryList#
70
+ *
71
+ * @returns Object
72
+ */
73
+ /* jshint ignore:end */
74
+ OpenidDiscoveryListInstance.toJSON = function toJSON() {
75
+ return this._solution;
76
+ };
77
+
78
+ OpenidDiscoveryListInstance[util.inspect.custom] = function inspect(depth,
79
+ options) {
80
+ return util.inspect(this.toJSON(), options);
81
+ };
82
+
83
+ return OpenidDiscoveryListInstance;
84
+ };
85
+
86
+
87
+ /* jshint ignore:start */
88
+ /**
89
+ * Initialize the OpenidDiscoveryPage
90
+ *
91
+ * @constructor Twilio.Oauth.V1.OpenidDiscoveryPage
92
+ *
93
+ * @param {V1} version - Version of the resource
94
+ * @param {Response<string>} response - Response from the API
95
+ * @param {OpenidDiscoverySolution} solution - Path solution
96
+ *
97
+ * @returns OpenidDiscoveryPage
98
+ */
99
+ /* jshint ignore:end */
100
+ OpenidDiscoveryPage = function OpenidDiscoveryPage(version, response, solution)
101
+ {
102
+ // Path Solution
103
+ this._solution = solution;
104
+
105
+ Page.prototype.constructor.call(this, version, response, this._solution);
106
+ };
107
+
108
+ _.extend(OpenidDiscoveryPage.prototype, Page.prototype);
109
+ OpenidDiscoveryPage.prototype.constructor = OpenidDiscoveryPage;
110
+
111
+ /* jshint ignore:start */
112
+ /**
113
+ * Build an instance of OpenidDiscoveryInstance
114
+ *
115
+ * @function getInstance
116
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryPage#
117
+ *
118
+ * @param {OpenidDiscoveryPayload} payload - Payload response from the API
119
+ *
120
+ * @returns OpenidDiscoveryInstance
121
+ */
122
+ /* jshint ignore:end */
123
+ OpenidDiscoveryPage.prototype.getInstance = function getInstance(payload) {
124
+ return new OpenidDiscoveryInstance(this._version, payload);
125
+ };
126
+
127
+ /* jshint ignore:start */
128
+ /**
129
+ * Provide a user-friendly representation
130
+ *
131
+ * @function toJSON
132
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryPage#
133
+ *
134
+ * @returns Object
135
+ */
136
+ /* jshint ignore:end */
137
+ OpenidDiscoveryPage.prototype.toJSON = function toJSON() {
138
+ let clone = {};
139
+ _.forOwn(this, function(value, key) {
140
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
141
+ clone[key] = value;
142
+ }
143
+ });
144
+ return clone;
145
+ };
146
+
147
+ OpenidDiscoveryPage.prototype[util.inspect.custom] = function inspect(depth,
148
+ options) {
149
+ return util.inspect(this.toJSON(), options);
150
+ };
151
+
152
+
153
+ /* jshint ignore:start */
154
+ /**
155
+ * Initialize the OpenidDiscoveryContext
156
+ *
157
+ * @constructor Twilio.Oauth.V1.OpenidDiscoveryInstance
158
+ *
159
+ * @property {string} issuer - The issuer URL
160
+ * @property {string} authorizationEndpoint - The URL of authorization endpoint
161
+ * @property {string} deviceAuthorizationEndpoint -
162
+ * The URL of device code authorization endpoint
163
+ * @property {string} tokenEndpoint - The URL of token endpoint
164
+ * @property {string} userinfoEndpoint - The URL of user info endpoint
165
+ * @property {string} revocationEndpoint - The URL of revocation endpoint
166
+ * @property {string} jwkUri - The URL of public JWK endpoint
167
+ * @property {string} responseTypeSupported -
168
+ * List of response type supported for identity token
169
+ * @property {string} subjectTypeSupported -
170
+ * List of subject supported for identity token
171
+ * @property {string} idTokenSigningAlgValuesSupported -
172
+ * List of JWS signing algorithms supported for identity token
173
+ * @property {string} scopesSupported - List of scopes supported identity token
174
+ * @property {string} claimsSupported - List of claims supported for identity token
175
+ * @property {string} url - The url
176
+ *
177
+ * @param {V1} version - Version of the resource
178
+ * @param {OpenidDiscoveryPayload} payload - The instance payload
179
+ */
180
+ /* jshint ignore:end */
181
+ OpenidDiscoveryInstance = function OpenidDiscoveryInstance(version, payload) {
182
+ this._version = version;
183
+
184
+ // Marshaled Properties
185
+ this.issuer = payload.issuer; // jshint ignore:line
186
+ this.authorizationEndpoint = payload.authorization_endpoint; // jshint ignore:line
187
+ this.deviceAuthorizationEndpoint = payload.device_authorization_endpoint; // jshint ignore:line
188
+ this.tokenEndpoint = payload.token_endpoint; // jshint ignore:line
189
+ this.userinfoEndpoint = payload.userinfo_endpoint; // jshint ignore:line
190
+ this.revocationEndpoint = payload.revocation_endpoint; // jshint ignore:line
191
+ this.jwkUri = payload.jwk_uri; // jshint ignore:line
192
+ this.responseTypeSupported = payload.response_type_supported; // jshint ignore:line
193
+ this.subjectTypeSupported = payload.subject_type_supported; // jshint ignore:line
194
+ this.idTokenSigningAlgValuesSupported = payload.id_token_signing_alg_values_supported; // jshint ignore:line
195
+ this.scopesSupported = payload.scopes_supported; // jshint ignore:line
196
+ this.claimsSupported = payload.claims_supported; // jshint ignore:line
197
+ this.url = payload.url; // jshint ignore:line
198
+
199
+ // Context
200
+ this._context = undefined;
201
+ this._solution = {};
202
+ };
203
+
204
+ Object.defineProperty(OpenidDiscoveryInstance.prototype,
205
+ '_proxy', {
206
+ get: function() {
207
+ if (!this._context) {
208
+ this._context = new OpenidDiscoveryContext(this._version);
209
+ }
210
+
211
+ return this._context;
212
+ }
213
+ });
214
+
215
+ /* jshint ignore:start */
216
+ /**
217
+ * fetch a OpenidDiscoveryInstance
218
+ *
219
+ * @function fetch
220
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryInstance#
221
+ *
222
+ * @param {function} [callback] - Callback to handle processed record
223
+ *
224
+ * @returns {Promise} Resolves to processed OpenidDiscoveryInstance
225
+ */
226
+ /* jshint ignore:end */
227
+ OpenidDiscoveryInstance.prototype.fetch = function fetch(callback) {
228
+ return this._proxy.fetch(callback);
229
+ };
230
+
231
+ /* jshint ignore:start */
232
+ /**
233
+ * Provide a user-friendly representation
234
+ *
235
+ * @function toJSON
236
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryInstance#
237
+ *
238
+ * @returns Object
239
+ */
240
+ /* jshint ignore:end */
241
+ OpenidDiscoveryInstance.prototype.toJSON = function toJSON() {
242
+ let clone = {};
243
+ _.forOwn(this, function(value, key) {
244
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
245
+ clone[key] = value;
246
+ }
247
+ });
248
+ return clone;
249
+ };
250
+
251
+ OpenidDiscoveryInstance.prototype[util.inspect.custom] = function inspect(depth,
252
+ options) {
253
+ return util.inspect(this.toJSON(), options);
254
+ };
255
+
256
+
257
+ /* jshint ignore:start */
258
+ /**
259
+ * Initialize the OpenidDiscoveryContext
260
+ *
261
+ * @constructor Twilio.Oauth.V1.OpenidDiscoveryContext
262
+ *
263
+ * @param {V1} version - Version of the resource
264
+ */
265
+ /* jshint ignore:end */
266
+ OpenidDiscoveryContext = function OpenidDiscoveryContext(version) {
267
+ this._version = version;
268
+
269
+ // Path Solution
270
+ this._solution = {};
271
+ this._uri = `/well-known/openid-configuration`;
272
+ };
273
+
274
+ /* jshint ignore:start */
275
+ /**
276
+ * fetch a OpenidDiscoveryInstance
277
+ *
278
+ * @function fetch
279
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryContext#
280
+ *
281
+ * @param {function} [callback] - Callback to handle processed record
282
+ *
283
+ * @returns {Promise} Resolves to processed OpenidDiscoveryInstance
284
+ */
285
+ /* jshint ignore:end */
286
+ OpenidDiscoveryContext.prototype.fetch = function fetch(callback) {
287
+ var deferred = Q.defer();
288
+ var promise = this._version.fetch({uri: this._uri, method: 'GET'});
289
+
290
+ promise = promise.then(function(payload) {
291
+ deferred.resolve(new OpenidDiscoveryInstance(this._version, payload));
292
+ }.bind(this));
293
+
294
+ promise.catch(function(error) {
295
+ deferred.reject(error);
296
+ });
297
+
298
+ if (_.isFunction(callback)) {
299
+ deferred.promise.nodeify(callback);
300
+ }
301
+
302
+ return deferred.promise;
303
+ };
304
+
305
+ /* jshint ignore:start */
306
+ /**
307
+ * Provide a user-friendly representation
308
+ *
309
+ * @function toJSON
310
+ * @memberof Twilio.Oauth.V1.OpenidDiscoveryContext#
311
+ *
312
+ * @returns Object
313
+ */
314
+ /* jshint ignore:end */
315
+ OpenidDiscoveryContext.prototype.toJSON = function toJSON() {
316
+ return this._solution;
317
+ };
318
+
319
+ OpenidDiscoveryContext.prototype[util.inspect.custom] = function inspect(depth,
320
+ options) {
321
+ return util.inspect(this.toJSON(), options);
322
+ };
323
+
324
+ module.exports = {
325
+ OpenidDiscoveryList: OpenidDiscoveryList,
326
+ OpenidDiscoveryPage: OpenidDiscoveryPage,
327
+ OpenidDiscoveryInstance: OpenidDiscoveryInstance,
328
+ OpenidDiscoveryContext: OpenidDiscoveryContext
329
+ };
@@ -0,0 +1,115 @@
1
+ /**
2
+ * This code was generated by
3
+ * \ / _ _ _| _ _
4
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ * / /
6
+ */
7
+
8
+ import Page = require('../../../base/Page');
9
+ import Response = require('../../../http/response');
10
+ import V1 = require('../V1');
11
+ import { SerializableClass } from '../../../interfaces';
12
+
13
+ /**
14
+ * Initialize the TokenList
15
+ *
16
+ * @param version - Version of the resource
17
+ */
18
+ declare function TokenList(version: V1): TokenListInstance;
19
+
20
+ interface TokenListInstance {
21
+ /**
22
+ * create a TokenInstance
23
+ *
24
+ * @param opts - Options for request
25
+ * @param callback - Callback to handle processed record
26
+ */
27
+ create(opts: TokenListInstanceCreateOptions, callback?: (error: Error | null, item: TokenInstance) => any): Promise<TokenInstance>;
28
+ /**
29
+ * Provide a user-friendly representation
30
+ */
31
+ toJSON(): any;
32
+ }
33
+
34
+ /**
35
+ * Options to pass to create
36
+ *
37
+ * @property clientSecret - The credential for confidential OAuth App
38
+ * @property clientSid - A string that uniquely identifies this oauth app
39
+ * @property code - Jwt token
40
+ * @property codeVerifier - The cryptographically generated code
41
+ * @property deviceCode - Jwt token
42
+ * @property deviceId - An Id of device
43
+ * @property grantType - A way of representing resource owner's to obtain access token
44
+ * @property refreshToken - Jwt token
45
+ */
46
+ interface TokenListInstanceCreateOptions {
47
+ clientSecret?: string;
48
+ clientSid: string;
49
+ code?: string;
50
+ codeVerifier?: string;
51
+ deviceCode?: string;
52
+ deviceId?: string;
53
+ grantType: string;
54
+ refreshToken?: string;
55
+ }
56
+
57
+ interface TokenPayload extends TokenResource, Page.TwilioResponsePayload {
58
+ }
59
+
60
+ interface TokenResource {
61
+ access_token: string;
62
+ access_token_expires_at: Date;
63
+ id_token: string;
64
+ refresh_token: string;
65
+ refresh_token_expires_at: Date;
66
+ }
67
+
68
+ interface TokenSolution {
69
+ }
70
+
71
+
72
+ declare class TokenInstance extends SerializableClass {
73
+ /**
74
+ * Initialize the TokenContext
75
+ *
76
+ * @param version - Version of the resource
77
+ * @param payload - The instance payload
78
+ */
79
+ constructor(version: V1, payload: TokenPayload);
80
+
81
+ accessToken: string;
82
+ accessTokenExpiresAt: Date;
83
+ idToken: string;
84
+ refreshToken: string;
85
+ refreshTokenExpiresAt: Date;
86
+ /**
87
+ * Provide a user-friendly representation
88
+ */
89
+ toJSON(): any;
90
+ }
91
+
92
+
93
+ declare class TokenPage extends Page<V1, TokenPayload, TokenResource, TokenInstance> {
94
+ /**
95
+ * Initialize the TokenPage
96
+ *
97
+ * @param version - Version of the resource
98
+ * @param response - Response from the API
99
+ * @param solution - Path solution
100
+ */
101
+ constructor(version: V1, response: Response<string>, solution: TokenSolution);
102
+
103
+ /**
104
+ * Build an instance of TokenInstance
105
+ *
106
+ * @param payload - Payload response from the API
107
+ */
108
+ getInstance(payload: TokenPayload): TokenInstance;
109
+ /**
110
+ * Provide a user-friendly representation
111
+ */
112
+ toJSON(): any;
113
+ }
114
+
115
+ export { TokenInstance, TokenList, TokenListInstance, TokenListInstanceCreateOptions, TokenPage, TokenPayload, TokenResource, TokenSolution }
@@ -0,0 +1,265 @@
1
+ 'use strict';
2
+
3
+ /* jshint ignore:start */
4
+ /**
5
+ * This code was generated by
6
+ * \ / _ _ _| _ _
7
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
8
+ * / /
9
+ */
10
+ /* jshint ignore:end */
11
+
12
+ var Q = require('q'); /* jshint ignore:line */
13
+ var _ = require('lodash'); /* jshint ignore:line */
14
+ var util = require('util'); /* jshint ignore:line */
15
+ var Page = require('../../../base/Page'); /* jshint ignore:line */
16
+ var deserialize = require(
17
+ '../../../base/deserialize'); /* jshint ignore:line */
18
+ var values = require('../../../base/values'); /* jshint ignore:line */
19
+
20
+ var TokenList;
21
+ var TokenPage;
22
+ var TokenInstance;
23
+
24
+ /* jshint ignore:start */
25
+ /**
26
+ * Initialize the TokenList
27
+ *
28
+ * @constructor Twilio.Oauth.V1.TokenList
29
+ *
30
+ * @param {Twilio.Oauth.V1} version - Version of the resource
31
+ */
32
+ /* jshint ignore:end */
33
+ TokenList = function TokenList(version) {
34
+ /* jshint ignore:start */
35
+ /**
36
+ * @function token
37
+ * @memberof Twilio.Oauth.V1#
38
+ *
39
+ * @param {string} sid - sid of instance
40
+ *
41
+ * @returns {Twilio.Oauth.V1.TokenContext}
42
+ */
43
+ /* jshint ignore:end */
44
+ function TokenListInstance(sid) {
45
+ return TokenListInstance.get(sid);
46
+ }
47
+
48
+ TokenListInstance._version = version;
49
+ // Path Solution
50
+ TokenListInstance._solution = {};
51
+ TokenListInstance._uri = `/token`;
52
+ /* jshint ignore:start */
53
+ /**
54
+ * create a TokenInstance
55
+ *
56
+ * @function create
57
+ * @memberof Twilio.Oauth.V1.TokenList#
58
+ *
59
+ * @param {object} opts - Options for request
60
+ * @param {string} opts.grantType -
61
+ * A way of representing resource owner's to obtain access token
62
+ * @param {string} opts.clientSid -
63
+ * A string that uniquely identifies this oauth app
64
+ * @param {string} [opts.clientSecret] - The credential for confidential OAuth App
65
+ * @param {string} [opts.code] - Jwt token
66
+ * @param {string} [opts.codeVerifier] - The cryptographically generated code
67
+ * @param {string} [opts.deviceCode] - Jwt token
68
+ * @param {string} [opts.refreshToken] - Jwt token
69
+ * @param {string} [opts.deviceId] - An Id of device
70
+ * @param {function} [callback] - Callback to handle processed record
71
+ *
72
+ * @returns {Promise} Resolves to processed TokenInstance
73
+ */
74
+ /* jshint ignore:end */
75
+ TokenListInstance.create = function create(opts, callback) {
76
+ if (_.isUndefined(opts)) {
77
+ throw new Error('Required parameter "opts" missing.');
78
+ }
79
+ if (_.isUndefined(opts['grantType'])) {
80
+ throw new Error('Required parameter "opts[\'grantType\']" missing.');
81
+ }
82
+ if (_.isUndefined(opts['clientSid'])) {
83
+ throw new Error('Required parameter "opts[\'clientSid\']" missing.');
84
+ }
85
+
86
+ var deferred = Q.defer();
87
+ var data = values.of({
88
+ 'GrantType': _.get(opts, 'grantType'),
89
+ 'ClientSid': _.get(opts, 'clientSid'),
90
+ 'ClientSecret': _.get(opts, 'clientSecret'),
91
+ 'Code': _.get(opts, 'code'),
92
+ 'CodeVerifier': _.get(opts, 'codeVerifier'),
93
+ 'DeviceCode': _.get(opts, 'deviceCode'),
94
+ 'RefreshToken': _.get(opts, 'refreshToken'),
95
+ 'DeviceId': _.get(opts, 'deviceId')
96
+ });
97
+
98
+ var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
99
+
100
+ promise = promise.then(function(payload) {
101
+ deferred.resolve(new TokenInstance(this._version, payload));
102
+ }.bind(this));
103
+
104
+ promise.catch(function(error) {
105
+ deferred.reject(error);
106
+ });
107
+
108
+ if (_.isFunction(callback)) {
109
+ deferred.promise.nodeify(callback);
110
+ }
111
+
112
+ return deferred.promise;
113
+ };
114
+
115
+ /* jshint ignore:start */
116
+ /**
117
+ * Provide a user-friendly representation
118
+ *
119
+ * @function toJSON
120
+ * @memberof Twilio.Oauth.V1.TokenList#
121
+ *
122
+ * @returns Object
123
+ */
124
+ /* jshint ignore:end */
125
+ TokenListInstance.toJSON = function toJSON() {
126
+ return this._solution;
127
+ };
128
+
129
+ TokenListInstance[util.inspect.custom] = function inspect(depth, options) {
130
+ return util.inspect(this.toJSON(), options);
131
+ };
132
+
133
+ return TokenListInstance;
134
+ };
135
+
136
+
137
+ /* jshint ignore:start */
138
+ /**
139
+ * Initialize the TokenPage
140
+ *
141
+ * @constructor Twilio.Oauth.V1.TokenPage
142
+ *
143
+ * @param {V1} version - Version of the resource
144
+ * @param {Response<string>} response - Response from the API
145
+ * @param {TokenSolution} solution - Path solution
146
+ *
147
+ * @returns TokenPage
148
+ */
149
+ /* jshint ignore:end */
150
+ TokenPage = function TokenPage(version, response, solution) {
151
+ // Path Solution
152
+ this._solution = solution;
153
+
154
+ Page.prototype.constructor.call(this, version, response, this._solution);
155
+ };
156
+
157
+ _.extend(TokenPage.prototype, Page.prototype);
158
+ TokenPage.prototype.constructor = TokenPage;
159
+
160
+ /* jshint ignore:start */
161
+ /**
162
+ * Build an instance of TokenInstance
163
+ *
164
+ * @function getInstance
165
+ * @memberof Twilio.Oauth.V1.TokenPage#
166
+ *
167
+ * @param {TokenPayload} payload - Payload response from the API
168
+ *
169
+ * @returns TokenInstance
170
+ */
171
+ /* jshint ignore:end */
172
+ TokenPage.prototype.getInstance = function getInstance(payload) {
173
+ return new TokenInstance(this._version, payload);
174
+ };
175
+
176
+ /* jshint ignore:start */
177
+ /**
178
+ * Provide a user-friendly representation
179
+ *
180
+ * @function toJSON
181
+ * @memberof Twilio.Oauth.V1.TokenPage#
182
+ *
183
+ * @returns Object
184
+ */
185
+ /* jshint ignore:end */
186
+ TokenPage.prototype.toJSON = function toJSON() {
187
+ let clone = {};
188
+ _.forOwn(this, function(value, key) {
189
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
190
+ clone[key] = value;
191
+ }
192
+ });
193
+ return clone;
194
+ };
195
+
196
+ TokenPage.prototype[util.inspect.custom] = function inspect(depth, options) {
197
+ return util.inspect(this.toJSON(), options);
198
+ };
199
+
200
+
201
+ /* jshint ignore:start */
202
+ /**
203
+ * Initialize the TokenContext
204
+ *
205
+ * @constructor Twilio.Oauth.V1.TokenInstance
206
+ *
207
+ * @property {string} accessToken -
208
+ * Token which carries the necessary information to access a Twilio resource directly
209
+ * @property {string} refreshToken -
210
+ * Token which carries the information necessary to get a new access token
211
+ * @property {string} idToken - The id_token
212
+ * @property {Date} refreshTokenExpiresAt -
213
+ * The RFC 2822 date and time in GMT when the refresh token expires
214
+ * @property {Date} accessTokenExpiresAt -
215
+ * The RFC 2822 date and time in GMT when the access token expires
216
+ *
217
+ * @param {V1} version - Version of the resource
218
+ * @param {TokenPayload} payload - The instance payload
219
+ */
220
+ /* jshint ignore:end */
221
+ TokenInstance = function TokenInstance(version, payload) {
222
+ this._version = version;
223
+
224
+ // Marshaled Properties
225
+ this.accessToken = payload.access_token; // jshint ignore:line
226
+ this.refreshToken = payload.refresh_token; // jshint ignore:line
227
+ this.idToken = payload.id_token; // jshint ignore:line
228
+ this.refreshTokenExpiresAt = deserialize.iso8601DateTime(payload.refresh_token_expires_at); // jshint ignore:line
229
+ this.accessTokenExpiresAt = deserialize.iso8601DateTime(payload.access_token_expires_at); // jshint ignore:line
230
+
231
+ // Context
232
+ this._context = undefined;
233
+ this._solution = {};
234
+ };
235
+
236
+ /* jshint ignore:start */
237
+ /**
238
+ * Provide a user-friendly representation
239
+ *
240
+ * @function toJSON
241
+ * @memberof Twilio.Oauth.V1.TokenInstance#
242
+ *
243
+ * @returns Object
244
+ */
245
+ /* jshint ignore:end */
246
+ TokenInstance.prototype.toJSON = function toJSON() {
247
+ let clone = {};
248
+ _.forOwn(this, function(value, key) {
249
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
250
+ clone[key] = value;
251
+ }
252
+ });
253
+ return clone;
254
+ };
255
+
256
+ TokenInstance.prototype[util.inspect.custom] = function inspect(depth, options)
257
+ {
258
+ return util.inspect(this.toJSON(), options);
259
+ };
260
+
261
+ module.exports = {
262
+ TokenList: TokenList,
263
+ TokenPage: TokenPage,
264
+ TokenInstance: TokenInstance
265
+ };