twilio 3.77.2 → 3.79.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.
- package/README.md +1 -1
- package/lib/rest/Insights.d.ts +0 -2
- package/lib/rest/Insights.js +0 -8
- package/lib/rest/Lookups.d.ts +2 -0
- package/lib/rest/Lookups.js +11 -0
- package/lib/rest/api/v2010/account/call/payment.d.ts +1 -1
- package/lib/rest/api/v2010/account/call/payment.js +1 -1
- package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
- package/lib/rest/conversations/v1/conversation/participant.js +4 -2
- package/lib/rest/conversations/v1/service/conversation/participant.js +4 -2
- package/lib/rest/insights/V1.d.ts +0 -3
- package/lib/rest/insights/V1.js +0 -11
- package/lib/rest/insights/v1/{annotation.d.ts → call/annotation.d.ts} +29 -17
- package/lib/rest/insights/v1/{annotation.js → call/annotation.js} +72 -55
- package/lib/rest/insights/v1/call/summary.d.ts +2 -0
- package/lib/rest/insights/v1/call/summary.js +2 -0
- package/lib/rest/insights/v1/call.d.ts +7 -16
- package/lib/rest/insights/v1/call.js +28 -16
- package/lib/rest/lookups/V2.d.ts +25 -0
- package/lib/rest/lookups/V2.js +47 -0
- package/lib/rest/lookups/v2/phoneNumber.d.ts +180 -0
- package/lib/rest/lookups/v2/phoneNumber.js +359 -0
- package/lib/rest/media/v1/mediaRecording.d.ts +2 -4
- package/lib/rest/media/v1/mediaRecording.js +2 -4
- 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 +8 -2
- package/lib/rest/verify/v2/service/verificationCheck.js +8 -9
- package/lib/twiml/VoiceResponse.d.ts +81 -4
- package/lib/twiml/VoiceResponse.js +111 -3
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
var Q = require('q'); /* jshint ignore:line */
|
|
13
13
|
var _ = require('lodash'); /* jshint ignore:line */
|
|
14
14
|
var util = require('util'); /* jshint ignore:line */
|
|
15
|
+
var AnnotationList = require('./call/annotation').AnnotationList;
|
|
15
16
|
var CallSummaryList = require('./call/summary').CallSummaryList;
|
|
16
17
|
var EventList = require('./call/event').EventList;
|
|
17
18
|
var MetricList = require('./call/metric').MetricList;
|
|
@@ -27,10 +28,6 @@ var CallContext;
|
|
|
27
28
|
/**
|
|
28
29
|
* Initialize the CallList
|
|
29
30
|
*
|
|
30
|
-
* PLEASE NOTE that this class contains preview products that are subject to
|
|
31
|
-
* change. Use them with caution. If you currently do not have developer preview
|
|
32
|
-
* access, please contact help@twilio.com.
|
|
33
|
-
*
|
|
34
31
|
* @constructor Twilio.Insights.V1.CallList
|
|
35
32
|
*
|
|
36
33
|
* @param {Twilio.Insights.V1} version - Version of the resource
|
|
@@ -96,10 +93,6 @@ CallList = function CallList(version) {
|
|
|
96
93
|
/**
|
|
97
94
|
* Initialize the CallPage
|
|
98
95
|
*
|
|
99
|
-
* PLEASE NOTE that this class contains preview products that are subject to
|
|
100
|
-
* change. Use them with caution. If you currently do not have developer preview
|
|
101
|
-
* access, please contact help@twilio.com.
|
|
102
|
-
*
|
|
103
96
|
* @constructor Twilio.Insights.V1.CallPage
|
|
104
97
|
*
|
|
105
98
|
* @param {V1} version - Version of the resource
|
|
@@ -164,10 +157,6 @@ CallPage.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
|
164
157
|
/**
|
|
165
158
|
* Initialize the CallContext
|
|
166
159
|
*
|
|
167
|
-
* PLEASE NOTE that this class contains preview products that are subject to
|
|
168
|
-
* change. Use them with caution. If you currently do not have developer preview
|
|
169
|
-
* access, please contact help@twilio.com.
|
|
170
|
-
*
|
|
171
160
|
* @constructor Twilio.Insights.V1.CallInstance
|
|
172
161
|
*
|
|
173
162
|
* @property {string} sid - The sid
|
|
@@ -261,6 +250,20 @@ CallInstance.prototype.summary = function summary() {
|
|
|
261
250
|
return this._proxy.summary;
|
|
262
251
|
};
|
|
263
252
|
|
|
253
|
+
/* jshint ignore:start */
|
|
254
|
+
/**
|
|
255
|
+
* Access the annotation
|
|
256
|
+
*
|
|
257
|
+
* @function annotation
|
|
258
|
+
* @memberof Twilio.Insights.V1.CallInstance#
|
|
259
|
+
*
|
|
260
|
+
* @returns {Twilio.Insights.V1.CallContext.AnnotationList}
|
|
261
|
+
*/
|
|
262
|
+
/* jshint ignore:end */
|
|
263
|
+
CallInstance.prototype.annotation = function annotation() {
|
|
264
|
+
return this._proxy.annotation;
|
|
265
|
+
};
|
|
266
|
+
|
|
264
267
|
/* jshint ignore:start */
|
|
265
268
|
/**
|
|
266
269
|
* Provide a user-friendly representation
|
|
@@ -290,16 +293,14 @@ CallInstance.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
|
290
293
|
/**
|
|
291
294
|
* Initialize the CallContext
|
|
292
295
|
*
|
|
293
|
-
* PLEASE NOTE that this class contains preview products that are subject to
|
|
294
|
-
* change. Use them with caution. If you currently do not have developer preview
|
|
295
|
-
* access, please contact help@twilio.com.
|
|
296
|
-
*
|
|
297
296
|
* @constructor Twilio.Insights.V1.CallContext
|
|
298
297
|
*
|
|
299
298
|
* @property {Twilio.Insights.V1.CallContext.EventList} events - events resource
|
|
300
299
|
* @property {Twilio.Insights.V1.CallContext.MetricList} metrics - metrics resource
|
|
301
300
|
* @property {Twilio.Insights.V1.CallContext.CallSummaryList} summary -
|
|
302
301
|
* summary resource
|
|
302
|
+
* @property {Twilio.Insights.V1.CallContext.AnnotationList} annotation -
|
|
303
|
+
* annotation resource
|
|
303
304
|
*
|
|
304
305
|
* @param {V1} version - Version of the resource
|
|
305
306
|
* @param {sid} sid - The sid
|
|
@@ -316,6 +317,7 @@ CallContext = function CallContext(version, sid) {
|
|
|
316
317
|
this._events = undefined;
|
|
317
318
|
this._metrics = undefined;
|
|
318
319
|
this._summary = undefined;
|
|
320
|
+
this._annotation = undefined;
|
|
319
321
|
};
|
|
320
322
|
|
|
321
323
|
/* jshint ignore:start */
|
|
@@ -379,6 +381,16 @@ Object.defineProperty(CallContext.prototype,
|
|
|
379
381
|
}
|
|
380
382
|
});
|
|
381
383
|
|
|
384
|
+
Object.defineProperty(CallContext.prototype,
|
|
385
|
+
'annotation', {
|
|
386
|
+
get: function() {
|
|
387
|
+
if (!this._annotation) {
|
|
388
|
+
this._annotation = new AnnotationList(this._version, this._solution.sid);
|
|
389
|
+
}
|
|
390
|
+
return this._annotation;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
|
|
382
394
|
/* jshint ignore:start */
|
|
383
395
|
/**
|
|
384
396
|
* Provide a user-friendly representation
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by
|
|
3
|
+
* \ / _ _ _| _ _
|
|
4
|
+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
* / /
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import Lookups = require('../Lookups');
|
|
9
|
+
import Version = require('../../base/Version');
|
|
10
|
+
import { PhoneNumberList } from './v2/phoneNumber';
|
|
11
|
+
import { PhoneNumberListInstance } from './v2/phoneNumber';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
declare class V2 extends Version {
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the V2 version of Lookups
|
|
17
|
+
*
|
|
18
|
+
* @param domain - The twilio domain
|
|
19
|
+
*/
|
|
20
|
+
constructor(domain: Lookups);
|
|
21
|
+
|
|
22
|
+
readonly phoneNumbers: PhoneNumberListInstance;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export = V2;
|
|
@@ -0,0 +1,47 @@
|
|
|
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 _ = require('lodash'); /* jshint ignore:line */
|
|
13
|
+
var PhoneNumberList = require('./v2/phoneNumber').PhoneNumberList;
|
|
14
|
+
var Version = require('../../base/Version'); /* jshint ignore:line */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* jshint ignore:start */
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the V2 version of Lookups
|
|
20
|
+
*
|
|
21
|
+
* @constructor Twilio.Lookups.V2
|
|
22
|
+
*
|
|
23
|
+
* @property {Twilio.Lookups.V2.PhoneNumberList} phoneNumbers -
|
|
24
|
+
* phoneNumbers resource
|
|
25
|
+
*
|
|
26
|
+
* @param {Twilio.Lookups} domain - The twilio domain
|
|
27
|
+
*/
|
|
28
|
+
/* jshint ignore:end */
|
|
29
|
+
function V2(domain) {
|
|
30
|
+
Version.prototype.constructor.call(this, domain, 'v2');
|
|
31
|
+
|
|
32
|
+
// Resources
|
|
33
|
+
this._phoneNumbers = undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_.extend(V2.prototype, Version.prototype);
|
|
37
|
+
V2.prototype.constructor = V2;
|
|
38
|
+
|
|
39
|
+
Object.defineProperty(V2.prototype,
|
|
40
|
+
'phoneNumbers', {
|
|
41
|
+
get: function() {
|
|
42
|
+
this._phoneNumbers = this._phoneNumbers || new PhoneNumberList(this);
|
|
43
|
+
return this._phoneNumbers;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
module.exports = V2;
|
|
@@ -0,0 +1,180 @@
|
|
|
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
|
+
type PhoneNumberType = 'landline'|'mobile'|'voip';
|
|
14
|
+
|
|
15
|
+
type PhoneNumberValidationError = 'TOO_SHORT'|'TOO_LONG'|'INVALID_BUT_POSSIBLE'|'INVALID_COUNTRY_CODE'|'INVALID_LENGTH'|'NOT_A_NUMBER';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the PhoneNumberList
|
|
19
|
+
*
|
|
20
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
21
|
+
* Use them with caution.
|
|
22
|
+
*
|
|
23
|
+
* @param version - Version of the resource
|
|
24
|
+
*/
|
|
25
|
+
declare function PhoneNumberList(version: V2): PhoneNumberListInstance;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Options to pass to fetch
|
|
29
|
+
*
|
|
30
|
+
* @property countryCode - Country code for national phone number lookups
|
|
31
|
+
* @property fields - Fields to return
|
|
32
|
+
*/
|
|
33
|
+
interface PhoneNumberInstanceFetchOptions {
|
|
34
|
+
countryCode?: string;
|
|
35
|
+
fields?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface PhoneNumberListInstance {
|
|
39
|
+
/**
|
|
40
|
+
* @param sid - sid of instance
|
|
41
|
+
*/
|
|
42
|
+
(sid: string): PhoneNumberContext;
|
|
43
|
+
/**
|
|
44
|
+
* Constructs a phone_number
|
|
45
|
+
*
|
|
46
|
+
* @param phoneNumber - Phone number to lookup
|
|
47
|
+
*/
|
|
48
|
+
get(phoneNumber: string): PhoneNumberContext;
|
|
49
|
+
/**
|
|
50
|
+
* Provide a user-friendly representation
|
|
51
|
+
*/
|
|
52
|
+
toJSON(): any;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface PhoneNumberPayload extends PhoneNumberResource, Page.TwilioResponsePayload {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface PhoneNumberResource {
|
|
59
|
+
call_forwarding: object;
|
|
60
|
+
caller_name: object;
|
|
61
|
+
calling_country_code: string;
|
|
62
|
+
country_code: string;
|
|
63
|
+
line_type_intelligence: object;
|
|
64
|
+
live_activity: object;
|
|
65
|
+
national_format: string;
|
|
66
|
+
phone_number: string;
|
|
67
|
+
sim_swap: object;
|
|
68
|
+
url: string;
|
|
69
|
+
valid: boolean;
|
|
70
|
+
validation_errors: PhoneNumberValidationError[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface PhoneNumberSolution {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
declare class PhoneNumberContext {
|
|
78
|
+
/**
|
|
79
|
+
* Initialize the PhoneNumberContext
|
|
80
|
+
*
|
|
81
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
82
|
+
* Use them with caution.
|
|
83
|
+
*
|
|
84
|
+
* @param version - Version of the resource
|
|
85
|
+
* @param phoneNumber - Phone number to lookup
|
|
86
|
+
*/
|
|
87
|
+
constructor(version: V2, phoneNumber: string);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* fetch a PhoneNumberInstance
|
|
91
|
+
*
|
|
92
|
+
* @param callback - Callback to handle processed record
|
|
93
|
+
*/
|
|
94
|
+
fetch(callback?: (error: Error | null, items: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
|
|
95
|
+
/**
|
|
96
|
+
* fetch a PhoneNumberInstance
|
|
97
|
+
*
|
|
98
|
+
* @param opts - Options for request
|
|
99
|
+
* @param callback - Callback to handle processed record
|
|
100
|
+
*/
|
|
101
|
+
fetch(opts?: PhoneNumberInstanceFetchOptions, callback?: (error: Error | null, items: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
|
|
102
|
+
/**
|
|
103
|
+
* Provide a user-friendly representation
|
|
104
|
+
*/
|
|
105
|
+
toJSON(): any;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
declare class PhoneNumberInstance extends SerializableClass {
|
|
110
|
+
/**
|
|
111
|
+
* Initialize the PhoneNumberContext
|
|
112
|
+
*
|
|
113
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
114
|
+
* Use them with caution.
|
|
115
|
+
*
|
|
116
|
+
* @param version - Version of the resource
|
|
117
|
+
* @param payload - The instance payload
|
|
118
|
+
* @param phoneNumber - Phone number to lookup
|
|
119
|
+
*/
|
|
120
|
+
constructor(version: V2, payload: PhoneNumberPayload, phoneNumber: string);
|
|
121
|
+
|
|
122
|
+
private _proxy: PhoneNumberContext;
|
|
123
|
+
callForwarding: any;
|
|
124
|
+
callerName: any;
|
|
125
|
+
callingCountryCode: string;
|
|
126
|
+
countryCode: string;
|
|
127
|
+
/**
|
|
128
|
+
* fetch a PhoneNumberInstance
|
|
129
|
+
*
|
|
130
|
+
* @param callback - Callback to handle processed record
|
|
131
|
+
*/
|
|
132
|
+
fetch(callback?: (error: Error | null, items: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
|
|
133
|
+
/**
|
|
134
|
+
* fetch a PhoneNumberInstance
|
|
135
|
+
*
|
|
136
|
+
* @param opts - Options for request
|
|
137
|
+
* @param callback - Callback to handle processed record
|
|
138
|
+
*/
|
|
139
|
+
fetch(opts?: PhoneNumberInstanceFetchOptions, callback?: (error: Error | null, items: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
|
|
140
|
+
lineTypeIntelligence: any;
|
|
141
|
+
liveActivity: any;
|
|
142
|
+
nationalFormat: string;
|
|
143
|
+
phoneNumber: string;
|
|
144
|
+
simSwap: any;
|
|
145
|
+
/**
|
|
146
|
+
* Provide a user-friendly representation
|
|
147
|
+
*/
|
|
148
|
+
toJSON(): any;
|
|
149
|
+
url: string;
|
|
150
|
+
valid: boolean;
|
|
151
|
+
validationErrors: PhoneNumberValidationError[];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
declare class PhoneNumberPage extends Page<V2, PhoneNumberPayload, PhoneNumberResource, PhoneNumberInstance> {
|
|
156
|
+
/**
|
|
157
|
+
* Initialize the PhoneNumberPage
|
|
158
|
+
*
|
|
159
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
160
|
+
* Use them with caution.
|
|
161
|
+
*
|
|
162
|
+
* @param version - Version of the resource
|
|
163
|
+
* @param response - Response from the API
|
|
164
|
+
* @param solution - Path solution
|
|
165
|
+
*/
|
|
166
|
+
constructor(version: V2, response: Response<string>, solution: PhoneNumberSolution);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Build an instance of PhoneNumberInstance
|
|
170
|
+
*
|
|
171
|
+
* @param payload - Payload response from the API
|
|
172
|
+
*/
|
|
173
|
+
getInstance(payload: PhoneNumberPayload): PhoneNumberInstance;
|
|
174
|
+
/**
|
|
175
|
+
* Provide a user-friendly representation
|
|
176
|
+
*/
|
|
177
|
+
toJSON(): any;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export { PhoneNumberContext, PhoneNumberInstance, PhoneNumberInstanceFetchOptions, PhoneNumberList, PhoneNumberListInstance, PhoneNumberPage, PhoneNumberPayload, PhoneNumberResource, PhoneNumberSolution, PhoneNumberType, PhoneNumberValidationError }
|
|
@@ -0,0 +1,359 @@
|
|
|
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 PhoneNumberList;
|
|
19
|
+
var PhoneNumberPage;
|
|
20
|
+
var PhoneNumberInstance;
|
|
21
|
+
var PhoneNumberContext;
|
|
22
|
+
|
|
23
|
+
/* jshint ignore:start */
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the PhoneNumberList
|
|
26
|
+
*
|
|
27
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
28
|
+
* Use them with caution.
|
|
29
|
+
*
|
|
30
|
+
* @constructor Twilio.Lookups.V2.PhoneNumberList
|
|
31
|
+
*
|
|
32
|
+
* @param {Twilio.Lookups.V2} version - Version of the resource
|
|
33
|
+
*/
|
|
34
|
+
/* jshint ignore:end */
|
|
35
|
+
PhoneNumberList = function PhoneNumberList(version) {
|
|
36
|
+
/* jshint ignore:start */
|
|
37
|
+
/**
|
|
38
|
+
* @function phoneNumbers
|
|
39
|
+
* @memberof Twilio.Lookups.V2#
|
|
40
|
+
*
|
|
41
|
+
* @param {string} sid - sid of instance
|
|
42
|
+
*
|
|
43
|
+
* @returns {Twilio.Lookups.V2.PhoneNumberContext}
|
|
44
|
+
*/
|
|
45
|
+
/* jshint ignore:end */
|
|
46
|
+
function PhoneNumberListInstance(sid) {
|
|
47
|
+
return PhoneNumberListInstance.get(sid);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
PhoneNumberListInstance._version = version;
|
|
51
|
+
// Path Solution
|
|
52
|
+
PhoneNumberListInstance._solution = {};
|
|
53
|
+
/* jshint ignore:start */
|
|
54
|
+
/**
|
|
55
|
+
* Constructs a phone_number
|
|
56
|
+
*
|
|
57
|
+
* @function get
|
|
58
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberList#
|
|
59
|
+
*
|
|
60
|
+
* @param {string} phoneNumber - Phone number to lookup
|
|
61
|
+
*
|
|
62
|
+
* @returns {Twilio.Lookups.V2.PhoneNumberContext}
|
|
63
|
+
*/
|
|
64
|
+
/* jshint ignore:end */
|
|
65
|
+
PhoneNumberListInstance.get = function get(phoneNumber) {
|
|
66
|
+
return new PhoneNumberContext(this._version, phoneNumber);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/* jshint ignore:start */
|
|
70
|
+
/**
|
|
71
|
+
* Provide a user-friendly representation
|
|
72
|
+
*
|
|
73
|
+
* @function toJSON
|
|
74
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberList#
|
|
75
|
+
*
|
|
76
|
+
* @returns Object
|
|
77
|
+
*/
|
|
78
|
+
/* jshint ignore:end */
|
|
79
|
+
PhoneNumberListInstance.toJSON = function toJSON() {
|
|
80
|
+
return this._solution;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
PhoneNumberListInstance[util.inspect.custom] = function inspect(depth, options)
|
|
84
|
+
{
|
|
85
|
+
return util.inspect(this.toJSON(), options);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return PhoneNumberListInstance;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
/* jshint ignore:start */
|
|
93
|
+
/**
|
|
94
|
+
* Initialize the PhoneNumberPage
|
|
95
|
+
*
|
|
96
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
97
|
+
* Use them with caution.
|
|
98
|
+
*
|
|
99
|
+
* @constructor Twilio.Lookups.V2.PhoneNumberPage
|
|
100
|
+
*
|
|
101
|
+
* @param {V2} version - Version of the resource
|
|
102
|
+
* @param {Response<string>} response - Response from the API
|
|
103
|
+
* @param {PhoneNumberSolution} solution - Path solution
|
|
104
|
+
*
|
|
105
|
+
* @returns PhoneNumberPage
|
|
106
|
+
*/
|
|
107
|
+
/* jshint ignore:end */
|
|
108
|
+
PhoneNumberPage = function PhoneNumberPage(version, response, solution) {
|
|
109
|
+
// Path Solution
|
|
110
|
+
this._solution = solution;
|
|
111
|
+
|
|
112
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
_.extend(PhoneNumberPage.prototype, Page.prototype);
|
|
116
|
+
PhoneNumberPage.prototype.constructor = PhoneNumberPage;
|
|
117
|
+
|
|
118
|
+
/* jshint ignore:start */
|
|
119
|
+
/**
|
|
120
|
+
* Build an instance of PhoneNumberInstance
|
|
121
|
+
*
|
|
122
|
+
* @function getInstance
|
|
123
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberPage#
|
|
124
|
+
*
|
|
125
|
+
* @param {PhoneNumberPayload} payload - Payload response from the API
|
|
126
|
+
*
|
|
127
|
+
* @returns PhoneNumberInstance
|
|
128
|
+
*/
|
|
129
|
+
/* jshint ignore:end */
|
|
130
|
+
PhoneNumberPage.prototype.getInstance = function getInstance(payload) {
|
|
131
|
+
return new PhoneNumberInstance(this._version, payload);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/* jshint ignore:start */
|
|
135
|
+
/**
|
|
136
|
+
* Provide a user-friendly representation
|
|
137
|
+
*
|
|
138
|
+
* @function toJSON
|
|
139
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberPage#
|
|
140
|
+
*
|
|
141
|
+
* @returns Object
|
|
142
|
+
*/
|
|
143
|
+
/* jshint ignore:end */
|
|
144
|
+
PhoneNumberPage.prototype.toJSON = function toJSON() {
|
|
145
|
+
let clone = {};
|
|
146
|
+
_.forOwn(this, function(value, key) {
|
|
147
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
148
|
+
clone[key] = value;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
return clone;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
PhoneNumberPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
155
|
+
options) {
|
|
156
|
+
return util.inspect(this.toJSON(), options);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
/* jshint ignore:start */
|
|
161
|
+
/**
|
|
162
|
+
* Initialize the PhoneNumberContext
|
|
163
|
+
*
|
|
164
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
165
|
+
* Use them with caution.
|
|
166
|
+
*
|
|
167
|
+
* @constructor Twilio.Lookups.V2.PhoneNumberInstance
|
|
168
|
+
*
|
|
169
|
+
* @property {string} callingCountryCode - International dialing prefix
|
|
170
|
+
* @property {string} countryCode - Phone number's ISO country code
|
|
171
|
+
* @property {string} phoneNumber - Phone number in E.164 format
|
|
172
|
+
* @property {string} nationalFormat - Phone number in national format
|
|
173
|
+
* @property {boolean} valid - Boolean which indicates if the phone number is valid
|
|
174
|
+
* @property {phone_number.validation_error} validationErrors -
|
|
175
|
+
* Contains reasons why a phone number is invalid
|
|
176
|
+
* @property {object} callerName - An object that contains caller name information
|
|
177
|
+
* @property {object} simSwap - An object that contains SIM swap information
|
|
178
|
+
* @property {object} callForwarding -
|
|
179
|
+
* An object that contains call forwarding status information
|
|
180
|
+
* @property {object} liveActivity -
|
|
181
|
+
* An object that contains live activity information
|
|
182
|
+
* @property {object} lineTypeIntelligence -
|
|
183
|
+
* An object that contains line type information
|
|
184
|
+
* @property {string} url - The absolute URL of the resource
|
|
185
|
+
*
|
|
186
|
+
* @param {V2} version - Version of the resource
|
|
187
|
+
* @param {PhoneNumberPayload} payload - The instance payload
|
|
188
|
+
* @param {string} phoneNumber - Phone number to lookup
|
|
189
|
+
*/
|
|
190
|
+
/* jshint ignore:end */
|
|
191
|
+
PhoneNumberInstance = function PhoneNumberInstance(version, payload,
|
|
192
|
+
phoneNumber) {
|
|
193
|
+
this._version = version;
|
|
194
|
+
|
|
195
|
+
// Marshaled Properties
|
|
196
|
+
this.callingCountryCode = payload.calling_country_code; // jshint ignore:line
|
|
197
|
+
this.countryCode = payload.country_code; // jshint ignore:line
|
|
198
|
+
this.phoneNumber = payload.phone_number; // jshint ignore:line
|
|
199
|
+
this.nationalFormat = payload.national_format; // jshint ignore:line
|
|
200
|
+
this.valid = payload.valid; // jshint ignore:line
|
|
201
|
+
this.validationErrors = payload.validation_errors; // jshint ignore:line
|
|
202
|
+
this.callerName = payload.caller_name; // jshint ignore:line
|
|
203
|
+
this.simSwap = payload.sim_swap; // jshint ignore:line
|
|
204
|
+
this.callForwarding = payload.call_forwarding; // jshint ignore:line
|
|
205
|
+
this.liveActivity = payload.live_activity; // jshint ignore:line
|
|
206
|
+
this.lineTypeIntelligence = payload.line_type_intelligence; // jshint ignore:line
|
|
207
|
+
this.url = payload.url; // jshint ignore:line
|
|
208
|
+
|
|
209
|
+
// Context
|
|
210
|
+
this._context = undefined;
|
|
211
|
+
this._solution = {phoneNumber: phoneNumber || this.phoneNumber, };
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
Object.defineProperty(PhoneNumberInstance.prototype,
|
|
215
|
+
'_proxy', {
|
|
216
|
+
get: function() {
|
|
217
|
+
if (!this._context) {
|
|
218
|
+
this._context = new PhoneNumberContext(this._version, this._solution.phoneNumber);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return this._context;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
/* jshint ignore:start */
|
|
226
|
+
/**
|
|
227
|
+
* fetch a PhoneNumberInstance
|
|
228
|
+
*
|
|
229
|
+
* @function fetch
|
|
230
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberInstance#
|
|
231
|
+
*
|
|
232
|
+
* @param {object} [opts] - Options for request
|
|
233
|
+
* @param {string} [opts.fields] - Fields to return
|
|
234
|
+
* @param {string} [opts.countryCode] -
|
|
235
|
+
* Country code for national phone number lookups
|
|
236
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
237
|
+
*
|
|
238
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
239
|
+
*/
|
|
240
|
+
/* jshint ignore:end */
|
|
241
|
+
PhoneNumberInstance.prototype.fetch = function fetch(opts, callback) {
|
|
242
|
+
return this._proxy.fetch(opts, callback);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/* jshint ignore:start */
|
|
246
|
+
/**
|
|
247
|
+
* Provide a user-friendly representation
|
|
248
|
+
*
|
|
249
|
+
* @function toJSON
|
|
250
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberInstance#
|
|
251
|
+
*
|
|
252
|
+
* @returns Object
|
|
253
|
+
*/
|
|
254
|
+
/* jshint ignore:end */
|
|
255
|
+
PhoneNumberInstance.prototype.toJSON = function toJSON() {
|
|
256
|
+
let clone = {};
|
|
257
|
+
_.forOwn(this, function(value, key) {
|
|
258
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
259
|
+
clone[key] = value;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
return clone;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
PhoneNumberInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
266
|
+
options) {
|
|
267
|
+
return util.inspect(this.toJSON(), options);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
/* jshint ignore:start */
|
|
272
|
+
/**
|
|
273
|
+
* Initialize the PhoneNumberContext
|
|
274
|
+
*
|
|
275
|
+
* PLEASE NOTE that this class contains beta products that are subject to change.
|
|
276
|
+
* Use them with caution.
|
|
277
|
+
*
|
|
278
|
+
* @constructor Twilio.Lookups.V2.PhoneNumberContext
|
|
279
|
+
*
|
|
280
|
+
* @param {V2} version - Version of the resource
|
|
281
|
+
* @param {string} phoneNumber - Phone number to lookup
|
|
282
|
+
*/
|
|
283
|
+
/* jshint ignore:end */
|
|
284
|
+
PhoneNumberContext = function PhoneNumberContext(version, phoneNumber) {
|
|
285
|
+
this._version = version;
|
|
286
|
+
|
|
287
|
+
// Path Solution
|
|
288
|
+
this._solution = {phoneNumber: phoneNumber, };
|
|
289
|
+
this._uri = `/PhoneNumbers/${phoneNumber}`;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
/* jshint ignore:start */
|
|
293
|
+
/**
|
|
294
|
+
* fetch a PhoneNumberInstance
|
|
295
|
+
*
|
|
296
|
+
* @function fetch
|
|
297
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberContext#
|
|
298
|
+
*
|
|
299
|
+
* @param {object} [opts] - Options for request
|
|
300
|
+
* @param {string} [opts.fields] - Fields to return
|
|
301
|
+
* @param {string} [opts.countryCode] -
|
|
302
|
+
* Country code for national phone number lookups
|
|
303
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
304
|
+
*
|
|
305
|
+
* @returns {Promise} Resolves to processed PhoneNumberInstance
|
|
306
|
+
*/
|
|
307
|
+
/* jshint ignore:end */
|
|
308
|
+
PhoneNumberContext.prototype.fetch = function fetch(opts, callback) {
|
|
309
|
+
if (_.isFunction(opts)) {
|
|
310
|
+
callback = opts;
|
|
311
|
+
opts = {};
|
|
312
|
+
}
|
|
313
|
+
opts = opts || {};
|
|
314
|
+
|
|
315
|
+
var deferred = Q.defer();
|
|
316
|
+
var data = values.of({'Fields': _.get(opts, 'fields'), 'CountryCode': _.get(opts, 'countryCode')});
|
|
317
|
+
|
|
318
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET', params: data});
|
|
319
|
+
|
|
320
|
+
promise = promise.then(function(payload) {
|
|
321
|
+
deferred.resolve(new PhoneNumberInstance(this._version, payload, this._solution.phoneNumber));
|
|
322
|
+
}.bind(this));
|
|
323
|
+
|
|
324
|
+
promise.catch(function(error) {
|
|
325
|
+
deferred.reject(error);
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
if (_.isFunction(callback)) {
|
|
329
|
+
deferred.promise.nodeify(callback);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return deferred.promise;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/* jshint ignore:start */
|
|
336
|
+
/**
|
|
337
|
+
* Provide a user-friendly representation
|
|
338
|
+
*
|
|
339
|
+
* @function toJSON
|
|
340
|
+
* @memberof Twilio.Lookups.V2.PhoneNumberContext#
|
|
341
|
+
*
|
|
342
|
+
* @returns Object
|
|
343
|
+
*/
|
|
344
|
+
/* jshint ignore:end */
|
|
345
|
+
PhoneNumberContext.prototype.toJSON = function toJSON() {
|
|
346
|
+
return this._solution;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
PhoneNumberContext.prototype[util.inspect.custom] = function inspect(depth,
|
|
350
|
+
options) {
|
|
351
|
+
return util.inspect(this.toJSON(), options);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
module.exports = {
|
|
355
|
+
PhoneNumberList: PhoneNumberList,
|
|
356
|
+
PhoneNumberPage: PhoneNumberPage,
|
|
357
|
+
PhoneNumberInstance: PhoneNumberInstance,
|
|
358
|
+
PhoneNumberContext: PhoneNumberContext
|
|
359
|
+
};
|