twilio 3.82.2 → 3.83.1
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.
- package/lib/rest/Oauth.d.ts +32 -0
- package/lib/rest/Oauth.js +79 -0
- package/lib/rest/Supersim.d.ts +2 -0
- package/lib/rest/Supersim.js +9 -0
- package/lib/rest/Twilio.d.ts +2 -0
- package/lib/rest/Twilio.js +14 -0
- package/lib/rest/api/v2010/account/call/userDefinedMessage.d.ts +107 -0
- package/lib/rest/api/v2010/account/call/userDefinedMessage.js +259 -0
- package/lib/rest/api/v2010/account/call/userDefinedMessageSubscription.d.ts +153 -0
- package/lib/rest/api/v2010/account/call/userDefinedMessageSubscription.js +407 -0
- package/lib/rest/api/v2010/account/call.d.ts +14 -0
- package/lib/rest/api/v2010/account/call.js +67 -0
- package/lib/rest/api/v2010/account/conference/participant.d.ts +2 -2
- package/lib/rest/api/v2010/account/conference/participant.js +6 -4
- package/lib/rest/api/v2010/account/message.d.ts +6 -0
- package/lib/rest/api/v2010/account/message.js +10 -1
- package/lib/rest/oauth/V1.d.ts +34 -0
- package/lib/rest/oauth/V1.js +80 -0
- package/lib/rest/oauth/v1/oauth.d.ts +115 -0
- package/lib/rest/oauth/v1/oauth.js +299 -0
- package/lib/rest/oauth/v1/openidDiscovery.d.ts +137 -0
- package/lib/rest/oauth/v1/openidDiscovery.js +329 -0
- package/lib/rest/oauth/v1/token.d.ts +115 -0
- package/lib/rest/oauth/v1/token.js +265 -0
- package/lib/rest/oauth/v1/userInfo.d.ts +123 -0
- package/lib/rest/oauth/v1/userInfo.js +308 -0
- package/lib/rest/proxy/v1/service/session/participant.d.ts +0 -2
- package/lib/rest/proxy/v1/service/session/participant.js +1 -6
- package/lib/rest/proxy/v1/service/session.d.ts +0 -4
- package/lib/rest/proxy/v1/service/session.js +2 -10
- package/lib/rest/supersim/V1.d.ts +3 -0
- package/lib/rest/supersim/V1.js +12 -0
- package/lib/rest/supersim/v1/settingsUpdate.d.ts +261 -0
- package/lib/rest/supersim/v1/settingsUpdate.js +466 -0
- package/lib/rest/taskrouter/v1/workspace/task/reservation.d.ts +6 -0
- package/lib/rest/taskrouter/v1/workspace/task/reservation.js +7 -0
- package/lib/rest/taskrouter/v1/workspace/taskQueue.d.ts +6 -0
- package/lib/rest/taskrouter/v1/workspace/taskQueue.js +4 -0
- package/lib/rest/taskrouter/v1/workspace/worker.d.ts +6 -0
- package/lib/rest/taskrouter/v1/workspace/worker.js +4 -0
- package/lib/rest/verify/v2/service/accessToken.d.ts +0 -12
- package/lib/rest/verify/v2/service/accessToken.js +0 -12
- package/lib/rest/verify/v2/service/entity/challenge/notification.d.ts +0 -9
- package/lib/rest/verify/v2/service/entity/challenge/notification.js +0 -9
- package/lib/rest/verify/v2/service/entity/challenge.d.ts +0 -12
- package/lib/rest/verify/v2/service/entity/challenge.js +0 -12
- package/lib/rest/verify/v2/service/entity/factor.d.ts +0 -12
- package/lib/rest/verify/v2/service/entity/factor.js +0 -12
- package/lib/rest/verify/v2/service/entity/newFactor.d.ts +0 -9
- package/lib/rest/verify/v2/service/entity/newFactor.js +0 -9
- package/lib/rest/verify/v2/service/entity.d.ts +0 -12
- package/lib/rest/verify/v2/service/entity.js +0 -12
- package/lib/rest/verify/v2/service/verification.d.ts +1 -1
- package/lib/rest/verify/v2/service/verification.js +2 -1
- package/lib/rest/verify/v2/service/webhook.d.ts +0 -12
- package/lib/rest/verify/v2/service/webhook.js +0 -12
- package/lib/rest/verify/v2/template.d.ts +2 -0
- package/lib/rest/verify/v2/template.js +2 -0
- package/lib/twiml/VoiceResponse.d.ts +7 -1
- package/lib/twiml/VoiceResponse.js +6 -0
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
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 UserInfoList
|
|
15
|
+
*
|
|
16
|
+
* @param version - Version of the resource
|
|
17
|
+
*/
|
|
18
|
+
declare function UserInfoList(version: V1): UserInfoListInstance;
|
|
19
|
+
|
|
20
|
+
interface UserInfoListInstance {
|
|
21
|
+
/**
|
|
22
|
+
* @param sid - sid of instance
|
|
23
|
+
*/
|
|
24
|
+
(sid: string): UserInfoContext;
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a user_info
|
|
27
|
+
*/
|
|
28
|
+
get(): UserInfoContext;
|
|
29
|
+
/**
|
|
30
|
+
* Provide a user-friendly representation
|
|
31
|
+
*/
|
|
32
|
+
toJSON(): any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface UserInfoPayload extends UserInfoResource, Page.TwilioResponsePayload {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface UserInfoResource {
|
|
39
|
+
email: string;
|
|
40
|
+
first_name: string;
|
|
41
|
+
friendly_name: string;
|
|
42
|
+
last_name: string;
|
|
43
|
+
url: string;
|
|
44
|
+
user_sid: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface UserInfoSolution {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
declare class UserInfoContext {
|
|
52
|
+
/**
|
|
53
|
+
* Initialize the UserInfoContext
|
|
54
|
+
*
|
|
55
|
+
* @param version - Version of the resource
|
|
56
|
+
*/
|
|
57
|
+
constructor(version: V1);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* fetch a UserInfoInstance
|
|
61
|
+
*
|
|
62
|
+
* @param callback - Callback to handle processed record
|
|
63
|
+
*/
|
|
64
|
+
fetch(callback?: (error: Error | null, items: UserInfoInstance) => any): Promise<UserInfoInstance>;
|
|
65
|
+
/**
|
|
66
|
+
* Provide a user-friendly representation
|
|
67
|
+
*/
|
|
68
|
+
toJSON(): any;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
declare class UserInfoInstance extends SerializableClass {
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the UserInfoContext
|
|
75
|
+
*
|
|
76
|
+
* @param version - Version of the resource
|
|
77
|
+
* @param payload - The instance payload
|
|
78
|
+
*/
|
|
79
|
+
constructor(version: V1, payload: UserInfoPayload);
|
|
80
|
+
|
|
81
|
+
private _proxy: UserInfoContext;
|
|
82
|
+
email: string;
|
|
83
|
+
/**
|
|
84
|
+
* fetch a UserInfoInstance
|
|
85
|
+
*
|
|
86
|
+
* @param callback - Callback to handle processed record
|
|
87
|
+
*/
|
|
88
|
+
fetch(callback?: (error: Error | null, items: UserInfoInstance) => any): Promise<UserInfoInstance>;
|
|
89
|
+
firstName: string;
|
|
90
|
+
friendlyName: string;
|
|
91
|
+
lastName: string;
|
|
92
|
+
/**
|
|
93
|
+
* Provide a user-friendly representation
|
|
94
|
+
*/
|
|
95
|
+
toJSON(): any;
|
|
96
|
+
url: string;
|
|
97
|
+
userSid: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
declare class UserInfoPage extends Page<V1, UserInfoPayload, UserInfoResource, UserInfoInstance> {
|
|
102
|
+
/**
|
|
103
|
+
* Initialize the UserInfoPage
|
|
104
|
+
*
|
|
105
|
+
* @param version - Version of the resource
|
|
106
|
+
* @param response - Response from the API
|
|
107
|
+
* @param solution - Path solution
|
|
108
|
+
*/
|
|
109
|
+
constructor(version: V1, response: Response<string>, solution: UserInfoSolution);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Build an instance of UserInfoInstance
|
|
113
|
+
*
|
|
114
|
+
* @param payload - Payload response from the API
|
|
115
|
+
*/
|
|
116
|
+
getInstance(payload: UserInfoPayload): UserInfoInstance;
|
|
117
|
+
/**
|
|
118
|
+
* Provide a user-friendly representation
|
|
119
|
+
*/
|
|
120
|
+
toJSON(): any;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export { UserInfoContext, UserInfoInstance, UserInfoList, UserInfoListInstance, UserInfoPage, UserInfoPayload, UserInfoResource, UserInfoSolution }
|
|
@@ -0,0 +1,308 @@
|
|
|
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 UserInfoList;
|
|
19
|
+
var UserInfoPage;
|
|
20
|
+
var UserInfoInstance;
|
|
21
|
+
var UserInfoContext;
|
|
22
|
+
|
|
23
|
+
/* jshint ignore:start */
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the UserInfoList
|
|
26
|
+
*
|
|
27
|
+
* @constructor Twilio.Oauth.V1.UserInfoList
|
|
28
|
+
*
|
|
29
|
+
* @param {Twilio.Oauth.V1} version - Version of the resource
|
|
30
|
+
*/
|
|
31
|
+
/* jshint ignore:end */
|
|
32
|
+
UserInfoList = function UserInfoList(version) {
|
|
33
|
+
/* jshint ignore:start */
|
|
34
|
+
/**
|
|
35
|
+
* @function userInfo
|
|
36
|
+
* @memberof Twilio.Oauth.V1#
|
|
37
|
+
*
|
|
38
|
+
* @param {string} sid - sid of instance
|
|
39
|
+
*
|
|
40
|
+
* @returns {Twilio.Oauth.V1.UserInfoContext}
|
|
41
|
+
*/
|
|
42
|
+
/* jshint ignore:end */
|
|
43
|
+
function UserInfoListInstance(sid) {
|
|
44
|
+
return UserInfoListInstance.get(sid);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
UserInfoListInstance._version = version;
|
|
48
|
+
// Path Solution
|
|
49
|
+
UserInfoListInstance._solution = {};
|
|
50
|
+
/* jshint ignore:start */
|
|
51
|
+
/**
|
|
52
|
+
* Constructs a user_info
|
|
53
|
+
*
|
|
54
|
+
* @function get
|
|
55
|
+
* @memberof Twilio.Oauth.V1.UserInfoList#
|
|
56
|
+
*
|
|
57
|
+
* @returns {Twilio.Oauth.V1.UserInfoContext}
|
|
58
|
+
*/
|
|
59
|
+
/* jshint ignore:end */
|
|
60
|
+
UserInfoListInstance.get = function get() {
|
|
61
|
+
return new UserInfoContext(this._version);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/* jshint ignore:start */
|
|
65
|
+
/**
|
|
66
|
+
* Provide a user-friendly representation
|
|
67
|
+
*
|
|
68
|
+
* @function toJSON
|
|
69
|
+
* @memberof Twilio.Oauth.V1.UserInfoList#
|
|
70
|
+
*
|
|
71
|
+
* @returns Object
|
|
72
|
+
*/
|
|
73
|
+
/* jshint ignore:end */
|
|
74
|
+
UserInfoListInstance.toJSON = function toJSON() {
|
|
75
|
+
return this._solution;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
UserInfoListInstance[util.inspect.custom] = function inspect(depth, options) {
|
|
79
|
+
return util.inspect(this.toJSON(), options);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return UserInfoListInstance;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/* jshint ignore:start */
|
|
87
|
+
/**
|
|
88
|
+
* Initialize the UserInfoPage
|
|
89
|
+
*
|
|
90
|
+
* @constructor Twilio.Oauth.V1.UserInfoPage
|
|
91
|
+
*
|
|
92
|
+
* @param {V1} version - Version of the resource
|
|
93
|
+
* @param {Response<string>} response - Response from the API
|
|
94
|
+
* @param {UserInfoSolution} solution - Path solution
|
|
95
|
+
*
|
|
96
|
+
* @returns UserInfoPage
|
|
97
|
+
*/
|
|
98
|
+
/* jshint ignore:end */
|
|
99
|
+
UserInfoPage = function UserInfoPage(version, response, solution) {
|
|
100
|
+
// Path Solution
|
|
101
|
+
this._solution = solution;
|
|
102
|
+
|
|
103
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_.extend(UserInfoPage.prototype, Page.prototype);
|
|
107
|
+
UserInfoPage.prototype.constructor = UserInfoPage;
|
|
108
|
+
|
|
109
|
+
/* jshint ignore:start */
|
|
110
|
+
/**
|
|
111
|
+
* Build an instance of UserInfoInstance
|
|
112
|
+
*
|
|
113
|
+
* @function getInstance
|
|
114
|
+
* @memberof Twilio.Oauth.V1.UserInfoPage#
|
|
115
|
+
*
|
|
116
|
+
* @param {UserInfoPayload} payload - Payload response from the API
|
|
117
|
+
*
|
|
118
|
+
* @returns UserInfoInstance
|
|
119
|
+
*/
|
|
120
|
+
/* jshint ignore:end */
|
|
121
|
+
UserInfoPage.prototype.getInstance = function getInstance(payload) {
|
|
122
|
+
return new UserInfoInstance(this._version, payload);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/* jshint ignore:start */
|
|
126
|
+
/**
|
|
127
|
+
* Provide a user-friendly representation
|
|
128
|
+
*
|
|
129
|
+
* @function toJSON
|
|
130
|
+
* @memberof Twilio.Oauth.V1.UserInfoPage#
|
|
131
|
+
*
|
|
132
|
+
* @returns Object
|
|
133
|
+
*/
|
|
134
|
+
/* jshint ignore:end */
|
|
135
|
+
UserInfoPage.prototype.toJSON = function toJSON() {
|
|
136
|
+
let clone = {};
|
|
137
|
+
_.forOwn(this, function(value, key) {
|
|
138
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
139
|
+
clone[key] = value;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return clone;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
UserInfoPage.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
146
|
+
return util.inspect(this.toJSON(), options);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
/* jshint ignore:start */
|
|
151
|
+
/**
|
|
152
|
+
* Initialize the UserInfoContext
|
|
153
|
+
*
|
|
154
|
+
* @constructor Twilio.Oauth.V1.UserInfoInstance
|
|
155
|
+
*
|
|
156
|
+
* @property {string} userSid - The user sid
|
|
157
|
+
* @property {string} firstName - The first name of the end-user
|
|
158
|
+
* @property {string} lastName - The last name of the end-user
|
|
159
|
+
* @property {string} friendlyName - The friendly name of the end-user
|
|
160
|
+
* @property {string} email - The end-user's preferred email address
|
|
161
|
+
* @property {string} url - The url
|
|
162
|
+
*
|
|
163
|
+
* @param {V1} version - Version of the resource
|
|
164
|
+
* @param {UserInfoPayload} payload - The instance payload
|
|
165
|
+
*/
|
|
166
|
+
/* jshint ignore:end */
|
|
167
|
+
UserInfoInstance = function UserInfoInstance(version, payload) {
|
|
168
|
+
this._version = version;
|
|
169
|
+
|
|
170
|
+
// Marshaled Properties
|
|
171
|
+
this.userSid = payload.user_sid; // jshint ignore:line
|
|
172
|
+
this.firstName = payload.first_name; // jshint ignore:line
|
|
173
|
+
this.lastName = payload.last_name; // jshint ignore:line
|
|
174
|
+
this.friendlyName = payload.friendly_name; // jshint ignore:line
|
|
175
|
+
this.email = payload.email; // jshint ignore:line
|
|
176
|
+
this.url = payload.url; // jshint ignore:line
|
|
177
|
+
|
|
178
|
+
// Context
|
|
179
|
+
this._context = undefined;
|
|
180
|
+
this._solution = {};
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
Object.defineProperty(UserInfoInstance.prototype,
|
|
184
|
+
'_proxy', {
|
|
185
|
+
get: function() {
|
|
186
|
+
if (!this._context) {
|
|
187
|
+
this._context = new UserInfoContext(this._version);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return this._context;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
/* jshint ignore:start */
|
|
195
|
+
/**
|
|
196
|
+
* fetch a UserInfoInstance
|
|
197
|
+
*
|
|
198
|
+
* @function fetch
|
|
199
|
+
* @memberof Twilio.Oauth.V1.UserInfoInstance#
|
|
200
|
+
*
|
|
201
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
202
|
+
*
|
|
203
|
+
* @returns {Promise} Resolves to processed UserInfoInstance
|
|
204
|
+
*/
|
|
205
|
+
/* jshint ignore:end */
|
|
206
|
+
UserInfoInstance.prototype.fetch = function fetch(callback) {
|
|
207
|
+
return this._proxy.fetch(callback);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/* jshint ignore:start */
|
|
211
|
+
/**
|
|
212
|
+
* Provide a user-friendly representation
|
|
213
|
+
*
|
|
214
|
+
* @function toJSON
|
|
215
|
+
* @memberof Twilio.Oauth.V1.UserInfoInstance#
|
|
216
|
+
*
|
|
217
|
+
* @returns Object
|
|
218
|
+
*/
|
|
219
|
+
/* jshint ignore:end */
|
|
220
|
+
UserInfoInstance.prototype.toJSON = function toJSON() {
|
|
221
|
+
let clone = {};
|
|
222
|
+
_.forOwn(this, function(value, key) {
|
|
223
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
224
|
+
clone[key] = value;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
return clone;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
UserInfoInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
231
|
+
options) {
|
|
232
|
+
return util.inspect(this.toJSON(), options);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
/* jshint ignore:start */
|
|
237
|
+
/**
|
|
238
|
+
* Initialize the UserInfoContext
|
|
239
|
+
*
|
|
240
|
+
* @constructor Twilio.Oauth.V1.UserInfoContext
|
|
241
|
+
*
|
|
242
|
+
* @param {V1} version - Version of the resource
|
|
243
|
+
*/
|
|
244
|
+
/* jshint ignore:end */
|
|
245
|
+
UserInfoContext = function UserInfoContext(version) {
|
|
246
|
+
this._version = version;
|
|
247
|
+
|
|
248
|
+
// Path Solution
|
|
249
|
+
this._solution = {};
|
|
250
|
+
this._uri = `/userinfo`;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/* jshint ignore:start */
|
|
254
|
+
/**
|
|
255
|
+
* fetch a UserInfoInstance
|
|
256
|
+
*
|
|
257
|
+
* @function fetch
|
|
258
|
+
* @memberof Twilio.Oauth.V1.UserInfoContext#
|
|
259
|
+
*
|
|
260
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
261
|
+
*
|
|
262
|
+
* @returns {Promise} Resolves to processed UserInfoInstance
|
|
263
|
+
*/
|
|
264
|
+
/* jshint ignore:end */
|
|
265
|
+
UserInfoContext.prototype.fetch = function fetch(callback) {
|
|
266
|
+
var deferred = Q.defer();
|
|
267
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
268
|
+
|
|
269
|
+
promise = promise.then(function(payload) {
|
|
270
|
+
deferred.resolve(new UserInfoInstance(this._version, payload));
|
|
271
|
+
}.bind(this));
|
|
272
|
+
|
|
273
|
+
promise.catch(function(error) {
|
|
274
|
+
deferred.reject(error);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
if (_.isFunction(callback)) {
|
|
278
|
+
deferred.promise.nodeify(callback);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return deferred.promise;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/* jshint ignore:start */
|
|
285
|
+
/**
|
|
286
|
+
* Provide a user-friendly representation
|
|
287
|
+
*
|
|
288
|
+
* @function toJSON
|
|
289
|
+
* @memberof Twilio.Oauth.V1.UserInfoContext#
|
|
290
|
+
*
|
|
291
|
+
* @returns Object
|
|
292
|
+
*/
|
|
293
|
+
/* jshint ignore:end */
|
|
294
|
+
UserInfoContext.prototype.toJSON = function toJSON() {
|
|
295
|
+
return this._solution;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
UserInfoContext.prototype[util.inspect.custom] = function inspect(depth,
|
|
299
|
+
options) {
|
|
300
|
+
return util.inspect(this.toJSON(), options);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
module.exports = {
|
|
304
|
+
UserInfoList: UserInfoList,
|
|
305
|
+
UserInfoPage: UserInfoPage,
|
|
306
|
+
UserInfoInstance: UserInfoInstance,
|
|
307
|
+
UserInfoContext: UserInfoContext
|
|
308
|
+
};
|
|
@@ -147,14 +147,12 @@ interface ParticipantListInstance {
|
|
|
147
147
|
/**
|
|
148
148
|
* Options to pass to create
|
|
149
149
|
*
|
|
150
|
-
* @property failOnParticipantConflict - An experimental parameter to override the ProxyAllowParticipantConflict account flag on a per-request basis.
|
|
151
150
|
* @property friendlyName - The string that you assigned to describe the participant
|
|
152
151
|
* @property identifier - The phone number of the Participant
|
|
153
152
|
* @property proxyIdentifier - The proxy phone number to use for the Participant
|
|
154
153
|
* @property proxyIdentifierSid - The Proxy Identifier Sid
|
|
155
154
|
*/
|
|
156
155
|
interface ParticipantListInstanceCreateOptions {
|
|
157
|
-
failOnParticipantConflict?: boolean;
|
|
158
156
|
friendlyName?: string;
|
|
159
157
|
identifier: string;
|
|
160
158
|
proxyIdentifier?: string;
|