twilio 4.10.0 → 4.11.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 (29) hide show
  1. package/README.md +151 -30
  2. package/lib/rest/conversations/v1/conversation.d.ts +0 -18
  3. package/lib/rest/conversations/v1/conversation.js +0 -6
  4. package/lib/rest/conversations/v1/service/conversation.d.ts +0 -18
  5. package/lib/rest/conversations/v1/service/conversation.js +0 -6
  6. package/lib/rest/flexApi/v1/assessments.d.ts +14 -14
  7. package/lib/rest/flexApi/v1/assessments.js +22 -22
  8. package/lib/rest/flexApi/v1/insightsAssessmentsComment.d.ts +4 -4
  9. package/lib/rest/flexApi/v1/insightsAssessmentsComment.js +3 -3
  10. package/lib/rest/flexApi/v1/insightsQuestionnaires.d.ts +13 -13
  11. package/lib/rest/flexApi/v1/insightsQuestionnaires.js +22 -20
  12. package/lib/rest/flexApi/v1/insightsQuestionnairesCategory.d.ts +9 -9
  13. package/lib/rest/flexApi/v1/insightsQuestionnairesCategory.js +15 -15
  14. package/lib/rest/flexApi/v1/insightsQuestionnairesQuestion.d.ts +19 -19
  15. package/lib/rest/flexApi/v1/insightsQuestionnairesQuestion.js +22 -22
  16. package/lib/rest/flexApi/v1/insightsSegments.d.ts +56 -120
  17. package/lib/rest/flexApi/v1/insightsSegments.js +40 -97
  18. package/lib/rest/flexApi/v1/insightsSettingsAnswerSets.js +1 -1
  19. package/lib/rest/flexApi/v1/insightsSettingsComment.js +1 -1
  20. package/lib/rest/messaging/V1.d.ts +0 -5
  21. package/lib/rest/messaging/V1.js +0 -7
  22. package/lib/rest/messaging/v1/domainConfig.d.ts +17 -11
  23. package/lib/rest/messaging/v1/domainConfig.js +5 -10
  24. package/lib/rest/verify/v2/service.d.ts +3 -3
  25. package/lib/rest/verify/v2/template.d.ts +5 -5
  26. package/lib/twiml/VoiceResponse.d.ts +1 -1
  27. package/package.json +1 -1
  28. package/lib/rest/messaging/v1/tollfreeVerification.d.ts +0 -521
  29. package/lib/rest/messaging/v1/tollfreeVerification.js +0 -396
package/README.md CHANGED
@@ -19,17 +19,45 @@ The Node library documentation can be found [here][libdocs].
19
19
 
20
20
  This library supports the following Node.js implementations:
21
21
 
22
- * Node.js 14
23
- * Node.js 16
24
- * Node.js 18
22
+ - Node.js 14
23
+ - Node.js 16
24
+ - Node.js 18
25
25
 
26
26
  TypeScript is supported for TypeScript version 2.9 and above.
27
27
 
28
+ > **Warning**
29
+ > Do not use this Node.js library in a front-end application. Doing so can expose your Twilio credentials to end-users as part of the bundled HTML/JavaScript sent to their browser.
30
+
28
31
  ## Installation
29
32
 
30
33
  `npm install twilio` or `yarn add twilio`
31
34
 
32
- ## Sample Usage
35
+ ### Test your installation
36
+
37
+ To make sure the installation was successful, try sending yourself an SMS message, like this:
38
+
39
+ ```js
40
+ // Your AccountSID and Auth Token from console.twilio.com
41
+ const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
42
+ const authToken = 'your_auth_token';
43
+
44
+ const client = require('twilio')(accountSid, authToken);
45
+
46
+ client.messages
47
+ .create({
48
+ body: 'Hello from twilio-node',
49
+ to: '+12345678901', // Text your number
50
+ from: '+12345678901', // From a valid Twilio number
51
+ })
52
+ .then((message) => console.log(message.sid));
53
+ ```
54
+
55
+ After a brief delay, you will receive the text message on your phone.
56
+
57
+ > **Warning**
58
+ > It's okay to hardcode your credentials when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out [How to Set Environment Variables](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html) for more information.
59
+
60
+ ## Usage
33
61
 
34
62
  Check out these [code examples](examples) in JavaScript and TypeScript to get up and running quickly.
35
63
 
@@ -40,27 +68,31 @@ Check out these [code examples](examples) in JavaScript and TypeScript to get up
40
68
  If your environment requires SSL decryption, you can set the path to CA bundle in the env var `TWILIO_CA_BUNDLE`.
41
69
 
42
70
  ### Client Initialization
71
+
43
72
  If you invoke any V2010 operations without specifying an account SID, `twilio-node` will automatically use the `TWILIO_ACCOUNT_SID` value that the client was initialized with. This is useful for when you'd like to, for example, fetch resources for your main account but also your subaccount. See below:
44
73
 
45
74
  ```javascript
46
- var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
47
- var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console
48
- var subaccountSid = process.env.TWILIO_ACCOUNT_SUBACCOUNT_SID; // Your Subaccount SID from www.twilio.com/console
75
+ // Your Account SID, Subaccount SID Auth Token from console.twilio.com
76
+ const accountSid = process.env.TWILIO_ACCOUNT_SID;
77
+ const authToken = process.env.TWILIO_AUTH_TOKEN;
78
+ const subaccountSid = process.env.TWILIO_ACCOUNT_SUBACCOUNT_SID;
49
79
 
50
80
  const client = require('twilio')(accountSid, authToken);
51
81
  const mainAccountCalls = client.api.v2010.account.calls.list; // SID not specified, so defaults to accountSid
52
- const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list // SID specified as subaccountSid
82
+ const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list; // SID specified as subaccountSid
53
83
  ```
54
84
 
55
85
  ### Lazy Loading
56
86
 
57
87
  `twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is enabled by default. To disable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `false`:
88
+
58
89
  ```javascript
59
- var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
60
- var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console
90
+ // Your Account SID and Auth Token from console.twilio.com
91
+ const accountSid = process.env.TWILIO_ACCOUNT_SID;
92
+ const authToken = process.env.TWILIO_AUTH_TOKEN;
61
93
 
62
94
  const client = require('twilio')(accountSid, authToken, {
63
- lazyLoading: false
95
+ lazyLoading: false,
64
96
  });
65
97
  ```
66
98
 
@@ -71,12 +103,12 @@ const client = require('twilio')(accountSid, authToken, {
71
103
  Optionally, the maximum number of retries performed by this feature can be set with the `maxRetries` flag. The default maximum number of retries is `3`.
72
104
 
73
105
  ```javascript
74
- var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
75
- var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console
106
+ const accountSid = process.env.TWILIO_ACCOUNT_SID;
107
+ const authToken = process.env.TWILIO_AUTH_TOKEN;
76
108
 
77
109
  const client = require('twilio')(accountSid, authToken, {
78
- autoRetry: true,
79
- maxRetries: 3
110
+ autoRetry: true,
111
+ maxRetries: 3,
80
112
  });
81
113
  ```
82
114
 
@@ -85,12 +117,12 @@ const client = require('twilio')(accountSid, authToken, {
85
117
  To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/docs/global-infrastructure), specify the target Region and/or Edge for the client:
86
118
 
87
119
  ```javascript
88
- var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
89
- var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console
120
+ const accountSid = process.env.TWILIO_ACCOUNT_SID;
121
+ const authToken = process.env.TWILIO_AUTH_TOKEN;
90
122
 
91
123
  const client = require('twilio')(accountSid, authToken, {
92
- region: 'au1',
93
- edge: 'sydney',
124
+ region: 'au1',
125
+ edge: 'sydney',
94
126
  });
95
127
  ```
96
128
 
@@ -104,34 +136,123 @@ client.edge = 'sydney';
104
136
 
105
137
  This will result in the `hostname` transforming from `api.twilio.com` to `api.sydney.au1.twilio.com`.
106
138
 
139
+ ### Iterate through records
140
+
141
+ The library automatically handles paging for you. Collections, such as `calls` and `messages`, have `list` and `each` methods that page under the hood. With both `list` and `each`, you can specify the number of records you want to receive (`limit`) and the maximum size you want each page fetch to be (`pageSize`). The library will then handle the task for you.
142
+
143
+ `list` eagerly fetches all records and returns them as a list, whereas `each` streams records and lazily retrieves pages of records as you iterate over the collection. You can also page manually using the `page` method.
144
+
145
+ For more information about these methods, view the [auto-generated library docs](https://www.twilio.com/docs/libraries/reference/twilio-node/).
146
+
147
+ ```js
148
+ // Your Account SID and Auth Token from console.twilio.com
149
+ const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
150
+ const authToken = 'your_auth_token';
151
+ const client = require('twilio')(accountSid, authToken);
152
+
153
+ client.calls.each((call) => console.log(call.direction));
154
+ ```
155
+
107
156
  ### Enable Debug Logging
157
+
108
158
  There are two ways to enable debug logging in the default HTTP client. You can create an environment variable called `TWILIO_LOG_LEVEL` and set it to `debug` or you can set the logLevel variable on the client as debug:
159
+
109
160
  ```javascript
110
- var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
111
- var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console
161
+ const accountSid = process.env.TWILIO_ACCOUNT_SID;
162
+ const authToken = process.env.TWILIO_AUTH_TOKEN;
112
163
 
113
164
  const client = require('twilio')(accountSid, authToken, {
114
- logLevel: 'debug'
165
+ logLevel: 'debug',
115
166
  });
116
167
  ```
168
+
117
169
  You can also set the logLevel variable on the client after constructing the Twilio client:
170
+
118
171
  ```javascript
119
172
  const client = require('twilio')(accountSid, authToken);
120
173
  client.logLevel = 'debug';
121
174
  ```
122
175
 
123
- ## Using webhook validation
124
- See [example](examples/express.js) for a code sample for incoming Twilio request validation.
176
+ ### Debug API requests
125
177
 
126
- ## Handling Exceptions
178
+ To assist with debugging, the library allows you to access the underlying request and response objects. This capability is built into the default HTTP client that ships with the library.
127
179
 
128
- For an example on how to handle exceptions in this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/node#exceptions).
180
+ For example, you can retrieve the status code of the last response like so:
129
181
 
130
- ## Using a Custom HTTP Client
182
+ ```js
183
+ const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
184
+ const authToken = 'your_auth_token';
131
185
 
132
- To use a custom HTTP client with this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/node/custom-http-clients-node).
186
+ const client = require('twilio')(accountSid, authToken);
187
+
188
+ client.messages
189
+ .create({
190
+ to: '+14158675309',
191
+ from: '+14258675310',
192
+ body: 'Ahoy!',
193
+ })
194
+ .then(() => {
195
+ // Access details about the last request
196
+ console.log(client.lastRequest.method);
197
+ console.log(client.lastRequest.url);
198
+ console.log(client.lastRequest.auth);
199
+ console.log(client.lastRequest.params);
200
+ console.log(client.lastRequest.headers);
201
+ console.log(client.lastRequest.data);
202
+
203
+ // Access details about the last response
204
+ console.log(client.httpClient.lastResponse.statusCode);
205
+ console.log(client.httpClient.lastResponse.body);
206
+ });
207
+ ```
208
+
209
+ ### Handle exceptions
210
+
211
+ If the Twilio API returns a 400 or a 500 level HTTP response, `twilio-node` will throw an error including relevant information, which you can then `catch`:
212
+
213
+ ```js
214
+ client.messages
215
+ .create({
216
+ body: 'Hello from Node',
217
+ to: '+12345678901',
218
+ from: '+12345678901',
219
+ })
220
+ .then((message) => console.log(message))
221
+ .catch((error) => {
222
+ // You can implement your fallback code here
223
+ console.log(error);
224
+ });
225
+ ```
226
+
227
+ or with `async/await`:
228
+
229
+ ```js
230
+ try {
231
+ const message = await client.messages.create({
232
+ body: 'Hello from Node',
233
+ to: '+12345678901',
234
+ from: '+12345678901',
235
+ });
236
+ console.log(message);
237
+ } catch (error) {
238
+ // You can implement your fallback code here
239
+ console.error(error);
240
+ }
241
+ ```
242
+
243
+ If you are using callbacks, error information will be included in the `error` parameter of the callback.
244
+
245
+ 400-level errors are [normal during API operation](https://www.twilio.com/docs/api/rest/request#get-responses) ("Invalid number", "Cannot deliver SMS to that number", for example) and should be handled appropriately.
246
+
247
+ ### Use a custom HTTP Client
248
+
249
+ To use a custom HTTP client with this helper library, please see the [advanced example of how to do so](./advanced-examples/custom-http-client.md).
250
+
251
+ ### Use webhook validation
252
+
253
+ See [example](examples/express.js) for a code sample for incoming Twilio request validation.
133
254
 
134
- ## Docker Image
255
+ ## Docker image
135
256
 
136
257
  The `Dockerfile` present in this repository and its respective `twilio/twilio-node` Docker image are currently used by Twilio for testing purposes only.
137
258
 
@@ -149,7 +270,7 @@ Bug fixes, docs, and library improvements are always welcome. Please refer to ou
149
270
 
150
271
  If you're not familiar with the GitHub pull request/contribution process, [this is a nice tutorial](https://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
151
272
 
152
- #### Getting Started
273
+ ### Get started
153
274
 
154
275
  If you want to familiarize yourself with the project, you can start by [forking the repository](https://help.github.com/articles/fork-a-repo/) and [cloning it in your local development environment](https://help.github.com/articles/cloning-a-repository/). The project requires [Node.js](https://nodejs.org) to be installed on your machine.
155
276
 
@@ -69,12 +69,6 @@ export interface ConversationListInstanceCreateOptions {
69
69
  * Options to pass to each
70
70
  */
71
71
  export interface ConversationListInstanceEachOptions {
72
- /** Start date in ISO8601 format for sorting and filtering list of Conversations. */
73
- startDate?: string;
74
- /** End date in ISO8601 format for sorting and filtering list of Conversations. */
75
- endDate?: string;
76
- /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */
77
- state?: ConversationState;
78
72
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
79
73
  pageSize?: number;
80
74
  /** Function to process each record. If this and a positional callback are passed, this one will be used */
@@ -88,12 +82,6 @@ export interface ConversationListInstanceEachOptions {
88
82
  * Options to pass to list
89
83
  */
90
84
  export interface ConversationListInstanceOptions {
91
- /** Start date in ISO8601 format for sorting and filtering list of Conversations. */
92
- startDate?: string;
93
- /** End date in ISO8601 format for sorting and filtering list of Conversations. */
94
- endDate?: string;
95
- /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */
96
- state?: ConversationState;
97
85
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
98
86
  pageSize?: number;
99
87
  /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
@@ -103,12 +91,6 @@ export interface ConversationListInstanceOptions {
103
91
  * Options to pass to page
104
92
  */
105
93
  export interface ConversationListInstancePageOptions {
106
- /** Start date in ISO8601 format for sorting and filtering list of Conversations. */
107
- startDate?: string;
108
- /** End date in ISO8601 format for sorting and filtering list of Conversations. */
109
- endDate?: string;
110
- /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */
111
- state?: ConversationState;
112
94
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
113
95
  pageSize?: number;
114
96
  /** Page Number, this value is simply for client state */
@@ -282,12 +282,6 @@ function ConversationListInstance(version) {
282
282
  params = params || {};
283
283
  }
284
284
  let data = {};
285
- if (params["startDate"] !== undefined)
286
- data["StartDate"] = params["startDate"];
287
- if (params["endDate"] !== undefined)
288
- data["EndDate"] = params["endDate"];
289
- if (params["state"] !== undefined)
290
- data["State"] = params["state"];
291
285
  if (params["pageSize"] !== undefined)
292
286
  data["PageSize"] = params["pageSize"];
293
287
  if (params.pageNumber !== undefined)
@@ -69,12 +69,6 @@ export interface ConversationListInstanceCreateOptions {
69
69
  * Options to pass to each
70
70
  */
71
71
  export interface ConversationListInstanceEachOptions {
72
- /** Start date in ISO8601 format for sorting and filtering list of Conversations. */
73
- startDate?: string;
74
- /** End date in ISO8601 format for sorting and filtering list of Conversations. */
75
- endDate?: string;
76
- /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */
77
- state?: ConversationState;
78
72
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
79
73
  pageSize?: number;
80
74
  /** Function to process each record. If this and a positional callback are passed, this one will be used */
@@ -88,12 +82,6 @@ export interface ConversationListInstanceEachOptions {
88
82
  * Options to pass to list
89
83
  */
90
84
  export interface ConversationListInstanceOptions {
91
- /** Start date in ISO8601 format for sorting and filtering list of Conversations. */
92
- startDate?: string;
93
- /** End date in ISO8601 format for sorting and filtering list of Conversations. */
94
- endDate?: string;
95
- /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */
96
- state?: ConversationState;
97
85
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
98
86
  pageSize?: number;
99
87
  /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
@@ -103,12 +91,6 @@ export interface ConversationListInstanceOptions {
103
91
  * Options to pass to page
104
92
  */
105
93
  export interface ConversationListInstancePageOptions {
106
- /** Start date in ISO8601 format for sorting and filtering list of Conversations. */
107
- startDate?: string;
108
- /** End date in ISO8601 format for sorting and filtering list of Conversations. */
109
- endDate?: string;
110
- /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */
111
- state?: ConversationState;
112
94
  /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
113
95
  pageSize?: number;
114
96
  /** Page Number, this value is simply for client state */
@@ -290,12 +290,6 @@ function ConversationListInstance(version, chatServiceSid) {
290
290
  params = params || {};
291
291
  }
292
292
  let data = {};
293
- if (params["startDate"] !== undefined)
294
- data["StartDate"] = params["startDate"];
295
- if (params["endDate"] !== undefined)
296
- data["EndDate"] = params["endDate"];
297
- if (params["state"] !== undefined)
298
- data["State"] = params["state"];
299
293
  if (params["pageSize"] !== undefined)
300
294
  data["PageSize"] = params["pageSize"];
301
295
  if (params.pageNumber !== undefined)
@@ -20,8 +20,8 @@ export interface AssessmentsContextUpdateOptions {
20
20
  * Options to pass to create a AssessmentsInstance
21
21
  */
22
22
  export interface AssessmentsListInstanceCreateOptions {
23
- /** The id of the category */
24
- categoryId: string;
23
+ /** The SID of the category */
24
+ categorySid: string;
25
25
  /** The name of the category */
26
26
  categoryName: string;
27
27
  /** Segment Id of the conversation */
@@ -34,7 +34,7 @@ export interface AssessmentsListInstanceCreateOptions {
34
34
  agentId: string;
35
35
  /** The offset of the conversation. */
36
36
  offset: number;
37
- /** The question Id selected for assessment */
37
+ /** The question SID selected for assessment */
38
38
  metricId: string;
39
39
  /** The question name of the assessment */
40
40
  metricName: string;
@@ -42,8 +42,8 @@ export interface AssessmentsListInstanceCreateOptions {
42
42
  answerText: string;
43
43
  /** The id of the answer selected by user */
44
44
  answerId: string;
45
- /** Questionnaire Id of the associated question */
46
- questionnaireId: string;
45
+ /** Questionnaire SID of the associated question */
46
+ questionnaireSid: string;
47
47
  /** The Token HTTP request header */
48
48
  token?: string;
49
49
  }
@@ -109,13 +109,13 @@ export interface AssessmentsContext {
109
109
  [inspect.custom](_depth: any, options: InspectOptions): any;
110
110
  }
111
111
  export interface AssessmentsContextSolution {
112
- assessmentId: string;
112
+ assessmentSid: string;
113
113
  }
114
114
  export declare class AssessmentsContextImpl implements AssessmentsContext {
115
115
  protected _version: V1;
116
116
  protected _solution: AssessmentsContextSolution;
117
117
  protected _uri: string;
118
- constructor(_version: V1, assessmentId: string);
118
+ constructor(_version: V1, assessmentSid: string);
119
119
  update(params: AssessmentsContextUpdateOptions, callback?: (error: Error | null, item?: AssessmentsInstance) => any): Promise<AssessmentsInstance>;
120
120
  /**
121
121
  * Provide a user-friendly representation
@@ -130,7 +130,7 @@ interface AssessmentsPayload extends TwilioResponsePayload {
130
130
  }
131
131
  interface AssessmentsResource {
132
132
  account_sid: string;
133
- assessment_id: string;
133
+ assessment_sid: string;
134
134
  offset: number;
135
135
  report: boolean;
136
136
  weight: number;
@@ -148,15 +148,15 @@ export declare class AssessmentsInstance {
148
148
  protected _version: V1;
149
149
  protected _solution: AssessmentsContextSolution;
150
150
  protected _context?: AssessmentsContext;
151
- constructor(_version: V1, payload: AssessmentsResource, assessmentId?: string);
151
+ constructor(_version: V1, payload: AssessmentsResource, assessmentSid?: string);
152
152
  /**
153
153
  * The unique SID identifier of the Account.
154
154
  */
155
155
  accountSid: string;
156
156
  /**
157
- * The unique id of the assessment
157
+ * The SID of the assessment
158
158
  */
159
- assessmentId: string;
159
+ assessmentSid: string;
160
160
  /**
161
161
  * Offset of the conversation
162
162
  */
@@ -216,7 +216,7 @@ export declare class AssessmentsInstance {
216
216
  */
217
217
  toJSON(): {
218
218
  accountSid: string;
219
- assessmentId: string;
219
+ assessmentSid: string;
220
220
  offset: number;
221
221
  report: boolean;
222
222
  weight: number;
@@ -238,8 +238,8 @@ export interface AssessmentsListInstance {
238
238
  _version: V1;
239
239
  _solution: AssessmentsSolution;
240
240
  _uri: string;
241
- (assessmentId: string): AssessmentsContext;
242
- get(assessmentId: string): AssessmentsContext;
241
+ (assessmentSid: string): AssessmentsContext;
242
+ get(assessmentSid: string): AssessmentsContext;
243
243
  /**
244
244
  * Create a AssessmentsInstance
245
245
  *
@@ -23,13 +23,13 @@ const deserialize = require("../../../base/deserialize");
23
23
  const serialize = require("../../../base/serialize");
24
24
  const utility_1 = require("../../../base/utility");
25
25
  class AssessmentsContextImpl {
26
- constructor(_version, assessmentId) {
26
+ constructor(_version, assessmentSid) {
27
27
  this._version = _version;
28
- if (!(0, utility_1.isValidPathParam)(assessmentId)) {
29
- throw new Error("Parameter 'assessmentId' is not valid.");
28
+ if (!(0, utility_1.isValidPathParam)(assessmentSid)) {
29
+ throw new Error("Parameter 'assessmentSid' is not valid.");
30
30
  }
31
- this._solution = { assessmentId };
32
- this._uri = `/Insights/QM/Assessments/${assessmentId}`;
31
+ this._solution = { assessmentSid };
32
+ this._uri = `/Insights/QualityManagement/Assessments/${assessmentSid}`;
33
33
  }
34
34
  update(params, callback) {
35
35
  if (params === null || params === undefined) {
@@ -59,7 +59,7 @@ class AssessmentsContextImpl {
59
59
  data,
60
60
  headers,
61
61
  });
62
- operationPromise = operationPromise.then((payload) => new AssessmentsInstance(operationVersion, payload, instance._solution.assessmentId));
62
+ operationPromise = operationPromise.then((payload) => new AssessmentsInstance(operationVersion, payload, instance._solution.assessmentSid));
63
63
  operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
64
64
  return operationPromise;
65
65
  }
@@ -77,10 +77,10 @@ class AssessmentsContextImpl {
77
77
  }
78
78
  exports.AssessmentsContextImpl = AssessmentsContextImpl;
79
79
  class AssessmentsInstance {
80
- constructor(_version, payload, assessmentId) {
80
+ constructor(_version, payload, assessmentSid) {
81
81
  this._version = _version;
82
82
  this.accountSid = payload.account_sid;
83
- this.assessmentId = payload.assessment_id;
83
+ this.assessmentSid = payload.assessment_sid;
84
84
  this.offset = payload.offset;
85
85
  this.report = payload.report;
86
86
  this.weight = payload.weight;
@@ -93,12 +93,12 @@ class AssessmentsInstance {
93
93
  this.assessment = payload.assessment;
94
94
  this.timestamp = payload.timestamp;
95
95
  this.url = payload.url;
96
- this._solution = { assessmentId: assessmentId || this.assessmentId };
96
+ this._solution = { assessmentSid: assessmentSid || this.assessmentSid };
97
97
  }
98
98
  get _proxy() {
99
99
  this._context =
100
100
  this._context ||
101
- new AssessmentsContextImpl(this._version, this._solution.assessmentId);
101
+ new AssessmentsContextImpl(this._version, this._solution.assessmentSid);
102
102
  return this._context;
103
103
  }
104
104
  update(params, callback) {
@@ -112,7 +112,7 @@ class AssessmentsInstance {
112
112
  toJSON() {
113
113
  return {
114
114
  accountSid: this.accountSid,
115
- assessmentId: this.assessmentId,
115
+ assessmentSid: this.assessmentSid,
116
116
  offset: this.offset,
117
117
  report: this.report,
118
118
  weight: this.weight,
@@ -133,19 +133,19 @@ class AssessmentsInstance {
133
133
  }
134
134
  exports.AssessmentsInstance = AssessmentsInstance;
135
135
  function AssessmentsListInstance(version) {
136
- const instance = ((assessmentId) => instance.get(assessmentId));
137
- instance.get = function get(assessmentId) {
138
- return new AssessmentsContextImpl(version, assessmentId);
136
+ const instance = ((assessmentSid) => instance.get(assessmentSid));
137
+ instance.get = function get(assessmentSid) {
138
+ return new AssessmentsContextImpl(version, assessmentSid);
139
139
  };
140
140
  instance._version = version;
141
141
  instance._solution = {};
142
- instance._uri = `/Insights/QM/Assessments`;
142
+ instance._uri = `/Insights/QualityManagement/Assessments`;
143
143
  instance.create = function create(params, callback) {
144
144
  if (params === null || params === undefined) {
145
145
  throw new Error('Required parameter "params" missing.');
146
146
  }
147
- if (params["categoryId"] === null || params["categoryId"] === undefined) {
148
- throw new Error("Required parameter \"params['categoryId']\" missing.");
147
+ if (params["categorySid"] === null || params["categorySid"] === undefined) {
148
+ throw new Error("Required parameter \"params['categorySid']\" missing.");
149
149
  }
150
150
  if (params["categoryName"] === null ||
151
151
  params["categoryName"] === undefined) {
@@ -178,12 +178,12 @@ function AssessmentsListInstance(version) {
178
178
  if (params["answerId"] === null || params["answerId"] === undefined) {
179
179
  throw new Error("Required parameter \"params['answerId']\" missing.");
180
180
  }
181
- if (params["questionnaireId"] === null ||
182
- params["questionnaireId"] === undefined) {
183
- throw new Error("Required parameter \"params['questionnaireId']\" missing.");
181
+ if (params["questionnaireSid"] === null ||
182
+ params["questionnaireSid"] === undefined) {
183
+ throw new Error("Required parameter \"params['questionnaireSid']\" missing.");
184
184
  }
185
185
  let data = {};
186
- data["CategoryId"] = params["categoryId"];
186
+ data["CategorySid"] = params["categorySid"];
187
187
  data["CategoryName"] = params["categoryName"];
188
188
  data["SegmentId"] = params["segmentId"];
189
189
  data["UserName"] = params["userName"];
@@ -194,7 +194,7 @@ function AssessmentsListInstance(version) {
194
194
  data["MetricName"] = params["metricName"];
195
195
  data["AnswerText"] = params["answerText"];
196
196
  data["AnswerId"] = params["answerId"];
197
- data["QuestionnaireId"] = params["questionnaireId"];
197
+ data["QuestionnaireSid"] = params["questionnaireSid"];
198
198
  const headers = {};
199
199
  headers["Content-Type"] = "application/x-www-form-urlencoded";
200
200
  if (params["token"] !== undefined)
@@ -154,7 +154,7 @@ interface InsightsAssessmentsCommentPayload extends TwilioResponsePayload {
154
154
  }
155
155
  interface InsightsAssessmentsCommentResource {
156
156
  account_sid: string;
157
- assessment_id: string;
157
+ assessment_sid: string;
158
158
  comment: any;
159
159
  offset: number;
160
160
  report: boolean;
@@ -174,9 +174,9 @@ export declare class InsightsAssessmentsCommentInstance {
174
174
  */
175
175
  accountSid: string;
176
176
  /**
177
- * The unique ID of the assessment.
177
+ * The SID of the assessment.
178
178
  */
179
- assessmentId: string;
179
+ assessmentSid: string;
180
180
  /**
181
181
  * The comment added for assessment.
182
182
  */
@@ -221,7 +221,7 @@ export declare class InsightsAssessmentsCommentInstance {
221
221
  */
222
222
  toJSON(): {
223
223
  accountSid: string;
224
- assessmentId: string;
224
+ assessmentSid: string;
225
225
  comment: any;
226
226
  offset: number;
227
227
  report: boolean;
@@ -25,7 +25,7 @@ function InsightsAssessmentsCommentListInstance(version) {
25
25
  const instance = {};
26
26
  instance._version = version;
27
27
  instance._solution = {};
28
- instance._uri = `/Insights/QM/Assessments/Comments`;
28
+ instance._uri = `/Insights/QualityManagement/Assessments/Comments`;
29
29
  instance.create = function create(params, callback) {
30
30
  if (params === null || params === undefined) {
31
31
  throw new Error('Required parameter "params" missing.');
@@ -134,7 +134,7 @@ class InsightsAssessmentsCommentInstance {
134
134
  constructor(_version, payload) {
135
135
  this._version = _version;
136
136
  this.accountSid = payload.account_sid;
137
- this.assessmentId = payload.assessment_id;
137
+ this.assessmentSid = payload.assessment_sid;
138
138
  this.comment = payload.comment;
139
139
  this.offset = payload.offset;
140
140
  this.report = payload.report;
@@ -154,7 +154,7 @@ class InsightsAssessmentsCommentInstance {
154
154
  toJSON() {
155
155
  return {
156
156
  accountSid: this.accountSid,
157
- assessmentId: this.assessmentId,
157
+ assessmentSid: this.assessmentSid,
158
158
  comment: this.comment,
159
159
  offset: this.offset,
160
160
  report: this.report,