twilio 4.12.0 → 4.14.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 (36) hide show
  1. package/lib/base/BaseTwilio.js +15 -8
  2. package/lib/rest/flexApi/v1/interaction.d.ts +5 -0
  3. package/lib/rest/flexApi/v1/interaction.js +4 -0
  4. package/lib/rest/insights/v1/call/annotation.d.ts +9 -9
  5. package/lib/rest/insights/v1/call/callSummary.d.ts +58 -1
  6. package/lib/rest/insights/v1/call/event.d.ts +30 -3
  7. package/lib/rest/insights/v1/call/metric.d.ts +27 -6
  8. package/lib/rest/insights/v1/callSummaries.d.ts +123 -69
  9. package/lib/rest/insights/v1/setting.d.ts +16 -4
  10. package/lib/rest/lookups/v2/phoneNumber.d.ts +9 -1
  11. package/lib/rest/lookups/v2/phoneNumber.js +4 -0
  12. package/lib/rest/messaging/V1.d.ts +5 -0
  13. package/lib/rest/messaging/V1.js +7 -0
  14. package/lib/rest/messaging/v1/tollfreeVerification.d.ts +539 -0
  15. package/lib/rest/messaging/v1/tollfreeVerification.js +402 -0
  16. package/lib/rest/microvisor/v1/device.d.ts +2 -0
  17. package/lib/rest/microvisor/v1/device.js +2 -0
  18. package/lib/rest/numbers/V1.d.ts +10 -0
  19. package/lib/rest/numbers/V1.js +15 -0
  20. package/lib/rest/numbers/V2.d.ts +10 -0
  21. package/lib/rest/numbers/V2.js +14 -0
  22. package/lib/rest/numbers/v1/portingBulkPortability.d.ts +120 -0
  23. package/lib/rest/numbers/v1/portingBulkPortability.js +136 -0
  24. package/lib/rest/numbers/v1/portingPortability.d.ts +134 -0
  25. package/lib/rest/numbers/v1/portingPortability.js +124 -0
  26. package/lib/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.d.ts +265 -0
  27. package/lib/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.js +164 -0
  28. package/lib/rest/numbers/v2/authorizationDocument.d.ts +290 -0
  29. package/lib/rest/numbers/v2/authorizationDocument.js +262 -0
  30. package/lib/rest/numbers/v2/hostedNumberOrder.d.ts +384 -0
  31. package/lib/rest/numbers/v2/hostedNumberOrder.js +294 -0
  32. package/lib/rest/taskrouter/v1/workspace/worker.d.ts +3 -3
  33. package/lib/rest/verify/v2/service/verification.d.ts +3 -0
  34. package/lib/rest/verify/v2/service/verification.js +2 -0
  35. package/lib/twiml/VoiceResponse.d.ts +2 -2
  36. package/package.json +2 -2
@@ -33,23 +33,30 @@ var Twilio;
33
33
  /* jshint ignore:end */
34
34
  constructor(username, password, opts) {
35
35
  this.opts = opts || {};
36
- this.env = this.opts.env || process.env;
36
+ this.env = this.opts.env || {};
37
37
  this.username =
38
- username ||
39
- this.env.TWILIO_ACCOUNT_SID ||
38
+ username ??
39
+ this.env.TWILIO_ACCOUNT_SID ??
40
+ process.env.TWILIO_ACCOUNT_SID ??
40
41
  (() => {
41
42
  throw new Error("username is required");
42
43
  })();
43
44
  this.password =
44
- password ||
45
- this.env.TWILIO_AUTH_TOKEN ||
45
+ password ??
46
+ this.env.TWILIO_AUTH_TOKEN ??
47
+ process.env.TWILIO_AUTH_TOKEN ??
46
48
  (() => {
47
49
  throw new Error("password is required");
48
50
  })();
49
51
  this.accountSid = this.opts.accountSid || this.username;
50
- this.edge = this.opts.edge || this.env.TWILIO_EDGE;
51
- this.region = this.opts.region || this.env.TWILIO_REGION;
52
- this.logLevel = this.opts.logLevel || this.env.TWILIO_LOG_LEVEL;
52
+ this.edge =
53
+ this.opts.edge ?? this.env.TWILIO_EDGE ?? process.env.TWILIO_EDGE;
54
+ this.region =
55
+ this.opts.region ?? this.env.TWILIO_REGION ?? process.env.TWILIO_REGION;
56
+ this.logLevel =
57
+ this.opts.logLevel ??
58
+ this.env.TWILIO_LOG_LEVEL ??
59
+ process.env.TWILIO_LOG_LEVEL;
53
60
  this.autoRetry = this.opts.autoRetry || false;
54
61
  this.maxRetries = this.opts.maxRetries;
55
62
  this.userAgentExtensions = this.opts.userAgentExtensions || [];
@@ -10,6 +10,8 @@ export interface InteractionListInstanceCreateOptions {
10
10
  channel: any;
11
11
  /** The Interaction\\\'s routing logic. */
12
12
  routing: any;
13
+ /** The Interaction context sid is used for adding a context lookup sid */
14
+ interactionContextSid?: string;
13
15
  }
14
16
  export interface InteractionContext {
15
17
  channels: InteractionChannelListInstance;
@@ -52,6 +54,7 @@ interface InteractionResource {
52
54
  routing: any;
53
55
  url: string;
54
56
  links: Record<string, string>;
57
+ interaction_context_sid: string;
55
58
  }
56
59
  export declare class InteractionInstance {
57
60
  protected _version: V1;
@@ -72,6 +75,7 @@ export declare class InteractionInstance {
72
75
  routing: any;
73
76
  url: string;
74
77
  links: Record<string, string>;
78
+ interactionContextSid: string;
75
79
  private get _proxy();
76
80
  /**
77
81
  * Fetch a InteractionInstance
@@ -96,6 +100,7 @@ export declare class InteractionInstance {
96
100
  routing: any;
97
101
  url: string;
98
102
  links: Record<string, string>;
103
+ interactionContextSid: string;
99
104
  };
100
105
  [inspect.custom](_depth: any, options: InspectOptions): string;
101
106
  }
@@ -65,6 +65,7 @@ class InteractionInstance {
65
65
  this.routing = payload.routing;
66
66
  this.url = payload.url;
67
67
  this.links = payload.links;
68
+ this.interactionContextSid = payload.interaction_context_sid;
68
69
  this._solution = { sid: sid || this.sid };
69
70
  }
70
71
  get _proxy() {
@@ -101,6 +102,7 @@ class InteractionInstance {
101
102
  routing: this.routing,
102
103
  url: this.url,
103
104
  links: this.links,
105
+ interactionContextSid: this.interactionContextSid,
104
106
  };
105
107
  }
106
108
  [util_1.inspect.custom](_depth, options) {
@@ -129,6 +131,8 @@ function InteractionListInstance(version) {
129
131
  let data = {};
130
132
  data["Channel"] = serialize.object(params["channel"]);
131
133
  data["Routing"] = serialize.object(params["routing"]);
134
+ if (params["interactionContextSid"] !== undefined)
135
+ data["InteractionContextSid"] = params["interactionContextSid"];
132
136
  const headers = {};
133
137
  headers["Content-Type"] = "application/x-www-form-urlencoded";
134
138
  let operationVersion = version, operationPromise = operationVersion.create({
@@ -11,15 +11,15 @@ export interface AnnotationContextUpdateOptions {
11
11
  answeredBy?: AnnotationAnsweredBy;
12
12
  /** */
13
13
  connectivityIssue?: AnnotationConnectivityIssue;
14
- /** Specify if the call had any subjective quality issues. Possible values, one or more of: no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, static_noise. Use comma separated values to indicate multiple quality issues for the same call */
14
+ /** Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call. */
15
15
  qualityIssues?: string;
16
- /** Specify if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call. */
16
+ /** A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call. */
17
17
  spam?: boolean;
18
18
  /** Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */
19
19
  callScore?: number;
20
- /** Specify any comments pertaining to the call. This of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here. */
20
+ /** Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`. */
21
21
  comment?: string;
22
- /** Associate this call with an incident or support ticket. This is of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here. */
22
+ /** Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. */
23
23
  incident?: string;
24
24
  }
25
25
  export interface AnnotationContext {
@@ -100,23 +100,23 @@ export declare class AnnotationInstance {
100
100
  answeredBy: AnnotationAnsweredBy;
101
101
  connectivityIssue: AnnotationConnectivityIssue;
102
102
  /**
103
- * Specify if the call had any subjective quality issues. Possible values, one or more of: no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, static_noise. Use comma separated values to indicate multiple quality issues for the same call
103
+ * Specifies if the call had any subjective quality issues. Possible values are one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, or `static_noise`.
104
104
  */
105
105
  qualityIssues: Array<string>;
106
106
  /**
107
- * Specify if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call.
107
+ * Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call.
108
108
  */
109
109
  spam: boolean;
110
110
  /**
111
- * Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
111
+ * Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad].
112
112
  */
113
113
  callScore: number;
114
114
  /**
115
- * Specify any comments pertaining to the call. This of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here.
115
+ * Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments.
116
116
  */
117
117
  comment: string;
118
118
  /**
119
- * Associate this call with an incident or support ticket. This is of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here.
119
+ * Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`.
120
120
  */
121
121
  incident: string;
122
122
  /**
@@ -9,7 +9,7 @@ export type CallSummaryProcessingState = "complete" | "partial";
9
9
  * Options to pass to fetch a CallSummaryInstance
10
10
  */
11
11
  export interface CallSummaryContextFetchOptions {
12
- /** */
12
+ /** The Processing State of this Call Summary. One of `complete`, `partial` or `all`. */
13
13
  processingState?: CallSummaryProcessingState;
14
14
  }
15
15
  export interface CallSummaryContext {
@@ -83,28 +83,85 @@ export declare class CallSummaryInstance {
83
83
  protected _solution: CallSummaryContextSolution;
84
84
  protected _context?: CallSummaryContext;
85
85
  constructor(_version: V1, payload: CallSummaryResource, callSid: string);
86
+ /**
87
+ * The unique SID identifier of the Account.
88
+ */
86
89
  accountSid: string;
90
+ /**
91
+ * The unique SID identifier of the Call.
92
+ */
87
93
  callSid: string;
88
94
  callType: CallSummaryCallType;
89
95
  callState: CallSummaryCallState;
90
96
  answeredBy: CallSummaryAnsweredBy;
91
97
  processingState: CallSummaryProcessingState;
98
+ /**
99
+ * The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS
100
+ */
92
101
  createdTime: Date;
102
+ /**
103
+ * The time at which the Call was started, given in ISO 8601 format.
104
+ */
93
105
  startTime: Date;
106
+ /**
107
+ * The time at which the Call was ended, given in ISO 8601 format.
108
+ */
94
109
  endTime: Date;
110
+ /**
111
+ * Duration between when the call was initiated and the call was ended
112
+ */
95
113
  duration: number;
114
+ /**
115
+ * Duration between when the call was answered and when it ended
116
+ */
96
117
  connectDuration: number;
118
+ /**
119
+ * The calling party.
120
+ */
97
121
  from: any;
122
+ /**
123
+ * The called party.
124
+ */
98
125
  to: any;
126
+ /**
127
+ * Contains metrics and properties for the Twilio media gateway of a PSTN call.
128
+ */
99
129
  carrierEdge: any;
130
+ /**
131
+ * Contains metrics and properties for the Twilio media gateway of a Client call.
132
+ */
100
133
  clientEdge: any;
134
+ /**
135
+ * Contains metrics and properties for the SDK sensor library for Client calls.
136
+ */
101
137
  sdkEdge: any;
138
+ /**
139
+ * Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
140
+ */
102
141
  sipEdge: any;
142
+ /**
143
+ * Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality.
144
+ */
103
145
  tags: Array<string>;
146
+ /**
147
+ * The URL of this resource.
148
+ */
104
149
  url: string;
150
+ /**
151
+ * Attributes capturing call-flow-specific details.
152
+ */
105
153
  attributes: any;
154
+ /**
155
+ * Contains edge-agnostic call-level details.
156
+ */
106
157
  properties: any;
158
+ /**
159
+ * Contains trusted communications details including Branded Call and verified caller ID.
160
+ */
107
161
  trust: any;
162
+ /**
163
+ * Programmatically labeled annotations for the Call. Developers can update the Call Summary records with Annotation during or after a Call. Annotations can be updated as long as the Call Summary record is addressable via the API.
164
+ */
108
165
  annotation: any;
109
166
  private get _proxy();
110
167
  /**
@@ -9,7 +9,7 @@ export type EventTwilioEdge = "unknown_edge" | "carrier_edge" | "sip_edge" | "sd
9
9
  * Options to pass to each
10
10
  */
11
11
  export interface EventListInstanceEachOptions {
12
- /** */
12
+ /** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
13
13
  edge?: EventTwilioEdge;
14
14
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
15
15
  pageSize?: number;
@@ -24,7 +24,7 @@ export interface EventListInstanceEachOptions {
24
24
  * Options to pass to list
25
25
  */
26
26
  export interface EventListInstanceOptions {
27
- /** */
27
+ /** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
28
28
  edge?: EventTwilioEdge;
29
29
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
30
30
  pageSize?: number;
@@ -35,7 +35,7 @@ export interface EventListInstanceOptions {
35
35
  * Options to pass to page
36
36
  */
37
37
  export interface EventListInstancePageOptions {
38
- /** */
38
+ /** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
39
39
  edge?: EventTwilioEdge;
40
40
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
41
41
  pageSize?: number;
@@ -127,16 +127,43 @@ interface EventResource {
127
127
  export declare class EventInstance {
128
128
  protected _version: V1;
129
129
  constructor(_version: V1, payload: EventResource, callSid: string);
130
+ /**
131
+ * Event time.
132
+ */
130
133
  timestamp: string;
134
+ /**
135
+ * The unique SID identifier of the Call.
136
+ */
131
137
  callSid: string;
138
+ /**
139
+ * The unique SID identifier of the Account.
140
+ */
132
141
  accountSid: string;
133
142
  edge: EventTwilioEdge;
143
+ /**
144
+ * Event group.
145
+ */
134
146
  group: string;
135
147
  level: EventLevel;
148
+ /**
149
+ * Event name.
150
+ */
136
151
  name: string;
152
+ /**
153
+ * Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio\'s carrier media gateways.
154
+ */
137
155
  carrierEdge: any;
156
+ /**
157
+ * Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio\'s public media gateways.
158
+ */
138
159
  sipEdge: any;
160
+ /**
161
+ * Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions.
162
+ */
139
163
  sdkEdge: any;
164
+ /**
165
+ * Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio\'s Voice SDK media gateways.
166
+ */
140
167
  clientEdge: any;
141
168
  /**
142
169
  * Provide a user-friendly representation
@@ -9,9 +9,9 @@ export type MetricTwilioEdge = "unknown_edge" | "carrier_edge" | "sip_edge" | "s
9
9
  * Options to pass to each
10
10
  */
11
11
  export interface MetricListInstanceEachOptions {
12
- /** */
12
+ /** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
13
13
  edge?: MetricTwilioEdge;
14
- /** */
14
+ /** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */
15
15
  direction?: MetricStreamDirection;
16
16
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
17
17
  pageSize?: number;
@@ -26,9 +26,9 @@ export interface MetricListInstanceEachOptions {
26
26
  * Options to pass to list
27
27
  */
28
28
  export interface MetricListInstanceOptions {
29
- /** */
29
+ /** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
30
30
  edge?: MetricTwilioEdge;
31
- /** */
31
+ /** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */
32
32
  direction?: MetricStreamDirection;
33
33
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
34
34
  pageSize?: number;
@@ -39,9 +39,9 @@ export interface MetricListInstanceOptions {
39
39
  * Options to pass to page
40
40
  */
41
41
  export interface MetricListInstancePageOptions {
42
- /** */
42
+ /** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */
43
43
  edge?: MetricTwilioEdge;
44
- /** */
44
+ /** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */
45
45
  direction?: MetricStreamDirection;
46
46
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
47
47
  pageSize?: number;
@@ -131,14 +131,35 @@ interface MetricResource {
131
131
  export declare class MetricInstance {
132
132
  protected _version: V1;
133
133
  constructor(_version: V1, payload: MetricResource, callSid: string);
134
+ /**
135
+ * Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds.
136
+ */
134
137
  timestamp: string;
138
+ /**
139
+ * The unique SID identifier of the Call.
140
+ */
135
141
  callSid: string;
142
+ /**
143
+ * The unique SID identifier of the Account.
144
+ */
136
145
  accountSid: string;
137
146
  edge: MetricTwilioEdge;
138
147
  direction: MetricStreamDirection;
148
+ /**
149
+ * Contains metrics and properties for the Twilio media gateway of a PSTN call.
150
+ */
139
151
  carrierEdge: any;
152
+ /**
153
+ * Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call.
154
+ */
140
155
  sipEdge: any;
156
+ /**
157
+ * Contains metrics and properties for the SDK sensor library for Client calls.
158
+ */
141
159
  sdkEdge: any;
160
+ /**
161
+ * Contains metrics and properties for the Twilio media gateway of a Client call.
162
+ */
142
163
  clientEdge: any;
143
164
  /**
144
165
  * Provide a user-friendly representation