twilio 4.9.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.
- package/README.md +151 -30
- package/lib/rest/flexApi/v1/assessments.d.ts +14 -14
- package/lib/rest/flexApi/v1/assessments.js +22 -22
- package/lib/rest/flexApi/v1/insightsAssessmentsComment.d.ts +4 -4
- package/lib/rest/flexApi/v1/insightsAssessmentsComment.js +3 -3
- package/lib/rest/flexApi/v1/insightsQuestionnaires.d.ts +13 -13
- package/lib/rest/flexApi/v1/insightsQuestionnaires.js +22 -20
- package/lib/rest/flexApi/v1/insightsQuestionnairesCategory.d.ts +9 -9
- package/lib/rest/flexApi/v1/insightsQuestionnairesCategory.js +15 -15
- package/lib/rest/flexApi/v1/insightsQuestionnairesQuestion.d.ts +19 -19
- package/lib/rest/flexApi/v1/insightsQuestionnairesQuestion.js +22 -22
- package/lib/rest/flexApi/v1/insightsSegments.d.ts +56 -120
- package/lib/rest/flexApi/v1/insightsSegments.js +40 -97
- package/lib/rest/flexApi/v1/insightsSettingsAnswerSets.js +1 -1
- package/lib/rest/flexApi/v1/insightsSettingsComment.js +1 -1
- package/lib/rest/insights/v1/callSummaries.d.ts +6 -0
- package/lib/rest/insights/v1/callSummaries.js +2 -0
- package/lib/rest/lookups/v2/phoneNumber.d.ts +0 -6
- package/lib/rest/lookups/v2/phoneNumber.js +0 -2
- package/lib/rest/messaging/V1.d.ts +0 -5
- package/lib/rest/messaging/V1.js +0 -7
- package/lib/rest/messaging/v1/brandRegistration/brandRegistrationOtp.d.ts +52 -0
- package/lib/rest/messaging/v1/brandRegistration/brandRegistrationOtp.js +68 -0
- package/lib/rest/messaging/v1/brandRegistration.d.ts +10 -2
- package/lib/rest/messaging/v1/brandRegistration.js +13 -0
- package/lib/rest/messaging/v1/domainConfig.d.ts +17 -11
- package/lib/rest/messaging/v1/domainConfig.js +5 -10
- package/lib/rest/messaging/v1/service/usAppToPerson.d.ts +1 -1
- package/lib/rest/verify/v2/service.d.ts +3 -3
- package/lib/rest/verify/v2/template.d.ts +5 -5
- package/lib/twiml/VoiceResponse.d.ts +1 -1
- package/package.json +1 -1
- package/lib/rest/messaging/v1/tollfreeVerification.d.ts +0 -521
- 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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
60
|
-
|
|
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
|
-
|
|
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
|
-
|
|
75
|
-
|
|
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
|
-
|
|
79
|
-
|
|
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
|
-
|
|
89
|
-
|
|
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
|
-
|
|
93
|
-
|
|
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
|
-
|
|
111
|
-
|
|
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
|
-
|
|
124
|
-
See [example](examples/express.js) for a code sample for incoming Twilio request validation.
|
|
176
|
+
### Debug API requests
|
|
125
177
|
|
|
126
|
-
|
|
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
|
|
180
|
+
For example, you can retrieve the status code of the last response like so:
|
|
129
181
|
|
|
130
|
-
|
|
182
|
+
```js
|
|
183
|
+
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
|
|
184
|
+
const authToken = 'your_auth_token';
|
|
131
185
|
|
|
132
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
|
@@ -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
|
|
24
|
-
|
|
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
|
|
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
|
|
46
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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
|
|
157
|
+
* The SID of the assessment
|
|
158
158
|
*/
|
|
159
|
-
|
|
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
|
-
|
|
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
|
-
(
|
|
242
|
-
get(
|
|
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,
|
|
26
|
+
constructor(_version, assessmentSid) {
|
|
27
27
|
this._version = _version;
|
|
28
|
-
if (!(0, utility_1.isValidPathParam)(
|
|
29
|
-
throw new Error("Parameter '
|
|
28
|
+
if (!(0, utility_1.isValidPathParam)(assessmentSid)) {
|
|
29
|
+
throw new Error("Parameter 'assessmentSid' is not valid.");
|
|
30
30
|
}
|
|
31
|
-
this._solution = {
|
|
32
|
-
this._uri = `/Insights/
|
|
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.
|
|
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,
|
|
80
|
+
constructor(_version, payload, assessmentSid) {
|
|
81
81
|
this._version = _version;
|
|
82
82
|
this.accountSid = payload.account_sid;
|
|
83
|
-
this.
|
|
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 = {
|
|
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.
|
|
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
|
-
|
|
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 = ((
|
|
137
|
-
instance.get = function get(
|
|
138
|
-
return new AssessmentsContextImpl(version,
|
|
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/
|
|
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["
|
|
148
|
-
throw new Error("Required parameter \"params['
|
|
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["
|
|
182
|
-
params["
|
|
183
|
-
throw new Error("Required parameter \"params['
|
|
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["
|
|
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["
|
|
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
|
-
|
|
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
|
|
177
|
+
* The SID of the assessment.
|
|
178
178
|
*/
|
|
179
|
-
|
|
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
|
-
|
|
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/
|
|
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.
|
|
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
|
-
|
|
157
|
+
assessmentSid: this.assessmentSid,
|
|
158
158
|
comment: this.comment,
|
|
159
159
|
offset: this.offset,
|
|
160
160
|
report: this.report,
|
|
@@ -29,8 +29,8 @@ export interface InsightsQuestionnairesContextUpdateOptions {
|
|
|
29
29
|
name?: string;
|
|
30
30
|
/** The description of this questionnaire */
|
|
31
31
|
description?: string;
|
|
32
|
-
/** The list of questions
|
|
33
|
-
|
|
32
|
+
/** The list of questions sids under a questionnaire */
|
|
33
|
+
questionSids?: Array<string>;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Options to pass to create a InsightsQuestionnairesInstance
|
|
@@ -44,8 +44,8 @@ export interface InsightsQuestionnairesListInstanceCreateOptions {
|
|
|
44
44
|
description?: string;
|
|
45
45
|
/** The flag to enable or disable questionnaire */
|
|
46
46
|
active?: boolean;
|
|
47
|
-
/** The list of questions
|
|
48
|
-
|
|
47
|
+
/** The list of questions sids under a questionnaire */
|
|
48
|
+
questionSids?: Array<string>;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Options to pass to each
|
|
@@ -143,13 +143,13 @@ export interface InsightsQuestionnairesContext {
|
|
|
143
143
|
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
144
144
|
}
|
|
145
145
|
export interface InsightsQuestionnairesContextSolution {
|
|
146
|
-
|
|
146
|
+
questionnaireSid: string;
|
|
147
147
|
}
|
|
148
148
|
export declare class InsightsQuestionnairesContextImpl implements InsightsQuestionnairesContext {
|
|
149
149
|
protected _version: V1;
|
|
150
150
|
protected _solution: InsightsQuestionnairesContextSolution;
|
|
151
151
|
protected _uri: string;
|
|
152
|
-
constructor(_version: V1,
|
|
152
|
+
constructor(_version: V1, questionnaireSid: string);
|
|
153
153
|
remove(params?: InsightsQuestionnairesContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
154
154
|
fetch(params?: InsightsQuestionnairesContextFetchOptions | ((error: Error | null, item?: InsightsQuestionnairesInstance) => any), callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
|
|
155
155
|
update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>;
|
|
@@ -166,7 +166,7 @@ interface InsightsQuestionnairesPayload extends TwilioResponsePayload {
|
|
|
166
166
|
}
|
|
167
167
|
interface InsightsQuestionnairesResource {
|
|
168
168
|
account_sid: string;
|
|
169
|
-
|
|
169
|
+
questionnaire_sid: string;
|
|
170
170
|
name: string;
|
|
171
171
|
description: string;
|
|
172
172
|
active: boolean;
|
|
@@ -177,15 +177,15 @@ export declare class InsightsQuestionnairesInstance {
|
|
|
177
177
|
protected _version: V1;
|
|
178
178
|
protected _solution: InsightsQuestionnairesContextSolution;
|
|
179
179
|
protected _context?: InsightsQuestionnairesContext;
|
|
180
|
-
constructor(_version: V1, payload: InsightsQuestionnairesResource,
|
|
180
|
+
constructor(_version: V1, payload: InsightsQuestionnairesResource, questionnaireSid?: string);
|
|
181
181
|
/**
|
|
182
182
|
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource.
|
|
183
183
|
*/
|
|
184
184
|
accountSid: string;
|
|
185
185
|
/**
|
|
186
|
-
* The
|
|
186
|
+
* The sid of this questionnaire
|
|
187
187
|
*/
|
|
188
|
-
|
|
188
|
+
questionnaireSid: string;
|
|
189
189
|
/**
|
|
190
190
|
* The name of this category.
|
|
191
191
|
*/
|
|
@@ -254,7 +254,7 @@ export declare class InsightsQuestionnairesInstance {
|
|
|
254
254
|
*/
|
|
255
255
|
toJSON(): {
|
|
256
256
|
accountSid: string;
|
|
257
|
-
|
|
257
|
+
questionnaireSid: string;
|
|
258
258
|
name: string;
|
|
259
259
|
description: string;
|
|
260
260
|
active: boolean;
|
|
@@ -269,8 +269,8 @@ export interface InsightsQuestionnairesListInstance {
|
|
|
269
269
|
_version: V1;
|
|
270
270
|
_solution: InsightsQuestionnairesSolution;
|
|
271
271
|
_uri: string;
|
|
272
|
-
(
|
|
273
|
-
get(
|
|
272
|
+
(questionnaireSid: string): InsightsQuestionnairesContext;
|
|
273
|
+
get(questionnaireSid: string): InsightsQuestionnairesContext;
|
|
274
274
|
/**
|
|
275
275
|
* Create a InsightsQuestionnairesInstance
|
|
276
276
|
*
|