twilio 3.71.2 → 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 +25 -0
- package/lib/rest/Supersim.d.ts +2 -0
- package/lib/rest/Supersim.js +8 -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/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/video/v1/room.d.ts +4 -0
- package/lib/rest/video/v1/room.js +7 -1
- package/package.json +1 -1
package/CHANGES.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
twilio-node changelog
|
|
2
2
|
=====================
|
|
3
3
|
|
|
4
|
+
[2021-12-01] Version 3.71.3
|
|
5
|
+
---------------------------
|
|
6
|
+
**Conversations**
|
|
7
|
+
- Add `Service Webhook Configuration` resource
|
|
8
|
+
|
|
9
|
+
**Flex**
|
|
10
|
+
- Adding `flex_insights_drilldown` and `flex_url` objects to Flex Configuration
|
|
11
|
+
|
|
12
|
+
**Messaging**
|
|
13
|
+
- Update us_app_to_person endpoints to remove beta feature flag based access
|
|
14
|
+
|
|
15
|
+
**Supersim**
|
|
16
|
+
- Add IP Commands resource
|
|
17
|
+
|
|
18
|
+
**Verify**
|
|
19
|
+
- Add optional `factor_friendly_name` parameter to the create access token endpoint.
|
|
20
|
+
|
|
21
|
+
**Video**
|
|
22
|
+
- Add maxParticipantDuration param to Rooms
|
|
23
|
+
|
|
24
|
+
**Twiml**
|
|
25
|
+
- Unrevert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
|
26
|
+
- Revert Add supported SSML children to `<emphasis>`, `<lang>`, `<p>`, `<prosody>`, `<s>`, and `<w>`.
|
|
27
|
+
|
|
28
|
+
|
|
4
29
|
[2021-11-17] Version 3.71.2
|
|
5
30
|
---------------------------
|
|
6
31
|
**Library - Fix**
|
package/lib/rest/Supersim.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import Twilio = require('./Twilio');
|
|
|
10
10
|
import V1 = require('./supersim/V1');
|
|
11
11
|
import { CommandListInstance } from './supersim/v1/command';
|
|
12
12
|
import { FleetListInstance } from './supersim/v1/fleet';
|
|
13
|
+
import { IpCommandListInstance } from './supersim/v1/ipCommand';
|
|
13
14
|
import { NetworkAccessProfileListInstance } from './supersim/v1/networkAccessProfile';
|
|
14
15
|
import { NetworkListInstance } from './supersim/v1/network';
|
|
15
16
|
import { SimListInstance } from './supersim/v1/sim';
|
|
@@ -27,6 +28,7 @@ declare class Supersim extends Domain {
|
|
|
27
28
|
|
|
28
29
|
readonly commands: CommandListInstance;
|
|
29
30
|
readonly fleets: FleetListInstance;
|
|
31
|
+
readonly ipCommands: IpCommandListInstance;
|
|
30
32
|
readonly networkAccessProfiles: NetworkAccessProfileListInstance;
|
|
31
33
|
readonly networks: NetworkListInstance;
|
|
32
34
|
readonly sims: SimListInstance;
|
package/lib/rest/Supersim.js
CHANGED
|
@@ -23,6 +23,7 @@ var V1 = require('./supersim/V1'); /* jshint ignore:line */
|
|
|
23
23
|
* @property {Twilio.Supersim.V1} v1 - v1 version
|
|
24
24
|
* @property {Twilio.Supersim.V1.CommandList} commands - commands resource
|
|
25
25
|
* @property {Twilio.Supersim.V1.FleetList} fleets - fleets resource
|
|
26
|
+
* @property {Twilio.Supersim.V1.IpCommandList} ipCommands - ipCommands resource
|
|
26
27
|
* @property {Twilio.Supersim.V1.NetworkList} networks - networks resource
|
|
27
28
|
* @property {Twilio.Supersim.V1.NetworkAccessProfileList} networkAccessProfiles -
|
|
28
29
|
* networkAccessProfiles resource
|
|
@@ -66,6 +67,13 @@ Object.defineProperty(Supersim.prototype,
|
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
|
|
70
|
+
Object.defineProperty(Supersim.prototype,
|
|
71
|
+
'ipCommands', {
|
|
72
|
+
get: function() {
|
|
73
|
+
return this.v1.ipCommands;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
69
77
|
Object.defineProperty(Supersim.prototype,
|
|
70
78
|
'networks', {
|
|
71
79
|
get: function() {
|
|
@@ -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
|