twilio 3.69.0 → 3.71.3
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/CHANGES.md +96 -0
- package/README.md +1 -1
- package/lib/jwt/AccessToken.d.ts +16 -0
- package/lib/jwt/AccessToken.js +20 -0
- package/lib/jwt/ClientCapability.d.ts +1 -1
- package/lib/rest/Media.d.ts +28 -0
- package/lib/rest/Media.js +64 -0
- package/lib/rest/Supersim.d.ts +2 -0
- package/lib/rest/Supersim.js +8 -0
- package/lib/rest/Twilio.d.ts +2 -0
- package/lib/rest/Twilio.js +14 -0
- package/lib/rest/api/v2010/account/call.d.ts +1 -1
- package/lib/rest/api/v2010/account/call.js +1 -1
- package/lib/rest/api/v2010/account/incomingPhoneNumber/local.d.ts +5 -1
- package/lib/rest/api/v2010/account/incomingPhoneNumber/local.js +3 -0
- package/lib/rest/api/v2010/account/incomingPhoneNumber/mobile.d.ts +5 -1
- package/lib/rest/api/v2010/account/incomingPhoneNumber/mobile.js +3 -0
- package/lib/rest/api/v2010/account/incomingPhoneNumber/tollFree.d.ts +5 -1
- package/lib/rest/api/v2010/account/incomingPhoneNumber/tollFree.js +3 -0
- package/lib/rest/api/v2010/account/incomingPhoneNumber.d.ts +5 -1
- package/lib/rest/api/v2010/account/incomingPhoneNumber.js +3 -0
- package/lib/rest/conversations/v1/service/configuration/webhook.d.ts +172 -0
- package/lib/rest/conversations/v1/service/configuration/webhook.js +399 -0
- package/lib/rest/conversations/v1/service/configuration.d.ts +2 -0
- package/lib/rest/conversations/v1/service/configuration.js +13 -0
- package/lib/rest/flexApi/v1/configuration.d.ts +4 -0
- package/lib/rest/flexApi/v1/configuration.js +5 -0
- package/lib/rest/frontlineApi/v1/user.d.ts +4 -0
- package/lib/rest/frontlineApi/v1/user.js +10 -1
- package/lib/rest/media/V1.d.ts +28 -0
- package/lib/rest/media/V1.js +59 -0
- package/lib/rest/media/v1/mediaProcessor.d.ts +355 -0
- package/lib/rest/media/v1/mediaProcessor.js +702 -0
- package/lib/rest/media/v1/playerStreamer/playbackGrant.d.ts +162 -0
- package/lib/rest/media/v1/playerStreamer/playbackGrant.js +384 -0
- package/lib/rest/media/v1/playerStreamer.d.ts +366 -0
- package/lib/rest/media/v1/playerStreamer.js +729 -0
- package/lib/rest/messaging/v1/brandRegistration/brandVetting.d.ts +330 -0
- package/lib/rest/messaging/v1/brandRegistration/brandVetting.js +655 -0
- package/lib/rest/messaging/v1/brandRegistration.d.ts +15 -2
- package/lib/rest/messaging/v1/brandRegistration.js +37 -1
- package/lib/rest/messaging/v1/service.d.ts +8 -0
- package/lib/rest/messaging/v1/service.js +14 -0
- package/lib/rest/serverless/v1/service/build.d.ts +1 -1
- package/lib/rest/supersim/V1.d.ts +3 -0
- package/lib/rest/supersim/V1.js +11 -0
- package/lib/rest/supersim/v1/ipCommand.d.ts +362 -0
- package/lib/rest/supersim/v1/ipCommand.js +679 -0
- package/lib/rest/verify/v2/service/accessToken.d.ts +2 -0
- package/lib/rest/verify/v2/service/accessToken.js +3 -1
- package/lib/rest/verify/v2/service/entity/factor.d.ts +4 -2
- package/lib/rest/verify/v2/service/entity/factor.js +8 -3
- package/lib/rest/verify/v2/service/entity/newFactor.d.ts +2 -2
- package/lib/rest/verify/v2/service/entity/newFactor.js +1 -1
- package/lib/rest/verify/v2/service/verification.d.ts +4 -0
- package/lib/rest/verify/v2/service/verification.js +6 -1
- package/lib/rest/verify/v2/service.d.ts +6 -0
- package/lib/rest/verify/v2/service.js +12 -2
- package/lib/rest/verify/v2/verificationAttempt.d.ts +1 -1
- package/lib/rest/video/v1/room.d.ts +8 -0
- package/lib/rest/video/v1/room.js +13 -1
- package/lib/rest/wireless/v1/ratePlan.d.ts +1 -1
- package/lib/rest/wireless/v1/ratePlan.js +3 -3
- package/lib/rest/wireless/v1/sim.d.ts +4 -4
- package/lib/rest/wireless/v1/sim.js +18 -24
- package/lib/twiml/VoiceResponse.d.ts +1296 -24
- package/lib/twiml/VoiceResponse.js +2170 -82
- package/package.json +2 -2
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by
|
|
3
|
+
* \ / _ _ _| _ _
|
|
4
|
+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
* / /
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import Page = require('../../../../../base/Page');
|
|
9
|
+
import Response = require('../../../../../http/response');
|
|
10
|
+
import V1 = require('../../../V1');
|
|
11
|
+
import { SerializableClass } from '../../../../../interfaces';
|
|
12
|
+
|
|
13
|
+
type WebhookMethod = 'GET'|'POST';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the WebhookList
|
|
17
|
+
*
|
|
18
|
+
* @param version - Version of the resource
|
|
19
|
+
* @param chatServiceSid - The unique string that identifies the resource
|
|
20
|
+
*/
|
|
21
|
+
declare function WebhookList(version: V1, chatServiceSid: string): WebhookListInstance;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Options to pass to update
|
|
25
|
+
*
|
|
26
|
+
* @property filters - The list of webhook event triggers that are enabled for this Service.
|
|
27
|
+
* @property method - The HTTP method to be used when sending a webhook request
|
|
28
|
+
* @property postWebhookUrl - The absolute url the post-event webhook request should be sent to.
|
|
29
|
+
* @property preWebhookUrl - The absolute url the pre-event webhook request should be sent to.
|
|
30
|
+
*/
|
|
31
|
+
interface WebhookInstanceUpdateOptions {
|
|
32
|
+
filters?: string | string[];
|
|
33
|
+
method?: string;
|
|
34
|
+
postWebhookUrl?: string;
|
|
35
|
+
preWebhookUrl?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface WebhookListInstance {
|
|
39
|
+
/**
|
|
40
|
+
* @param sid - sid of instance
|
|
41
|
+
*/
|
|
42
|
+
(sid: string): WebhookContext;
|
|
43
|
+
/**
|
|
44
|
+
* Constructs a webhook
|
|
45
|
+
*/
|
|
46
|
+
get(): WebhookContext;
|
|
47
|
+
/**
|
|
48
|
+
* Provide a user-friendly representation
|
|
49
|
+
*/
|
|
50
|
+
toJSON(): any;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface WebhookPayload extends WebhookResource, Page.TwilioResponsePayload {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface WebhookResource {
|
|
57
|
+
account_sid: string;
|
|
58
|
+
chat_service_sid: string;
|
|
59
|
+
filters: string[];
|
|
60
|
+
method: WebhookMethod;
|
|
61
|
+
post_webhook_url: string;
|
|
62
|
+
pre_webhook_url: string;
|
|
63
|
+
url: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface WebhookSolution {
|
|
67
|
+
chatServiceSid?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
declare class WebhookContext {
|
|
72
|
+
/**
|
|
73
|
+
* Initialize the WebhookContext
|
|
74
|
+
*
|
|
75
|
+
* @param version - Version of the resource
|
|
76
|
+
* @param chatServiceSid - The unique ID of the Conversation Service this conversation belongs to.
|
|
77
|
+
*/
|
|
78
|
+
constructor(version: V1, chatServiceSid: string);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* fetch a WebhookInstance
|
|
82
|
+
*
|
|
83
|
+
* @param callback - Callback to handle processed record
|
|
84
|
+
*/
|
|
85
|
+
fetch(callback?: (error: Error | null, items: WebhookInstance) => any): Promise<WebhookInstance>;
|
|
86
|
+
/**
|
|
87
|
+
* Provide a user-friendly representation
|
|
88
|
+
*/
|
|
89
|
+
toJSON(): any;
|
|
90
|
+
/**
|
|
91
|
+
* update a WebhookInstance
|
|
92
|
+
*
|
|
93
|
+
* @param callback - Callback to handle processed record
|
|
94
|
+
*/
|
|
95
|
+
update(callback?: (error: Error | null, items: WebhookInstance) => any): Promise<WebhookInstance>;
|
|
96
|
+
/**
|
|
97
|
+
* update a WebhookInstance
|
|
98
|
+
*
|
|
99
|
+
* @param opts - Options for request
|
|
100
|
+
* @param callback - Callback to handle processed record
|
|
101
|
+
*/
|
|
102
|
+
update(opts?: WebhookInstanceUpdateOptions, callback?: (error: Error | null, items: WebhookInstance) => any): Promise<WebhookInstance>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
declare class WebhookInstance extends SerializableClass {
|
|
107
|
+
/**
|
|
108
|
+
* Initialize the WebhookContext
|
|
109
|
+
*
|
|
110
|
+
* @param version - Version of the resource
|
|
111
|
+
* @param payload - The instance payload
|
|
112
|
+
* @param chatServiceSid - The unique string that identifies the resource
|
|
113
|
+
*/
|
|
114
|
+
constructor(version: V1, payload: WebhookPayload, chatServiceSid: string);
|
|
115
|
+
|
|
116
|
+
private _proxy: WebhookContext;
|
|
117
|
+
accountSid: string;
|
|
118
|
+
chatServiceSid: string;
|
|
119
|
+
/**
|
|
120
|
+
* fetch a WebhookInstance
|
|
121
|
+
*
|
|
122
|
+
* @param callback - Callback to handle processed record
|
|
123
|
+
*/
|
|
124
|
+
fetch(callback?: (error: Error | null, items: WebhookInstance) => any): Promise<WebhookInstance>;
|
|
125
|
+
filters: string[];
|
|
126
|
+
method: WebhookMethod;
|
|
127
|
+
postWebhookUrl: string;
|
|
128
|
+
preWebhookUrl: string;
|
|
129
|
+
/**
|
|
130
|
+
* Provide a user-friendly representation
|
|
131
|
+
*/
|
|
132
|
+
toJSON(): any;
|
|
133
|
+
/**
|
|
134
|
+
* update a WebhookInstance
|
|
135
|
+
*
|
|
136
|
+
* @param callback - Callback to handle processed record
|
|
137
|
+
*/
|
|
138
|
+
update(callback?: (error: Error | null, items: WebhookInstance) => any): Promise<WebhookInstance>;
|
|
139
|
+
/**
|
|
140
|
+
* update a WebhookInstance
|
|
141
|
+
*
|
|
142
|
+
* @param opts - Options for request
|
|
143
|
+
* @param callback - Callback to handle processed record
|
|
144
|
+
*/
|
|
145
|
+
update(opts?: WebhookInstanceUpdateOptions, callback?: (error: Error | null, items: WebhookInstance) => any): Promise<WebhookInstance>;
|
|
146
|
+
url: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
declare class WebhookPage extends Page<V1, WebhookPayload, WebhookResource, WebhookInstance> {
|
|
151
|
+
/**
|
|
152
|
+
* Initialize the WebhookPage
|
|
153
|
+
*
|
|
154
|
+
* @param version - Version of the resource
|
|
155
|
+
* @param response - Response from the API
|
|
156
|
+
* @param solution - Path solution
|
|
157
|
+
*/
|
|
158
|
+
constructor(version: V1, response: Response<string>, solution: WebhookSolution);
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Build an instance of WebhookInstance
|
|
162
|
+
*
|
|
163
|
+
* @param payload - Payload response from the API
|
|
164
|
+
*/
|
|
165
|
+
getInstance(payload: WebhookPayload): WebhookInstance;
|
|
166
|
+
/**
|
|
167
|
+
* Provide a user-friendly representation
|
|
168
|
+
*/
|
|
169
|
+
toJSON(): any;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { WebhookContext, WebhookInstance, WebhookInstanceUpdateOptions, WebhookList, WebhookListInstance, WebhookMethod, WebhookPage, WebhookPayload, WebhookResource, WebhookSolution }
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* jshint ignore:start */
|
|
4
|
+
/**
|
|
5
|
+
* This code was generated by
|
|
6
|
+
* \ / _ _ _| _ _
|
|
7
|
+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
8
|
+
* / /
|
|
9
|
+
*/
|
|
10
|
+
/* jshint ignore:end */
|
|
11
|
+
|
|
12
|
+
var Q = require('q'); /* jshint ignore:line */
|
|
13
|
+
var _ = require('lodash'); /* jshint ignore:line */
|
|
14
|
+
var util = require('util'); /* jshint ignore:line */
|
|
15
|
+
var Page = require('../../../../../base/Page'); /* jshint ignore:line */
|
|
16
|
+
var serialize = require(
|
|
17
|
+
'../../../../../base/serialize'); /* jshint ignore:line */
|
|
18
|
+
var values = require('../../../../../base/values'); /* jshint ignore:line */
|
|
19
|
+
|
|
20
|
+
var WebhookList;
|
|
21
|
+
var WebhookPage;
|
|
22
|
+
var WebhookInstance;
|
|
23
|
+
var WebhookContext;
|
|
24
|
+
|
|
25
|
+
/* jshint ignore:start */
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the WebhookList
|
|
28
|
+
*
|
|
29
|
+
* @constructor Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookList
|
|
30
|
+
*
|
|
31
|
+
* @param {Twilio.Conversations.V1} version - Version of the resource
|
|
32
|
+
* @param {string} chatServiceSid - The unique string that identifies the resource
|
|
33
|
+
*/
|
|
34
|
+
/* jshint ignore:end */
|
|
35
|
+
WebhookList = function WebhookList(version, chatServiceSid) {
|
|
36
|
+
/* jshint ignore:start */
|
|
37
|
+
/**
|
|
38
|
+
* @function webhooks
|
|
39
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext#
|
|
40
|
+
*
|
|
41
|
+
* @param {string} sid - sid of instance
|
|
42
|
+
*
|
|
43
|
+
* @returns {Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookContext}
|
|
44
|
+
*/
|
|
45
|
+
/* jshint ignore:end */
|
|
46
|
+
function WebhookListInstance(sid) {
|
|
47
|
+
return WebhookListInstance.get(sid);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
WebhookListInstance._version = version;
|
|
51
|
+
// Path Solution
|
|
52
|
+
WebhookListInstance._solution = {chatServiceSid: chatServiceSid};
|
|
53
|
+
/* jshint ignore:start */
|
|
54
|
+
/**
|
|
55
|
+
* Constructs a webhook
|
|
56
|
+
*
|
|
57
|
+
* @function get
|
|
58
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookList#
|
|
59
|
+
*
|
|
60
|
+
* @returns {Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookContext}
|
|
61
|
+
*/
|
|
62
|
+
/* jshint ignore:end */
|
|
63
|
+
WebhookListInstance.get = function get() {
|
|
64
|
+
return new WebhookContext(this._version, this._solution.chatServiceSid);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/* jshint ignore:start */
|
|
68
|
+
/**
|
|
69
|
+
* Provide a user-friendly representation
|
|
70
|
+
*
|
|
71
|
+
* @function toJSON
|
|
72
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookList#
|
|
73
|
+
*
|
|
74
|
+
* @returns Object
|
|
75
|
+
*/
|
|
76
|
+
/* jshint ignore:end */
|
|
77
|
+
WebhookListInstance.toJSON = function toJSON() {
|
|
78
|
+
return this._solution;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
WebhookListInstance[util.inspect.custom] = function inspect(depth, options) {
|
|
82
|
+
return util.inspect(this.toJSON(), options);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return WebhookListInstance;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/* jshint ignore:start */
|
|
90
|
+
/**
|
|
91
|
+
* Initialize the WebhookPage
|
|
92
|
+
*
|
|
93
|
+
* @constructor Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookPage
|
|
94
|
+
*
|
|
95
|
+
* @param {V1} version - Version of the resource
|
|
96
|
+
* @param {Response<string>} response - Response from the API
|
|
97
|
+
* @param {WebhookSolution} solution - Path solution
|
|
98
|
+
*
|
|
99
|
+
* @returns WebhookPage
|
|
100
|
+
*/
|
|
101
|
+
/* jshint ignore:end */
|
|
102
|
+
WebhookPage = function WebhookPage(version, response, solution) {
|
|
103
|
+
// Path Solution
|
|
104
|
+
this._solution = solution;
|
|
105
|
+
|
|
106
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
_.extend(WebhookPage.prototype, Page.prototype);
|
|
110
|
+
WebhookPage.prototype.constructor = WebhookPage;
|
|
111
|
+
|
|
112
|
+
/* jshint ignore:start */
|
|
113
|
+
/**
|
|
114
|
+
* Build an instance of WebhookInstance
|
|
115
|
+
*
|
|
116
|
+
* @function getInstance
|
|
117
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookPage#
|
|
118
|
+
*
|
|
119
|
+
* @param {WebhookPayload} payload - Payload response from the API
|
|
120
|
+
*
|
|
121
|
+
* @returns WebhookInstance
|
|
122
|
+
*/
|
|
123
|
+
/* jshint ignore:end */
|
|
124
|
+
WebhookPage.prototype.getInstance = function getInstance(payload) {
|
|
125
|
+
return new WebhookInstance(this._version, payload, this._solution.chatServiceSid);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/* jshint ignore:start */
|
|
129
|
+
/**
|
|
130
|
+
* Provide a user-friendly representation
|
|
131
|
+
*
|
|
132
|
+
* @function toJSON
|
|
133
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookPage#
|
|
134
|
+
*
|
|
135
|
+
* @returns Object
|
|
136
|
+
*/
|
|
137
|
+
/* jshint ignore:end */
|
|
138
|
+
WebhookPage.prototype.toJSON = function toJSON() {
|
|
139
|
+
let clone = {};
|
|
140
|
+
_.forOwn(this, function(value, key) {
|
|
141
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
142
|
+
clone[key] = value;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return clone;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
WebhookPage.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
149
|
+
return util.inspect(this.toJSON(), options);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
/* jshint ignore:start */
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the WebhookContext
|
|
156
|
+
*
|
|
157
|
+
* @constructor Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookInstance
|
|
158
|
+
*
|
|
159
|
+
* @property {string} accountSid -
|
|
160
|
+
* The unique ID of the Account responsible for this service.
|
|
161
|
+
* @property {string} chatServiceSid - The chat_service_sid
|
|
162
|
+
* @property {string} preWebhookUrl -
|
|
163
|
+
* The absolute url the pre-event webhook request should be sent to.
|
|
164
|
+
* @property {string} postWebhookUrl -
|
|
165
|
+
* The absolute url the post-event webhook request should be sent to.
|
|
166
|
+
* @property {string} filters -
|
|
167
|
+
* The list of webhook event triggers that are enabled for this Service.
|
|
168
|
+
* @property {webhook.method} method -
|
|
169
|
+
* The HTTP method to be used when sending a webhook request
|
|
170
|
+
* @property {string} url - An absolute URL for this webhook.
|
|
171
|
+
*
|
|
172
|
+
* @param {V1} version - Version of the resource
|
|
173
|
+
* @param {WebhookPayload} payload - The instance payload
|
|
174
|
+
* @param {sid} chatServiceSid - The unique string that identifies the resource
|
|
175
|
+
*/
|
|
176
|
+
/* jshint ignore:end */
|
|
177
|
+
WebhookInstance = function WebhookInstance(version, payload, chatServiceSid) {
|
|
178
|
+
this._version = version;
|
|
179
|
+
|
|
180
|
+
// Marshaled Properties
|
|
181
|
+
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
182
|
+
this.chatServiceSid = payload.chat_service_sid; // jshint ignore:line
|
|
183
|
+
this.preWebhookUrl = payload.pre_webhook_url; // jshint ignore:line
|
|
184
|
+
this.postWebhookUrl = payload.post_webhook_url; // jshint ignore:line
|
|
185
|
+
this.filters = payload.filters; // jshint ignore:line
|
|
186
|
+
this.method = payload.method; // jshint ignore:line
|
|
187
|
+
this.url = payload.url; // jshint ignore:line
|
|
188
|
+
|
|
189
|
+
// Context
|
|
190
|
+
this._context = undefined;
|
|
191
|
+
this._solution = {chatServiceSid: chatServiceSid, };
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
Object.defineProperty(WebhookInstance.prototype,
|
|
195
|
+
'_proxy', {
|
|
196
|
+
get: function() {
|
|
197
|
+
if (!this._context) {
|
|
198
|
+
this._context = new WebhookContext(this._version, this._solution.chatServiceSid);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return this._context;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/* jshint ignore:start */
|
|
206
|
+
/**
|
|
207
|
+
* update a WebhookInstance
|
|
208
|
+
*
|
|
209
|
+
* @function update
|
|
210
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookInstance#
|
|
211
|
+
*
|
|
212
|
+
* @param {object} [opts] - Options for request
|
|
213
|
+
* @param {string} [opts.preWebhookUrl] -
|
|
214
|
+
* The absolute url the pre-event webhook request should be sent to.
|
|
215
|
+
* @param {string} [opts.postWebhookUrl] -
|
|
216
|
+
* The absolute url the post-event webhook request should be sent to.
|
|
217
|
+
* @param {string|list} [opts.filters] -
|
|
218
|
+
* The list of webhook event triggers that are enabled for this Service.
|
|
219
|
+
* @param {string} [opts.method] -
|
|
220
|
+
* The HTTP method to be used when sending a webhook request
|
|
221
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
222
|
+
*
|
|
223
|
+
* @returns {Promise} Resolves to processed WebhookInstance
|
|
224
|
+
*/
|
|
225
|
+
/* jshint ignore:end */
|
|
226
|
+
WebhookInstance.prototype.update = function update(opts, callback) {
|
|
227
|
+
return this._proxy.update(opts, callback);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/* jshint ignore:start */
|
|
231
|
+
/**
|
|
232
|
+
* fetch a WebhookInstance
|
|
233
|
+
*
|
|
234
|
+
* @function fetch
|
|
235
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookInstance#
|
|
236
|
+
*
|
|
237
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
238
|
+
*
|
|
239
|
+
* @returns {Promise} Resolves to processed WebhookInstance
|
|
240
|
+
*/
|
|
241
|
+
/* jshint ignore:end */
|
|
242
|
+
WebhookInstance.prototype.fetch = function fetch(callback) {
|
|
243
|
+
return this._proxy.fetch(callback);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/* jshint ignore:start */
|
|
247
|
+
/**
|
|
248
|
+
* Provide a user-friendly representation
|
|
249
|
+
*
|
|
250
|
+
* @function toJSON
|
|
251
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookInstance#
|
|
252
|
+
*
|
|
253
|
+
* @returns Object
|
|
254
|
+
*/
|
|
255
|
+
/* jshint ignore:end */
|
|
256
|
+
WebhookInstance.prototype.toJSON = function toJSON() {
|
|
257
|
+
let clone = {};
|
|
258
|
+
_.forOwn(this, function(value, key) {
|
|
259
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
260
|
+
clone[key] = value;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return clone;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
WebhookInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
267
|
+
options) {
|
|
268
|
+
return util.inspect(this.toJSON(), options);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
/* jshint ignore:start */
|
|
273
|
+
/**
|
|
274
|
+
* Initialize the WebhookContext
|
|
275
|
+
*
|
|
276
|
+
* @constructor Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookContext
|
|
277
|
+
*
|
|
278
|
+
* @param {V1} version - Version of the resource
|
|
279
|
+
* @param {sid} chatServiceSid -
|
|
280
|
+
* The unique ID of the Conversation Service this conversation belongs to.
|
|
281
|
+
*/
|
|
282
|
+
/* jshint ignore:end */
|
|
283
|
+
WebhookContext = function WebhookContext(version, chatServiceSid) {
|
|
284
|
+
this._version = version;
|
|
285
|
+
|
|
286
|
+
// Path Solution
|
|
287
|
+
this._solution = {chatServiceSid: chatServiceSid, };
|
|
288
|
+
this._uri = `/Services/${chatServiceSid}/Configuration/Webhooks`;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/* jshint ignore:start */
|
|
292
|
+
/**
|
|
293
|
+
* update a WebhookInstance
|
|
294
|
+
*
|
|
295
|
+
* @function update
|
|
296
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookContext#
|
|
297
|
+
*
|
|
298
|
+
* @param {object} [opts] - Options for request
|
|
299
|
+
* @param {string} [opts.preWebhookUrl] -
|
|
300
|
+
* The absolute url the pre-event webhook request should be sent to.
|
|
301
|
+
* @param {string} [opts.postWebhookUrl] -
|
|
302
|
+
* The absolute url the post-event webhook request should be sent to.
|
|
303
|
+
* @param {string|list} [opts.filters] -
|
|
304
|
+
* The list of webhook event triggers that are enabled for this Service.
|
|
305
|
+
* @param {string} [opts.method] -
|
|
306
|
+
* The HTTP method to be used when sending a webhook request
|
|
307
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
308
|
+
*
|
|
309
|
+
* @returns {Promise} Resolves to processed WebhookInstance
|
|
310
|
+
*/
|
|
311
|
+
/* jshint ignore:end */
|
|
312
|
+
WebhookContext.prototype.update = function update(opts, callback) {
|
|
313
|
+
if (_.isFunction(opts)) {
|
|
314
|
+
callback = opts;
|
|
315
|
+
opts = {};
|
|
316
|
+
}
|
|
317
|
+
opts = opts || {};
|
|
318
|
+
|
|
319
|
+
var deferred = Q.defer();
|
|
320
|
+
var data = values.of({
|
|
321
|
+
'PreWebhookUrl': _.get(opts, 'preWebhookUrl'),
|
|
322
|
+
'PostWebhookUrl': _.get(opts, 'postWebhookUrl'),
|
|
323
|
+
'Filters': serialize.map(_.get(opts, 'filters'), function(e) { return e; }),
|
|
324
|
+
'Method': _.get(opts, 'method')
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
var promise = this._version.update({uri: this._uri, method: 'POST', data: data});
|
|
328
|
+
|
|
329
|
+
promise = promise.then(function(payload) {
|
|
330
|
+
deferred.resolve(new WebhookInstance(this._version, payload, this._solution.chatServiceSid));
|
|
331
|
+
}.bind(this));
|
|
332
|
+
|
|
333
|
+
promise.catch(function(error) {
|
|
334
|
+
deferred.reject(error);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
if (_.isFunction(callback)) {
|
|
338
|
+
deferred.promise.nodeify(callback);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return deferred.promise;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/* jshint ignore:start */
|
|
345
|
+
/**
|
|
346
|
+
* fetch a WebhookInstance
|
|
347
|
+
*
|
|
348
|
+
* @function fetch
|
|
349
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookContext#
|
|
350
|
+
*
|
|
351
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
352
|
+
*
|
|
353
|
+
* @returns {Promise} Resolves to processed WebhookInstance
|
|
354
|
+
*/
|
|
355
|
+
/* jshint ignore:end */
|
|
356
|
+
WebhookContext.prototype.fetch = function fetch(callback) {
|
|
357
|
+
var deferred = Q.defer();
|
|
358
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
359
|
+
|
|
360
|
+
promise = promise.then(function(payload) {
|
|
361
|
+
deferred.resolve(new WebhookInstance(this._version, payload, this._solution.chatServiceSid));
|
|
362
|
+
}.bind(this));
|
|
363
|
+
|
|
364
|
+
promise.catch(function(error) {
|
|
365
|
+
deferred.reject(error);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
if (_.isFunction(callback)) {
|
|
369
|
+
deferred.promise.nodeify(callback);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return deferred.promise;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
/* jshint ignore:start */
|
|
376
|
+
/**
|
|
377
|
+
* Provide a user-friendly representation
|
|
378
|
+
*
|
|
379
|
+
* @function toJSON
|
|
380
|
+
* @memberof Twilio.Conversations.V1.ServiceContext.ConfigurationContext.WebhookContext#
|
|
381
|
+
*
|
|
382
|
+
* @returns Object
|
|
383
|
+
*/
|
|
384
|
+
/* jshint ignore:end */
|
|
385
|
+
WebhookContext.prototype.toJSON = function toJSON() {
|
|
386
|
+
return this._solution;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
WebhookContext.prototype[util.inspect.custom] = function inspect(depth, options)
|
|
390
|
+
{
|
|
391
|
+
return util.inspect(this.toJSON(), options);
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
module.exports = {
|
|
395
|
+
WebhookList: WebhookList,
|
|
396
|
+
WebhookPage: WebhookPage,
|
|
397
|
+
WebhookInstance: WebhookInstance,
|
|
398
|
+
WebhookContext: WebhookContext
|
|
399
|
+
};
|
|
@@ -10,6 +10,7 @@ import Response = require('../../../../http/response');
|
|
|
10
10
|
import V1 = require('../../V1');
|
|
11
11
|
import { NotificationListInstance } from './configuration/notification';
|
|
12
12
|
import { SerializableClass } from '../../../../interfaces';
|
|
13
|
+
import { WebhookListInstance } from './configuration/webhook';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Initialize the ConfigurationList
|
|
@@ -48,6 +49,7 @@ interface ConfigurationListInstance {
|
|
|
48
49
|
* Provide a user-friendly representation
|
|
49
50
|
*/
|
|
50
51
|
toJSON(): any;
|
|
52
|
+
webhooks?: WebhookListInstance;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
interface ConfigurationPayload extends ConfigurationResource, Page.TwilioResponsePayload {
|
|
@@ -14,6 +14,7 @@ var _ = require('lodash'); /* jshint ignore:line */
|
|
|
14
14
|
var util = require('util'); /* jshint ignore:line */
|
|
15
15
|
var NotificationList = require('./configuration/notification').NotificationList;
|
|
16
16
|
var Page = require('../../../../base/Page'); /* jshint ignore:line */
|
|
17
|
+
var WebhookList = require('./configuration/webhook').WebhookList;
|
|
17
18
|
var serialize = require('../../../../base/serialize'); /* jshint ignore:line */
|
|
18
19
|
var values = require('../../../../base/values'); /* jshint ignore:line */
|
|
19
20
|
|
|
@@ -53,6 +54,7 @@ ConfigurationList = function ConfigurationList(version, chatServiceSid) {
|
|
|
53
54
|
|
|
54
55
|
// Components
|
|
55
56
|
ConfigurationListInstance._notifications = undefined;
|
|
57
|
+
ConfigurationListInstance._webhooks = undefined;
|
|
56
58
|
|
|
57
59
|
/* jshint ignore:start */
|
|
58
60
|
/**
|
|
@@ -79,6 +81,17 @@ ConfigurationList = function ConfigurationList(version, chatServiceSid) {
|
|
|
79
81
|
}
|
|
80
82
|
});
|
|
81
83
|
|
|
84
|
+
Object.defineProperty(ConfigurationListInstance,
|
|
85
|
+
'webhooks', {
|
|
86
|
+
get: function webhooks() {
|
|
87
|
+
if (!this._webhooks) {
|
|
88
|
+
this._webhooks = new WebhookList(this._version, this._solution.chatServiceSid);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return this._webhooks;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
82
95
|
/* jshint ignore:start */
|
|
83
96
|
/**
|
|
84
97
|
* Provide a user-friendly representation
|
|
@@ -59,8 +59,10 @@ interface ConfigurationResource {
|
|
|
59
59
|
crm_type: string;
|
|
60
60
|
date_created: Date;
|
|
61
61
|
date_updated: Date;
|
|
62
|
+
flex_insights_drilldown: boolean;
|
|
62
63
|
flex_insights_hr: object;
|
|
63
64
|
flex_service_instance_sid: string;
|
|
65
|
+
flex_url: string;
|
|
64
66
|
integrations: object[];
|
|
65
67
|
markdown: object;
|
|
66
68
|
messaging_service_instance_sid: string;
|
|
@@ -174,8 +176,10 @@ declare class ConfigurationInstance extends SerializableClass {
|
|
|
174
176
|
* @param callback - Callback to handle processed record
|
|
175
177
|
*/
|
|
176
178
|
fetch(opts?: ConfigurationInstanceFetchOptions, callback?: (error: Error | null, items: ConfigurationInstance) => any): Promise<ConfigurationInstance>;
|
|
179
|
+
flexInsightsDrilldown: boolean;
|
|
177
180
|
flexInsightsHr: any;
|
|
178
181
|
flexServiceInstanceSid: string;
|
|
182
|
+
flexUrl: string;
|
|
179
183
|
integrations: object[];
|
|
180
184
|
markdown: any;
|
|
181
185
|
messagingServiceInstanceSid: string;
|
|
@@ -211,6 +211,9 @@ ConfigurationPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
|
211
211
|
* @property {object} markdown - Configurable parameters for Markdown
|
|
212
212
|
* @property {string} url - The absolute URL of the Configuration resource
|
|
213
213
|
* @property {object} flexInsightsHr - Object that controls workspace reporting
|
|
214
|
+
* @property {boolean} flexInsightsDrilldown -
|
|
215
|
+
* Setting to enable Flex UI redirection
|
|
216
|
+
* @property {string} flexUrl - URL to redirect to in case drilldown is enabled.
|
|
214
217
|
*
|
|
215
218
|
* @param {V1} version - Version of the resource
|
|
216
219
|
* @param {ConfigurationPayload} payload - The instance payload
|
|
@@ -260,6 +263,8 @@ ConfigurationInstance = function ConfigurationInstance(version, payload) {
|
|
|
260
263
|
this.markdown = payload.markdown; // jshint ignore:line
|
|
261
264
|
this.url = payload.url; // jshint ignore:line
|
|
262
265
|
this.flexInsightsHr = payload.flex_insights_hr; // jshint ignore:line
|
|
266
|
+
this.flexInsightsDrilldown = payload.flex_insights_drilldown; // jshint ignore:line
|
|
267
|
+
this.flexUrl = payload.flex_url; // jshint ignore:line
|
|
263
268
|
|
|
264
269
|
// Context
|
|
265
270
|
this._context = undefined;
|
|
@@ -27,11 +27,13 @@ declare function UserList(version: V1): UserListInstance;
|
|
|
27
27
|
*
|
|
28
28
|
* @property avatar - The avatar URL which will be shown in Frontline application
|
|
29
29
|
* @property friendlyName - The string that you assigned to describe the User
|
|
30
|
+
* @property isAvailable - Whether the User is available for new conversations
|
|
30
31
|
* @property state - Current state of this user
|
|
31
32
|
*/
|
|
32
33
|
interface UserInstanceUpdateOptions {
|
|
33
34
|
avatar?: string;
|
|
34
35
|
friendlyName?: string;
|
|
36
|
+
isAvailable?: boolean;
|
|
35
37
|
state?: UserStateType;
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -59,6 +61,7 @@ interface UserResource {
|
|
|
59
61
|
avatar: string;
|
|
60
62
|
friendly_name: string;
|
|
61
63
|
identity: string;
|
|
64
|
+
is_available: boolean;
|
|
62
65
|
sid: string;
|
|
63
66
|
state: UserStateType;
|
|
64
67
|
url: string;
|
|
@@ -129,6 +132,7 @@ declare class UserInstance extends SerializableClass {
|
|
|
129
132
|
fetch(callback?: (error: Error | null, items: UserInstance) => any): Promise<UserInstance>;
|
|
130
133
|
friendlyName: string;
|
|
131
134
|
identity: string;
|
|
135
|
+
isAvailable: boolean;
|
|
132
136
|
sid: string;
|
|
133
137
|
state: UserStateType;
|
|
134
138
|
/**
|