twilio 4.11.2 → 4.13.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 (28) hide show
  1. package/lib/base/BaseTwilio.js +15 -8
  2. package/lib/rest/api/v2010/account/message.d.ts +2 -2
  3. package/lib/rest/api/v2010/account/message.js +2 -2
  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 +135 -78
  9. package/lib/rest/insights/v1/callSummaries.js +8 -6
  10. package/lib/rest/insights/v1/setting.d.ts +16 -4
  11. package/lib/rest/lookups/v2/phoneNumber.d.ts +9 -1
  12. package/lib/rest/lookups/v2/phoneNumber.js +4 -0
  13. package/lib/rest/numbers/V1.d.ts +10 -0
  14. package/lib/rest/numbers/V1.js +15 -0
  15. package/lib/rest/numbers/V2.d.ts +10 -0
  16. package/lib/rest/numbers/V2.js +14 -0
  17. package/lib/rest/numbers/v1/portingBulkPortability.d.ts +120 -0
  18. package/lib/rest/numbers/v1/portingBulkPortability.js +136 -0
  19. package/lib/rest/numbers/v1/portingPortability.d.ts +134 -0
  20. package/lib/rest/numbers/v1/portingPortability.js +124 -0
  21. package/lib/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.d.ts +265 -0
  22. package/lib/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.js +164 -0
  23. package/lib/rest/numbers/v2/authorizationDocument.d.ts +288 -0
  24. package/lib/rest/numbers/v2/authorizationDocument.js +257 -0
  25. package/lib/rest/numbers/v2/hostedNumberOrder.d.ts +390 -0
  26. package/lib/rest/numbers/v2/hostedNumberOrder.js +296 -0
  27. package/lib/rest/taskrouter/v1/workspace/worker.d.ts +3 -3
  28. package/package.json +1 -1
@@ -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 || [];
@@ -56,8 +56,6 @@ export interface MessageListInstanceCreateOptions {
56
56
  sendAt?: Date;
57
57
  /** If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. */
58
58
  sendAsMms?: boolean;
59
- /** The SID of the Content object returned at Content API content create time (https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template). If this parameter is not specified, then the Content API will not be utilized. */
60
- contentSid?: string;
61
59
  /** Key-value pairs of variable names to substitution values, used alongside a content_sid. If not specified, Content API will default to the default variables defined at create time. */
62
60
  contentVariables?: string;
63
61
  /** A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using `messaging_service_sid`, this parameter must be empty. */
@@ -68,6 +66,8 @@ export interface MessageListInstanceCreateOptions {
68
66
  body?: string;
69
67
  /** The URL of the media to send with the message. The media can be of type `gif`, `png`, and `jpeg` and will be formatted correctly on the recipient\\\'s device. The media size limit is 5MB for supported file types (JPEG, PNG, GIF) and 500KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message body, provide multiple `media_url` parameters in the POST request. You can include up to 10 `media_url` parameters per message. You can send images in an SMS message in only the US and Canada. */
70
68
  mediaUrl?: Array<string>;
69
+ /** The SID of the Content object returned at Content API content create time (https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template). If this parameter is not specified, then the Content API will not be utilized. */
70
+ contentSid?: string;
71
71
  }
72
72
  /**
73
73
  * Options to pass to each
@@ -256,8 +256,6 @@ function MessageListInstance(version, accountSid) {
256
256
  data["SendAt"] = serialize.iso8601DateTime(params["sendAt"]);
257
257
  if (params["sendAsMms"] !== undefined)
258
258
  data["SendAsMms"] = serialize.bool(params["sendAsMms"]);
259
- if (params["contentSid"] !== undefined)
260
- data["ContentSid"] = params["contentSid"];
261
259
  if (params["contentVariables"] !== undefined)
262
260
  data["ContentVariables"] = params["contentVariables"];
263
261
  if (params["from"] !== undefined)
@@ -268,6 +266,8 @@ function MessageListInstance(version, accountSid) {
268
266
  data["Body"] = params["body"];
269
267
  if (params["mediaUrl"] !== undefined)
270
268
  data["MediaUrl"] = serialize.map(params["mediaUrl"], (e) => e);
269
+ if (params["contentSid"] !== undefined)
270
+ data["ContentSid"] = params["contentSid"];
271
271
  const headers = {};
272
272
  headers["Content-Type"] = "application/x-www-form-urlencoded";
273
273
  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