twilio 3.78.0 → 3.80.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/README.md +5 -1
- package/lib/base/RequestClient.d.ts +15 -5
- package/lib/base/RequestClient.js +36 -7
- package/lib/rest/Microvisor.d.ts +28 -0
- package/lib/rest/Microvisor.js +62 -0
- package/lib/rest/Preview.d.ts +0 -6
- package/lib/rest/Preview.js +0 -28
- package/lib/rest/Routes.d.ts +30 -0
- package/lib/rest/Routes.js +71 -0
- package/lib/rest/Twilio.d.ts +4 -0
- package/lib/rest/Twilio.js +28 -0
- package/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.d.ts +2 -2
- package/lib/rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js +4 -4
- package/lib/rest/conversations/v1/conversation/participant.js +4 -2
- package/lib/rest/conversations/v1/service/conversation/participant.js +4 -2
- package/lib/rest/flexApi/v1/interaction/interactionChannel.d.ts +12 -4
- package/lib/rest/flexApi/v1/interaction/interactionChannel.js +12 -3
- package/lib/rest/lookups/v2/phoneNumber.d.ts +0 -2
- package/lib/rest/lookups/v2/phoneNumber.js +0 -3
- package/lib/rest/microvisor/V1.d.ts +28 -0
- package/lib/rest/microvisor/V1.js +57 -0
- package/lib/rest/{preview/bulk_exports/export/day.d.ts → microvisor/v1/app.d.ts} +79 -69
- package/lib/rest/{preview/bulk_exports/export/day.js → microvisor/v1/app.js} +160 -122
- package/lib/rest/{preview/bulk_exports/export/exportCustomJob.d.ts → microvisor/v1/device.d.ts} +136 -84
- package/lib/rest/microvisor/v1/device.js +652 -0
- package/lib/rest/routes/V2.d.ts +31 -0
- package/lib/rest/routes/V2.js +69 -0
- package/lib/rest/routes/v2/phoneNumber.d.ts +193 -0
- package/lib/rest/routes/v2/phoneNumber.js +466 -0
- package/lib/rest/routes/v2/sipDomain.d.ts +205 -0
- package/lib/rest/routes/v2/sipDomain.js +447 -0
- package/lib/rest/routes/v2/trunk.d.ts +205 -0
- package/lib/rest/routes/v2/trunk.js +458 -0
- package/lib/rest/supersim/v1/fleet.d.ts +3 -1
- package/lib/rest/supersim/v1/fleet.js +8 -3
- package/lib/rest/supersim/v1/sim/simIpAddress.d.ts +246 -0
- package/lib/rest/supersim/v1/sim/simIpAddress.js +448 -0
- package/lib/rest/supersim/v1/sim.d.ts +7 -0
- package/lib/rest/supersim/v1/sim.js +28 -0
- package/lib/rest/verify/v2/service/verificationCheck.d.ts +10 -2
- package/lib/rest/verify/v2/service/verificationCheck.js +9 -7
- package/lib/rest/verify/v2/verificationAttemptsSummary.d.ts +2 -2
- package/lib/rest/verify/v2/verificationAttemptsSummary.js +3 -3
- package/package.json +1 -1
- package/lib/rest/preview/BulkExports.d.ts +0 -28
- package/lib/rest/preview/BulkExports.js +0 -59
- package/lib/rest/preview/bulk_exports/export/exportCustomJob.js +0 -540
- package/lib/rest/preview/bulk_exports/export/job.d.ts +0 -163
- package/lib/rest/preview/bulk_exports/export/job.js +0 -390
- package/lib/rest/preview/bulk_exports/export.d.ts +0 -153
- package/lib/rest/preview/bulk_exports/export.js +0 -402
- package/lib/rest/preview/bulk_exports/exportConfiguration.d.ts +0 -180
- package/lib/rest/preview/bulk_exports/exportConfiguration.js +0 -411
|
@@ -0,0 +1,466 @@
|
|
|
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 PhoneNumberList;
|
|
21
|
+
var PhoneNumberPage;
|
|
22
|
+
var PhoneNumberInstance;
|
|
23
|
+
var PhoneNumberContext;
|
|
24
|
+
|
|
25
|
+
/* jshint ignore:start */
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the PhoneNumberList
|
|
28
|
+
*
|
|
29
|
+
* @constructor Twilio.Routes.V2.PhoneNumberList
|
|
30
|
+
*
|
|
31
|
+
* @param {Twilio.Routes.V2} version - Version of the resource
|
|
32
|
+
*/
|
|
33
|
+
/* jshint ignore:end */
|
|
34
|
+
PhoneNumberList = function PhoneNumberList(version) {
|
|
35
|
+
/* jshint ignore:start */
|
|
36
|
+
/**
|
|
37
|
+
* @function phoneNumbers
|
|
38
|
+
* @memberof Twilio.Routes.V2#
|
|
39
|
+
*
|
|
40
|
+
* @param {string} sid - sid of instance
|
|
41
|
+
*
|
|
42
|
+
* @returns {Twilio.Routes.V2.PhoneNumberContext}
|
|
43
|
+
*/
|
|
44
|
+
/* jshint ignore:end */
|
|
45
|
+
function PhoneNumberListInstance(sid) {
|
|
46
|
+
return PhoneNumberListInstance.get(sid);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
PhoneNumberListInstance._version = version;
|
|
50
|
+
// Path Solution
|
|
51
|
+
PhoneNumberListInstance._solution = {};
|
|
52
|
+
/* jshint ignore:start */
|
|
53
|
+
/**
|
|
54
|
+
* Constructs a phone_number
|
|
55
|
+
*
|
|
56
|
+
* @function get
|
|
57
|
+
* @memberof Twilio.Routes.V2.PhoneNumberList#
|
|
58
|
+
*
|
|
59
|
+
* @param {string} phoneNumber - The phone number
|
|
60
|
+
*
|
|
61
|
+
* @returns {Twilio.Routes.V2.PhoneNumberContext}
|
|
62
|
+
*/
|
|
63
|
+
/* jshint ignore:end */
|
|
64
|
+
PhoneNumberListInstance.get = function get(phoneNumber) {
|
|
65
|
+
return new PhoneNumberContext(this._version, phoneNumber);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/* jshint ignore:start */
|
|
69
|
+
/**
|
|
70
|
+
* Provide a user-friendly representation
|
|
71
|
+
*
|
|
72
|
+
* @function toJSON
|
|
73
|
+
* @memberof Twilio.Routes.V2.PhoneNumberList#
|
|
74
|
+
*
|
|
75
|
+
* @returns Object
|
|
76
|
+
*/
|
|
77
|
+
/* jshint ignore:end */
|
|
78
|
+
PhoneNumberListInstance.toJSON = function toJSON() {
|
|
79
|
+
return this._solution;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
PhoneNumberListInstance[util.inspect.custom] = function inspect(depth, options)
|
|
83
|
+
{
|
|
84
|
+
return util.inspect(this.toJSON(), options);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return PhoneNumberListInstance;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
/* jshint ignore:start */
|
|
92
|
+
/**
|
|
93
|
+
* Initialize the PhoneNumberPage
|
|
94
|
+
*
|
|
95
|
+
* @constructor Twilio.Routes.V2.PhoneNumberPage
|
|
96
|
+
*
|
|
97
|
+
* @param {V2} version - Version of the resource
|
|
98
|
+
* @param {Response<string>} response - Response from the API
|
|
99
|
+
* @param {PhoneNumberSolution} solution - Path solution
|
|
100
|
+
*
|
|
101
|
+
* @returns PhoneNumberPage
|
|
102
|
+
*/
|
|
103
|
+
/* jshint ignore:end */
|
|
104
|
+
PhoneNumberPage = function PhoneNumberPage(version, response, solution) {
|
|
105
|
+
// Path Solution
|
|
106
|
+
this._solution = solution;
|
|
107
|
+
|
|
108
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
_.extend(PhoneNumberPage.prototype, Page.prototype);
|
|
112
|
+
PhoneNumberPage.prototype.constructor = PhoneNumberPage;
|
|
113
|
+
|
|
114
|
+
/* jshint ignore:start */
|
|
115
|
+
/**
|
|
116
|
+
* Build an instance of PhoneNumberInstance
|
|
117
|
+
*
|
|
118
|
+
* @function getInstance
|
|
119
|
+
* @memberof Twilio.Routes.V2.PhoneNumberPage#
|
|
120
|
+
*
|
|
121
|
+
* @param {PhoneNumberPayload} payload - Payload response from the API
|
|
122
|
+
*
|
|
123
|
+
* @returns PhoneNumberInstance
|
|
124
|
+
*/
|
|
125
|
+
/* jshint ignore:end */
|
|
126
|
+
PhoneNumberPage.prototype.getInstance = function getInstance(payload) {
|
|
127
|
+
return new PhoneNumberInstance(this._version, payload);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/* jshint ignore:start */
|
|
131
|
+
/**
|
|
132
|
+
* Provide a user-friendly representation
|
|
133
|
+
*
|
|
134
|
+
* @function toJSON
|
|
135
|
+
* @memberof Twilio.Routes.V2.PhoneNumberPage#
|
|
136
|
+
*
|
|
137
|
+
* @returns Object
|
|
138
|
+
*/
|
|
139
|
+
/* jshint ignore:end */
|
|
140
|
+
PhoneNumberPage.prototype.toJSON = function toJSON() {
|
|
141
|
+
let clone = {};
|
|
142
|
+
_.forOwn(this, function(value, key) {
|
|
143
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
144
|
+
clone[key] = value;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return clone;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
PhoneNumberPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
151
|
+
options) {
|
|
152
|
+
return util.inspect(this.toJSON(), options);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
/* jshint ignore:start */
|
|
157
|
+
/**
|
|
158
|
+
* Initialize the PhoneNumberContext
|
|
159
|
+
*
|
|
160
|
+
* @constructor Twilio.Routes.V2.PhoneNumberInstance
|
|
161
|
+
*
|
|
162
|
+
* @property {string} phoneNumber - The phone number
|
|
163
|
+
* @property {string} url - The absolute URL of the resource
|
|
164
|
+
* @property {string} sid -
|
|
165
|
+
* A string that uniquely identifies the Inbound Processing Region assignments for this phone number.
|
|
166
|
+
* @property {string} accountSid - Account Sid.
|
|
167
|
+
* @property {string} friendlyName -
|
|
168
|
+
* A human readable description of the Inbound Processing Region assignments for this phone number.
|
|
169
|
+
* @property {string} voiceRegion -
|
|
170
|
+
* The Inbound Processing Region used for this phone number for voice.
|
|
171
|
+
* @property {Date} dateCreated -
|
|
172
|
+
* The date that this phone number was assigned an Inbound Processing Region.
|
|
173
|
+
* @property {Date} dateUpdated -
|
|
174
|
+
* The date that the Inbound Processing Region was updated for this phone number.
|
|
175
|
+
*
|
|
176
|
+
* @param {V2} version - Version of the resource
|
|
177
|
+
* @param {PhoneNumberPayload} payload - The instance payload
|
|
178
|
+
* @param {string} phoneNumber - The phone number
|
|
179
|
+
*/
|
|
180
|
+
/* jshint ignore:end */
|
|
181
|
+
PhoneNumberInstance = function PhoneNumberInstance(version, payload,
|
|
182
|
+
phoneNumber) {
|
|
183
|
+
this._version = version;
|
|
184
|
+
|
|
185
|
+
// Marshaled Properties
|
|
186
|
+
this.phoneNumber = payload.phone_number; // jshint ignore:line
|
|
187
|
+
this.url = payload.url; // jshint ignore:line
|
|
188
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
189
|
+
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
190
|
+
this.friendlyName = payload.friendly_name; // jshint ignore:line
|
|
191
|
+
this.voiceRegion = payload.voice_region; // jshint ignore:line
|
|
192
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
|
|
193
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
|
|
194
|
+
|
|
195
|
+
// Context
|
|
196
|
+
this._context = undefined;
|
|
197
|
+
this._solution = {phoneNumber: phoneNumber || this.phoneNumber, };
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
Object.defineProperty(PhoneNumberInstance.prototype,
|
|
201
|
+
'_proxy', {
|
|
202
|
+
get: function() {
|
|
203
|
+
if (!this._context) {
|
|
204
|
+
this._context = new PhoneNumberContext(this._version, this._solution.phoneNumber);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return this._context;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
/* jshint ignore:start */
|
|
212
|
+
/**
|
|
213
|
+
* create a PhoneNumberInstance
|
|
214
|
+
*
|
|
215
|
+
* @function create
|
|
216
|
+
* @memberof Twilio.Routes.V2.PhoneNumberInstance#
|
|
217
|
+
*
|
|
218
|
+
* @param {object} [opts] - Options for request
|
|
219
|
+
* @param {string} [opts.voiceRegion] -
|
|
220
|
+
* The Inbound Processing Region used for this phone number for voice
|
|
221
|
+
* @param {string} [opts.friendlyName] -
|
|
222
|
+
* A human readable description of this resource.
|
|
223
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
224
|
+
*
|
|
225
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
226
|
+
*/
|
|
227
|
+
/* jshint ignore:end */
|
|
228
|
+
PhoneNumberInstance.prototype.create = function create(opts, callback) {
|
|
229
|
+
return this._proxy.create(opts, callback);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/* jshint ignore:start */
|
|
233
|
+
/**
|
|
234
|
+
* update a PhoneNumberInstance
|
|
235
|
+
*
|
|
236
|
+
* @function update
|
|
237
|
+
* @memberof Twilio.Routes.V2.PhoneNumberInstance#
|
|
238
|
+
*
|
|
239
|
+
* @param {object} opts - Options for request
|
|
240
|
+
* @param {string} opts.voiceRegion -
|
|
241
|
+
* The Inbound Processing Region used for this phone number for voice
|
|
242
|
+
* @param {string} opts.friendlyName -
|
|
243
|
+
* A human readable description of this resource.
|
|
244
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
245
|
+
*
|
|
246
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
247
|
+
*/
|
|
248
|
+
/* jshint ignore:end */
|
|
249
|
+
PhoneNumberInstance.prototype.update = function update(opts, callback) {
|
|
250
|
+
return this._proxy.update(opts, callback);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/* jshint ignore:start */
|
|
254
|
+
/**
|
|
255
|
+
* fetch a PhoneNumberInstance
|
|
256
|
+
*
|
|
257
|
+
* @function fetch
|
|
258
|
+
* @memberof Twilio.Routes.V2.PhoneNumberInstance#
|
|
259
|
+
*
|
|
260
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
261
|
+
*
|
|
262
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
263
|
+
*/
|
|
264
|
+
/* jshint ignore:end */
|
|
265
|
+
PhoneNumberInstance.prototype.fetch = function fetch(callback) {
|
|
266
|
+
return this._proxy.fetch(callback);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/* jshint ignore:start */
|
|
270
|
+
/**
|
|
271
|
+
* Provide a user-friendly representation
|
|
272
|
+
*
|
|
273
|
+
* @function toJSON
|
|
274
|
+
* @memberof Twilio.Routes.V2.PhoneNumberInstance#
|
|
275
|
+
*
|
|
276
|
+
* @returns Object
|
|
277
|
+
*/
|
|
278
|
+
/* jshint ignore:end */
|
|
279
|
+
PhoneNumberInstance.prototype.toJSON = function toJSON() {
|
|
280
|
+
let clone = {};
|
|
281
|
+
_.forOwn(this, function(value, key) {
|
|
282
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
283
|
+
clone[key] = value;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
return clone;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
PhoneNumberInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
290
|
+
options) {
|
|
291
|
+
return util.inspect(this.toJSON(), options);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
/* jshint ignore:start */
|
|
296
|
+
/**
|
|
297
|
+
* Initialize the PhoneNumberContext
|
|
298
|
+
*
|
|
299
|
+
* @constructor Twilio.Routes.V2.PhoneNumberContext
|
|
300
|
+
*
|
|
301
|
+
* @param {V2} version - Version of the resource
|
|
302
|
+
* @param {string} phoneNumber - The phone number
|
|
303
|
+
*/
|
|
304
|
+
/* jshint ignore:end */
|
|
305
|
+
PhoneNumberContext = function PhoneNumberContext(version, phoneNumber) {
|
|
306
|
+
this._version = version;
|
|
307
|
+
|
|
308
|
+
// Path Solution
|
|
309
|
+
this._solution = {phoneNumber: phoneNumber, };
|
|
310
|
+
this._uri = `/PhoneNumbers/${phoneNumber}`;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/* jshint ignore:start */
|
|
314
|
+
/**
|
|
315
|
+
* create a PhoneNumberInstance
|
|
316
|
+
*
|
|
317
|
+
* @function create
|
|
318
|
+
* @memberof Twilio.Routes.V2.PhoneNumberContext#
|
|
319
|
+
*
|
|
320
|
+
* @param {object} [opts] - Options for request
|
|
321
|
+
* @param {string} [opts.voiceRegion] -
|
|
322
|
+
* The Inbound Processing Region used for this phone number for voice
|
|
323
|
+
* @param {string} [opts.friendlyName] -
|
|
324
|
+
* A human readable description of this resource.
|
|
325
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
326
|
+
*
|
|
327
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
328
|
+
*/
|
|
329
|
+
/* jshint ignore:end */
|
|
330
|
+
PhoneNumberContext.prototype.create = function create(opts, callback) {
|
|
331
|
+
if (_.isFunction(opts)) {
|
|
332
|
+
callback = opts;
|
|
333
|
+
opts = {};
|
|
334
|
+
}
|
|
335
|
+
opts = opts || {};
|
|
336
|
+
|
|
337
|
+
var deferred = Q.defer();
|
|
338
|
+
var data = values.of({
|
|
339
|
+
'VoiceRegion': _.get(opts, 'voiceRegion'),
|
|
340
|
+
'FriendlyName': _.get(opts, 'friendlyName')
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
|
|
344
|
+
|
|
345
|
+
promise = promise.then(function(payload) {
|
|
346
|
+
deferred.resolve(new PhoneNumberInstance(this._version, payload, this._solution.phoneNumber));
|
|
347
|
+
}.bind(this));
|
|
348
|
+
|
|
349
|
+
promise.catch(function(error) {
|
|
350
|
+
deferred.reject(error);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
if (_.isFunction(callback)) {
|
|
354
|
+
deferred.promise.nodeify(callback);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return deferred.promise;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/* jshint ignore:start */
|
|
361
|
+
/**
|
|
362
|
+
* update a PhoneNumberInstance
|
|
363
|
+
*
|
|
364
|
+
* @function update
|
|
365
|
+
* @memberof Twilio.Routes.V2.PhoneNumberContext#
|
|
366
|
+
*
|
|
367
|
+
* @param {object} opts - Options for request
|
|
368
|
+
* @param {string} opts.voiceRegion -
|
|
369
|
+
* The Inbound Processing Region used for this phone number for voice
|
|
370
|
+
* @param {string} opts.friendlyName -
|
|
371
|
+
* A human readable description of this resource.
|
|
372
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
373
|
+
*
|
|
374
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
375
|
+
*/
|
|
376
|
+
/* jshint ignore:end */
|
|
377
|
+
PhoneNumberContext.prototype.update = function update(opts, callback) {
|
|
378
|
+
if (_.isUndefined(opts)) {
|
|
379
|
+
throw new Error('Required parameter "opts" missing.');
|
|
380
|
+
}
|
|
381
|
+
if (_.isUndefined(opts['voiceRegion'])) {
|
|
382
|
+
throw new Error('Required parameter "opts[\'voiceRegion\']" missing.');
|
|
383
|
+
}
|
|
384
|
+
if (_.isUndefined(opts['friendlyName'])) {
|
|
385
|
+
throw new Error('Required parameter "opts[\'friendlyName\']" missing.');
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
var deferred = Q.defer();
|
|
389
|
+
var data = values.of({
|
|
390
|
+
'VoiceRegion': _.get(opts, 'voiceRegion'),
|
|
391
|
+
'FriendlyName': _.get(opts, 'friendlyName')
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
var promise = this._version.update({uri: this._uri, method: 'POST', data: data});
|
|
395
|
+
|
|
396
|
+
promise = promise.then(function(payload) {
|
|
397
|
+
deferred.resolve(new PhoneNumberInstance(this._version, payload, this._solution.phoneNumber));
|
|
398
|
+
}.bind(this));
|
|
399
|
+
|
|
400
|
+
promise.catch(function(error) {
|
|
401
|
+
deferred.reject(error);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
if (_.isFunction(callback)) {
|
|
405
|
+
deferred.promise.nodeify(callback);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return deferred.promise;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
/* jshint ignore:start */
|
|
412
|
+
/**
|
|
413
|
+
* fetch a PhoneNumberInstance
|
|
414
|
+
*
|
|
415
|
+
* @function fetch
|
|
416
|
+
* @memberof Twilio.Routes.V2.PhoneNumberContext#
|
|
417
|
+
*
|
|
418
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
419
|
+
*
|
|
420
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
421
|
+
*/
|
|
422
|
+
/* jshint ignore:end */
|
|
423
|
+
PhoneNumberContext.prototype.fetch = function fetch(callback) {
|
|
424
|
+
var deferred = Q.defer();
|
|
425
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
426
|
+
|
|
427
|
+
promise = promise.then(function(payload) {
|
|
428
|
+
deferred.resolve(new PhoneNumberInstance(this._version, payload, this._solution.phoneNumber));
|
|
429
|
+
}.bind(this));
|
|
430
|
+
|
|
431
|
+
promise.catch(function(error) {
|
|
432
|
+
deferred.reject(error);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
if (_.isFunction(callback)) {
|
|
436
|
+
deferred.promise.nodeify(callback);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return deferred.promise;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
/* jshint ignore:start */
|
|
443
|
+
/**
|
|
444
|
+
* Provide a user-friendly representation
|
|
445
|
+
*
|
|
446
|
+
* @function toJSON
|
|
447
|
+
* @memberof Twilio.Routes.V2.PhoneNumberContext#
|
|
448
|
+
*
|
|
449
|
+
* @returns Object
|
|
450
|
+
*/
|
|
451
|
+
/* jshint ignore:end */
|
|
452
|
+
PhoneNumberContext.prototype.toJSON = function toJSON() {
|
|
453
|
+
return this._solution;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
PhoneNumberContext.prototype[util.inspect.custom] = function inspect(depth,
|
|
457
|
+
options) {
|
|
458
|
+
return util.inspect(this.toJSON(), options);
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
module.exports = {
|
|
462
|
+
PhoneNumberList: PhoneNumberList,
|
|
463
|
+
PhoneNumberPage: PhoneNumberPage,
|
|
464
|
+
PhoneNumberInstance: PhoneNumberInstance,
|
|
465
|
+
PhoneNumberContext: PhoneNumberContext
|
|
466
|
+
};
|
|
@@ -0,0 +1,205 @@
|
|
|
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 V2 = require('../V2');
|
|
11
|
+
import { SerializableClass } from '../../../interfaces';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initialize the SipDomainList
|
|
15
|
+
*
|
|
16
|
+
* @param version - Version of the resource
|
|
17
|
+
*/
|
|
18
|
+
declare function SipDomainList(version: V2): SipDomainListInstance;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Options to pass to create
|
|
22
|
+
*
|
|
23
|
+
* @property friendlyName - The friendly_name
|
|
24
|
+
* @property voiceRegion - The voice_region
|
|
25
|
+
*/
|
|
26
|
+
interface SipDomainInstanceCreateOptions {
|
|
27
|
+
friendlyName?: string;
|
|
28
|
+
voiceRegion?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Options to pass to update
|
|
33
|
+
*
|
|
34
|
+
* @property friendlyName - The friendly_name
|
|
35
|
+
* @property voiceRegion - The voice_region
|
|
36
|
+
*/
|
|
37
|
+
interface SipDomainInstanceUpdateOptions {
|
|
38
|
+
friendlyName?: string;
|
|
39
|
+
voiceRegion?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface SipDomainListInstance {
|
|
43
|
+
/**
|
|
44
|
+
* @param sid - sid of instance
|
|
45
|
+
*/
|
|
46
|
+
(sid: string): SipDomainContext;
|
|
47
|
+
/**
|
|
48
|
+
* Constructs a sip_domain
|
|
49
|
+
*
|
|
50
|
+
* @param sipDomain - The sip_domain
|
|
51
|
+
*/
|
|
52
|
+
get(sipDomain: string): SipDomainContext;
|
|
53
|
+
/**
|
|
54
|
+
* Provide a user-friendly representation
|
|
55
|
+
*/
|
|
56
|
+
toJSON(): any;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface SipDomainPayload extends SipDomainResource, Page.TwilioResponsePayload {
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface SipDomainResource {
|
|
63
|
+
account_sid: string;
|
|
64
|
+
date_created: Date;
|
|
65
|
+
date_updated: Date;
|
|
66
|
+
friendly_name: string;
|
|
67
|
+
sid: string;
|
|
68
|
+
sip_domain: string;
|
|
69
|
+
url: string;
|
|
70
|
+
voice_region: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface SipDomainSolution {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
declare class SipDomainContext {
|
|
78
|
+
/**
|
|
79
|
+
* Initialize the SipDomainContext
|
|
80
|
+
*
|
|
81
|
+
* @param version - Version of the resource
|
|
82
|
+
* @param sipDomain - The sip_domain
|
|
83
|
+
*/
|
|
84
|
+
constructor(version: V2, sipDomain: string);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* create a SipDomainInstance
|
|
88
|
+
*
|
|
89
|
+
* @param callback - Callback to handle processed record
|
|
90
|
+
*/
|
|
91
|
+
create(callback?: (error: Error | null, item: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
92
|
+
/**
|
|
93
|
+
* create a SipDomainInstance
|
|
94
|
+
*
|
|
95
|
+
* @param opts - Options for request
|
|
96
|
+
* @param callback - Callback to handle processed record
|
|
97
|
+
*/
|
|
98
|
+
create(opts?: SipDomainInstanceCreateOptions, callback?: (error: Error | null, item: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
99
|
+
/**
|
|
100
|
+
* fetch a SipDomainInstance
|
|
101
|
+
*
|
|
102
|
+
* @param callback - Callback to handle processed record
|
|
103
|
+
*/
|
|
104
|
+
fetch(callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
105
|
+
/**
|
|
106
|
+
* Provide a user-friendly representation
|
|
107
|
+
*/
|
|
108
|
+
toJSON(): any;
|
|
109
|
+
/**
|
|
110
|
+
* update a SipDomainInstance
|
|
111
|
+
*
|
|
112
|
+
* @param callback - Callback to handle processed record
|
|
113
|
+
*/
|
|
114
|
+
update(callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
115
|
+
/**
|
|
116
|
+
* update a SipDomainInstance
|
|
117
|
+
*
|
|
118
|
+
* @param opts - Options for request
|
|
119
|
+
* @param callback - Callback to handle processed record
|
|
120
|
+
*/
|
|
121
|
+
update(opts?: SipDomainInstanceUpdateOptions, callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
declare class SipDomainInstance extends SerializableClass {
|
|
126
|
+
/**
|
|
127
|
+
* Initialize the SipDomainContext
|
|
128
|
+
*
|
|
129
|
+
* @param version - Version of the resource
|
|
130
|
+
* @param payload - The instance payload
|
|
131
|
+
* @param sipDomain - The sip_domain
|
|
132
|
+
*/
|
|
133
|
+
constructor(version: V2, payload: SipDomainPayload, sipDomain: string);
|
|
134
|
+
|
|
135
|
+
private _proxy: SipDomainContext;
|
|
136
|
+
accountSid: string;
|
|
137
|
+
/**
|
|
138
|
+
* create a SipDomainInstance
|
|
139
|
+
*
|
|
140
|
+
* @param callback - Callback to handle processed record
|
|
141
|
+
*/
|
|
142
|
+
create(callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
143
|
+
/**
|
|
144
|
+
* create a SipDomainInstance
|
|
145
|
+
*
|
|
146
|
+
* @param opts - Options for request
|
|
147
|
+
* @param callback - Callback to handle processed record
|
|
148
|
+
*/
|
|
149
|
+
create(opts?: SipDomainInstanceCreateOptions, callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
150
|
+
dateCreated: Date;
|
|
151
|
+
dateUpdated: Date;
|
|
152
|
+
/**
|
|
153
|
+
* fetch a SipDomainInstance
|
|
154
|
+
*
|
|
155
|
+
* @param callback - Callback to handle processed record
|
|
156
|
+
*/
|
|
157
|
+
fetch(callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
158
|
+
friendlyName: string;
|
|
159
|
+
sid: string;
|
|
160
|
+
sipDomain: string;
|
|
161
|
+
/**
|
|
162
|
+
* Provide a user-friendly representation
|
|
163
|
+
*/
|
|
164
|
+
toJSON(): any;
|
|
165
|
+
/**
|
|
166
|
+
* update a SipDomainInstance
|
|
167
|
+
*
|
|
168
|
+
* @param callback - Callback to handle processed record
|
|
169
|
+
*/
|
|
170
|
+
update(callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
171
|
+
/**
|
|
172
|
+
* update a SipDomainInstance
|
|
173
|
+
*
|
|
174
|
+
* @param opts - Options for request
|
|
175
|
+
* @param callback - Callback to handle processed record
|
|
176
|
+
*/
|
|
177
|
+
update(opts?: SipDomainInstanceUpdateOptions, callback?: (error: Error | null, items: SipDomainInstance) => any): Promise<SipDomainInstance>;
|
|
178
|
+
url: string;
|
|
179
|
+
voiceRegion: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
declare class SipDomainPage extends Page<V2, SipDomainPayload, SipDomainResource, SipDomainInstance> {
|
|
184
|
+
/**
|
|
185
|
+
* Initialize the SipDomainPage
|
|
186
|
+
*
|
|
187
|
+
* @param version - Version of the resource
|
|
188
|
+
* @param response - Response from the API
|
|
189
|
+
* @param solution - Path solution
|
|
190
|
+
*/
|
|
191
|
+
constructor(version: V2, response: Response<string>, solution: SipDomainSolution);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Build an instance of SipDomainInstance
|
|
195
|
+
*
|
|
196
|
+
* @param payload - Payload response from the API
|
|
197
|
+
*/
|
|
198
|
+
getInstance(payload: SipDomainPayload): SipDomainInstance;
|
|
199
|
+
/**
|
|
200
|
+
* Provide a user-friendly representation
|
|
201
|
+
*/
|
|
202
|
+
toJSON(): any;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { SipDomainContext, SipDomainInstance, SipDomainInstanceCreateOptions, SipDomainInstanceUpdateOptions, SipDomainList, SipDomainListInstance, SipDomainPage, SipDomainPayload, SipDomainResource, SipDomainSolution }
|