twilio 3.74.0 → 3.76.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/lib/rest/Chat.d.ts +4 -0
- package/lib/rest/Chat.js +19 -0
- package/lib/rest/FlexApi.d.ts +2 -0
- package/lib/rest/FlexApi.js +8 -0
- package/lib/rest/Insights.d.ts +2 -0
- package/lib/rest/Insights.js +8 -0
- package/lib/rest/Media.d.ts +2 -0
- package/lib/rest/Media.js +9 -0
- package/lib/rest/Supersim.d.ts +0 -2
- package/lib/rest/Supersim.js +0 -8
- package/lib/rest/api/v2010/account/call/payment.d.ts +1 -1
- package/lib/rest/api/v2010/account/call/payment.js +1 -1
- package/lib/rest/api/v2010/account/call/siprec.d.ts +2 -0
- package/lib/rest/api/v2010/account/call/siprec.js +3 -0
- package/lib/rest/api/v2010/account/call/stream.d.ts +4 -8
- package/lib/rest/api/v2010/account/call/stream.js +11 -7
- package/lib/rest/api/v2010/account/recording.d.ts +31 -2
- package/lib/rest/api/v2010/account/recording.js +25 -4
- package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
- package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
- package/lib/rest/chat/V3.d.ts +25 -0
- package/lib/rest/chat/V3.js +46 -0
- package/lib/rest/chat/v2/service/user/userChannel.d.ts +26 -1
- package/lib/rest/chat/v2/service/user/userChannel.js +18 -4
- package/lib/rest/chat/v3/channel.d.ts +177 -0
- package/lib/rest/chat/v3/channel.js +373 -0
- package/lib/rest/conversations/v1/addressConfiguration.d.ts +3 -3
- package/lib/rest/conversations/v1/addressConfiguration.js +4 -4
- package/lib/rest/flexApi/V1.d.ts +3 -0
- package/lib/rest/flexApi/V1.js +11 -0
- package/lib/rest/flexApi/v1/configuration.d.ts +2 -0
- package/lib/rest/flexApi/v1/configuration.js +3 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.d.ts +266 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.js +505 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.d.ts +323 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.js +674 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel.d.ts +327 -0
- package/lib/rest/flexApi/v1/interaction/interactionChannel.js +718 -0
- package/lib/rest/flexApi/v1/interaction.d.ts +152 -0
- package/lib/rest/flexApi/v1/interaction.js +395 -0
- package/lib/rest/insights/V1.d.ts +3 -0
- package/lib/rest/insights/V1.js +11 -0
- package/lib/rest/insights/v1/annotation.d.ts +188 -0
- package/lib/rest/insights/v1/annotation.js +406 -0
- package/lib/rest/media/V1.d.ts +3 -0
- package/lib/rest/media/V1.js +12 -0
- package/lib/rest/media/v1/mediaProcessor.js +1 -1
- package/lib/rest/media/v1/mediaRecording.d.ts +358 -0
- package/lib/rest/{supersim/v1/command.js → media/v1/mediaRecording.js} +190 -176
- package/lib/rest/media/v1/playerStreamer.d.ts +4 -0
- package/lib/rest/media/v1/playerStreamer.js +5 -1
- package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +5 -5
- package/lib/rest/numbers/v2/regulatoryCompliance/bundle.js +3 -3
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +2 -0
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +3 -0
- package/lib/rest/supersim/V1.d.ts +0 -3
- package/lib/rest/supersim/V1.js +0 -11
- package/lib/rest/supersim/v1/fleet.d.ts +0 -16
- package/lib/rest/supersim/v1/fleet.js +0 -18
- package/lib/rest/supersim/v1/usageRecord.d.ts +3 -3
- package/lib/rest/supersim/v1/usageRecord.js +3 -3
- package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.d.ts +1 -1
- package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.js +2 -2
- package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.d.ts +1 -1
- package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.js +2 -2
- package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.d.ts +1 -1
- package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.js +2 -2
- package/lib/rest/verify/v2/service/accessToken.d.ts +6 -0
- package/lib/rest/verify/v2/service/accessToken.js +9 -1
- package/lib/rest/verify/v2/service/entity/challenge.d.ts +4 -0
- package/lib/rest/verify/v2/service/entity/challenge.js +8 -1
- package/lib/rest/verify/v2/service/entity/factor.d.ts +2 -0
- package/lib/rest/verify/v2/service/entity/factor.js +2 -0
- package/lib/rest/verify/v2/service/entity/newFactor.d.ts +4 -0
- package/lib/rest/verify/v2/service/entity/newFactor.js +9 -3
- package/lib/rest/video/v1/composition.d.ts +4 -0
- package/lib/rest/video/v1/composition.js +6 -0
- package/lib/rest/video/v1/recording.d.ts +4 -0
- package/lib/rest/video/v1/recording.js +6 -0
- package/lib/twiml/VoiceResponse.d.ts +2 -2
- package/package.json +3 -3
- package/lib/rest/supersim/v1/command.d.ts +0 -342
|
@@ -0,0 +1,152 @@
|
|
|
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 { InteractionChannelList } from './interaction/interactionChannel';
|
|
12
|
+
import { InteractionChannelListInstance } from './interaction/interactionChannel';
|
|
13
|
+
import { SerializableClass } from '../../../interfaces';
|
|
14
|
+
|
|
15
|
+
type InteractionStatus = 'close'|'closed'|'wrapup';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the InteractionList
|
|
19
|
+
*
|
|
20
|
+
* @param version - Version of the resource
|
|
21
|
+
*/
|
|
22
|
+
declare function InteractionList(version: V1): InteractionListInstance;
|
|
23
|
+
|
|
24
|
+
interface InteractionListInstance {
|
|
25
|
+
/**
|
|
26
|
+
* @param sid - sid of instance
|
|
27
|
+
*/
|
|
28
|
+
(sid: string): InteractionContext;
|
|
29
|
+
/**
|
|
30
|
+
* create a InteractionInstance
|
|
31
|
+
*
|
|
32
|
+
* @param opts - Options for request
|
|
33
|
+
* @param callback - Callback to handle processed record
|
|
34
|
+
*/
|
|
35
|
+
create(opts: InteractionListInstanceCreateOptions, callback?: (error: Error | null, item: InteractionInstance) => any): Promise<InteractionInstance>;
|
|
36
|
+
/**
|
|
37
|
+
* Constructs a interaction
|
|
38
|
+
*
|
|
39
|
+
* @param sid - The SID that identifies the resource to fetch
|
|
40
|
+
*/
|
|
41
|
+
get(sid: string): InteractionContext;
|
|
42
|
+
/**
|
|
43
|
+
* Provide a user-friendly representation
|
|
44
|
+
*/
|
|
45
|
+
toJSON(): any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Options to pass to create
|
|
50
|
+
*
|
|
51
|
+
* @property channel - The Interaction's channel
|
|
52
|
+
* @property routing - The Interaction's routing logic
|
|
53
|
+
*/
|
|
54
|
+
interface InteractionListInstanceCreateOptions {
|
|
55
|
+
channel: object;
|
|
56
|
+
routing: object;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface InteractionPayload extends InteractionResource, Page.TwilioResponsePayload {
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface InteractionResource {
|
|
63
|
+
channel: object;
|
|
64
|
+
links: string;
|
|
65
|
+
routing: object;
|
|
66
|
+
sid: string;
|
|
67
|
+
url: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface InteractionSolution {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
declare class InteractionContext {
|
|
75
|
+
/**
|
|
76
|
+
* Initialize the InteractionContext
|
|
77
|
+
*
|
|
78
|
+
* @param version - Version of the resource
|
|
79
|
+
* @param sid - The SID that identifies the resource to fetch
|
|
80
|
+
*/
|
|
81
|
+
constructor(version: V1, sid: string);
|
|
82
|
+
|
|
83
|
+
channels: InteractionChannelListInstance;
|
|
84
|
+
/**
|
|
85
|
+
* fetch a InteractionInstance
|
|
86
|
+
*
|
|
87
|
+
* @param callback - Callback to handle processed record
|
|
88
|
+
*/
|
|
89
|
+
fetch(callback?: (error: Error | null, items: InteractionInstance) => any): Promise<InteractionInstance>;
|
|
90
|
+
/**
|
|
91
|
+
* Provide a user-friendly representation
|
|
92
|
+
*/
|
|
93
|
+
toJSON(): any;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
declare class InteractionInstance extends SerializableClass {
|
|
98
|
+
/**
|
|
99
|
+
* Initialize the InteractionContext
|
|
100
|
+
*
|
|
101
|
+
* @param version - Version of the resource
|
|
102
|
+
* @param payload - The instance payload
|
|
103
|
+
* @param sid - The SID that identifies the resource to fetch
|
|
104
|
+
*/
|
|
105
|
+
constructor(version: V1, payload: InteractionPayload, sid: string);
|
|
106
|
+
|
|
107
|
+
private _proxy: InteractionContext;
|
|
108
|
+
channel: any;
|
|
109
|
+
/**
|
|
110
|
+
* Access the channels
|
|
111
|
+
*/
|
|
112
|
+
channels(): InteractionChannelListInstance;
|
|
113
|
+
/**
|
|
114
|
+
* fetch a InteractionInstance
|
|
115
|
+
*
|
|
116
|
+
* @param callback - Callback to handle processed record
|
|
117
|
+
*/
|
|
118
|
+
fetch(callback?: (error: Error | null, items: InteractionInstance) => any): Promise<InteractionInstance>;
|
|
119
|
+
links: string;
|
|
120
|
+
routing: any;
|
|
121
|
+
sid: string;
|
|
122
|
+
/**
|
|
123
|
+
* Provide a user-friendly representation
|
|
124
|
+
*/
|
|
125
|
+
toJSON(): any;
|
|
126
|
+
url: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
declare class InteractionPage extends Page<V1, InteractionPayload, InteractionResource, InteractionInstance> {
|
|
131
|
+
/**
|
|
132
|
+
* Initialize the InteractionPage
|
|
133
|
+
*
|
|
134
|
+
* @param version - Version of the resource
|
|
135
|
+
* @param response - Response from the API
|
|
136
|
+
* @param solution - Path solution
|
|
137
|
+
*/
|
|
138
|
+
constructor(version: V1, response: Response<string>, solution: InteractionSolution);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Build an instance of InteractionInstance
|
|
142
|
+
*
|
|
143
|
+
* @param payload - Payload response from the API
|
|
144
|
+
*/
|
|
145
|
+
getInstance(payload: InteractionPayload): InteractionInstance;
|
|
146
|
+
/**
|
|
147
|
+
* Provide a user-friendly representation
|
|
148
|
+
*/
|
|
149
|
+
toJSON(): any;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { InteractionContext, InteractionInstance, InteractionList, InteractionListInstance, InteractionListInstanceCreateOptions, InteractionPage, InteractionPayload, InteractionResource, InteractionSolution, InteractionStatus }
|
|
@@ -0,0 +1,395 @@
|
|
|
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 InteractionChannelList = require(
|
|
16
|
+
'./interaction/interactionChannel').InteractionChannelList;
|
|
17
|
+
var Page = require('../../../base/Page'); /* jshint ignore:line */
|
|
18
|
+
var serialize = require('../../../base/serialize'); /* jshint ignore:line */
|
|
19
|
+
var values = require('../../../base/values'); /* jshint ignore:line */
|
|
20
|
+
|
|
21
|
+
var InteractionList;
|
|
22
|
+
var InteractionPage;
|
|
23
|
+
var InteractionInstance;
|
|
24
|
+
var InteractionContext;
|
|
25
|
+
|
|
26
|
+
/* jshint ignore:start */
|
|
27
|
+
/**
|
|
28
|
+
* Initialize the InteractionList
|
|
29
|
+
*
|
|
30
|
+
* @constructor Twilio.FlexApi.V1.InteractionList
|
|
31
|
+
*
|
|
32
|
+
* @param {Twilio.FlexApi.V1} version - Version of the resource
|
|
33
|
+
*/
|
|
34
|
+
/* jshint ignore:end */
|
|
35
|
+
InteractionList = function InteractionList(version) {
|
|
36
|
+
/* jshint ignore:start */
|
|
37
|
+
/**
|
|
38
|
+
* @function interaction
|
|
39
|
+
* @memberof Twilio.FlexApi.V1#
|
|
40
|
+
*
|
|
41
|
+
* @param {string} sid - sid of instance
|
|
42
|
+
*
|
|
43
|
+
* @returns {Twilio.FlexApi.V1.InteractionContext}
|
|
44
|
+
*/
|
|
45
|
+
/* jshint ignore:end */
|
|
46
|
+
function InteractionListInstance(sid) {
|
|
47
|
+
return InteractionListInstance.get(sid);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
InteractionListInstance._version = version;
|
|
51
|
+
// Path Solution
|
|
52
|
+
InteractionListInstance._solution = {};
|
|
53
|
+
InteractionListInstance._uri = `/Interactions`;
|
|
54
|
+
/* jshint ignore:start */
|
|
55
|
+
/**
|
|
56
|
+
* create a InteractionInstance
|
|
57
|
+
*
|
|
58
|
+
* @function create
|
|
59
|
+
* @memberof Twilio.FlexApi.V1.InteractionList#
|
|
60
|
+
*
|
|
61
|
+
* @param {object} opts - Options for request
|
|
62
|
+
* @param {object} opts.channel - The Interaction's channel
|
|
63
|
+
* @param {object} opts.routing - The Interaction's routing logic
|
|
64
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
65
|
+
*
|
|
66
|
+
* @returns {Promise} Resolves to processed InteractionInstance
|
|
67
|
+
*/
|
|
68
|
+
/* jshint ignore:end */
|
|
69
|
+
InteractionListInstance.create = function create(opts, callback) {
|
|
70
|
+
if (_.isUndefined(opts)) {
|
|
71
|
+
throw new Error('Required parameter "opts" missing.');
|
|
72
|
+
}
|
|
73
|
+
if (_.isUndefined(opts['channel'])) {
|
|
74
|
+
throw new Error('Required parameter "opts[\'channel\']" missing.');
|
|
75
|
+
}
|
|
76
|
+
if (_.isUndefined(opts['routing'])) {
|
|
77
|
+
throw new Error('Required parameter "opts[\'routing\']" missing.');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var deferred = Q.defer();
|
|
81
|
+
var data = values.of({
|
|
82
|
+
'Channel': serialize.object(_.get(opts, 'channel')),
|
|
83
|
+
'Routing': serialize.object(_.get(opts, 'routing'))
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
|
|
87
|
+
|
|
88
|
+
promise = promise.then(function(payload) {
|
|
89
|
+
deferred.resolve(new InteractionInstance(this._version, payload, this._solution.sid));
|
|
90
|
+
}.bind(this));
|
|
91
|
+
|
|
92
|
+
promise.catch(function(error) {
|
|
93
|
+
deferred.reject(error);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (_.isFunction(callback)) {
|
|
97
|
+
deferred.promise.nodeify(callback);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return deferred.promise;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/* jshint ignore:start */
|
|
104
|
+
/**
|
|
105
|
+
* Constructs a interaction
|
|
106
|
+
*
|
|
107
|
+
* @function get
|
|
108
|
+
* @memberof Twilio.FlexApi.V1.InteractionList#
|
|
109
|
+
*
|
|
110
|
+
* @param {string} sid - The SID that identifies the resource to fetch
|
|
111
|
+
*
|
|
112
|
+
* @returns {Twilio.FlexApi.V1.InteractionContext}
|
|
113
|
+
*/
|
|
114
|
+
/* jshint ignore:end */
|
|
115
|
+
InteractionListInstance.get = function get(sid) {
|
|
116
|
+
return new InteractionContext(this._version, sid);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/* jshint ignore:start */
|
|
120
|
+
/**
|
|
121
|
+
* Provide a user-friendly representation
|
|
122
|
+
*
|
|
123
|
+
* @function toJSON
|
|
124
|
+
* @memberof Twilio.FlexApi.V1.InteractionList#
|
|
125
|
+
*
|
|
126
|
+
* @returns Object
|
|
127
|
+
*/
|
|
128
|
+
/* jshint ignore:end */
|
|
129
|
+
InteractionListInstance.toJSON = function toJSON() {
|
|
130
|
+
return this._solution;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
InteractionListInstance[util.inspect.custom] = function inspect(depth, options)
|
|
134
|
+
{
|
|
135
|
+
return util.inspect(this.toJSON(), options);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
return InteractionListInstance;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
/* jshint ignore:start */
|
|
143
|
+
/**
|
|
144
|
+
* Initialize the InteractionPage
|
|
145
|
+
*
|
|
146
|
+
* @constructor Twilio.FlexApi.V1.InteractionPage
|
|
147
|
+
*
|
|
148
|
+
* @param {V1} version - Version of the resource
|
|
149
|
+
* @param {Response<string>} response - Response from the API
|
|
150
|
+
* @param {InteractionSolution} solution - Path solution
|
|
151
|
+
*
|
|
152
|
+
* @returns InteractionPage
|
|
153
|
+
*/
|
|
154
|
+
/* jshint ignore:end */
|
|
155
|
+
InteractionPage = function InteractionPage(version, response, solution) {
|
|
156
|
+
// Path Solution
|
|
157
|
+
this._solution = solution;
|
|
158
|
+
|
|
159
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
_.extend(InteractionPage.prototype, Page.prototype);
|
|
163
|
+
InteractionPage.prototype.constructor = InteractionPage;
|
|
164
|
+
|
|
165
|
+
/* jshint ignore:start */
|
|
166
|
+
/**
|
|
167
|
+
* Build an instance of InteractionInstance
|
|
168
|
+
*
|
|
169
|
+
* @function getInstance
|
|
170
|
+
* @memberof Twilio.FlexApi.V1.InteractionPage#
|
|
171
|
+
*
|
|
172
|
+
* @param {InteractionPayload} payload - Payload response from the API
|
|
173
|
+
*
|
|
174
|
+
* @returns InteractionInstance
|
|
175
|
+
*/
|
|
176
|
+
/* jshint ignore:end */
|
|
177
|
+
InteractionPage.prototype.getInstance = function getInstance(payload) {
|
|
178
|
+
return new InteractionInstance(this._version, payload);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/* jshint ignore:start */
|
|
182
|
+
/**
|
|
183
|
+
* Provide a user-friendly representation
|
|
184
|
+
*
|
|
185
|
+
* @function toJSON
|
|
186
|
+
* @memberof Twilio.FlexApi.V1.InteractionPage#
|
|
187
|
+
*
|
|
188
|
+
* @returns Object
|
|
189
|
+
*/
|
|
190
|
+
/* jshint ignore:end */
|
|
191
|
+
InteractionPage.prototype.toJSON = function toJSON() {
|
|
192
|
+
let clone = {};
|
|
193
|
+
_.forOwn(this, function(value, key) {
|
|
194
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
195
|
+
clone[key] = value;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return clone;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
InteractionPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
202
|
+
options) {
|
|
203
|
+
return util.inspect(this.toJSON(), options);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
/* jshint ignore:start */
|
|
208
|
+
/**
|
|
209
|
+
* Initialize the InteractionContext
|
|
210
|
+
*
|
|
211
|
+
* @constructor Twilio.FlexApi.V1.InteractionInstance
|
|
212
|
+
*
|
|
213
|
+
* @property {string} sid - The unique string that identifies the resource
|
|
214
|
+
* @property {object} channel - The Interaction's channel
|
|
215
|
+
* @property {object} routing - The Interaction's routing logic
|
|
216
|
+
* @property {string} url - The url
|
|
217
|
+
* @property {string} links - The links
|
|
218
|
+
*
|
|
219
|
+
* @param {V1} version - Version of the resource
|
|
220
|
+
* @param {InteractionPayload} payload - The instance payload
|
|
221
|
+
* @param {sid} sid - The SID that identifies the resource to fetch
|
|
222
|
+
*/
|
|
223
|
+
/* jshint ignore:end */
|
|
224
|
+
InteractionInstance = function InteractionInstance(version, payload, sid) {
|
|
225
|
+
this._version = version;
|
|
226
|
+
|
|
227
|
+
// Marshaled Properties
|
|
228
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
229
|
+
this.channel = payload.channel; // jshint ignore:line
|
|
230
|
+
this.routing = payload.routing; // jshint ignore:line
|
|
231
|
+
this.url = payload.url; // jshint ignore:line
|
|
232
|
+
this.links = payload.links; // jshint ignore:line
|
|
233
|
+
|
|
234
|
+
// Context
|
|
235
|
+
this._context = undefined;
|
|
236
|
+
this._solution = {sid: sid || this.sid, };
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
Object.defineProperty(InteractionInstance.prototype,
|
|
240
|
+
'_proxy', {
|
|
241
|
+
get: function() {
|
|
242
|
+
if (!this._context) {
|
|
243
|
+
this._context = new InteractionContext(this._version, this._solution.sid);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return this._context;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
/* jshint ignore:start */
|
|
251
|
+
/**
|
|
252
|
+
* fetch a InteractionInstance
|
|
253
|
+
*
|
|
254
|
+
* @function fetch
|
|
255
|
+
* @memberof Twilio.FlexApi.V1.InteractionInstance#
|
|
256
|
+
*
|
|
257
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
258
|
+
*
|
|
259
|
+
* @returns {Promise} Resolves to processed InteractionInstance
|
|
260
|
+
*/
|
|
261
|
+
/* jshint ignore:end */
|
|
262
|
+
InteractionInstance.prototype.fetch = function fetch(callback) {
|
|
263
|
+
return this._proxy.fetch(callback);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/* jshint ignore:start */
|
|
267
|
+
/**
|
|
268
|
+
* Access the channels
|
|
269
|
+
*
|
|
270
|
+
* @function channels
|
|
271
|
+
* @memberof Twilio.FlexApi.V1.InteractionInstance#
|
|
272
|
+
*
|
|
273
|
+
* @returns {Twilio.FlexApi.V1.InteractionContext.InteractionChannelList}
|
|
274
|
+
*/
|
|
275
|
+
/* jshint ignore:end */
|
|
276
|
+
InteractionInstance.prototype.channels = function channels() {
|
|
277
|
+
return this._proxy.channels;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
/* jshint ignore:start */
|
|
281
|
+
/**
|
|
282
|
+
* Provide a user-friendly representation
|
|
283
|
+
*
|
|
284
|
+
* @function toJSON
|
|
285
|
+
* @memberof Twilio.FlexApi.V1.InteractionInstance#
|
|
286
|
+
*
|
|
287
|
+
* @returns Object
|
|
288
|
+
*/
|
|
289
|
+
/* jshint ignore:end */
|
|
290
|
+
InteractionInstance.prototype.toJSON = function toJSON() {
|
|
291
|
+
let clone = {};
|
|
292
|
+
_.forOwn(this, function(value, key) {
|
|
293
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
294
|
+
clone[key] = value;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
return clone;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
InteractionInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
301
|
+
options) {
|
|
302
|
+
return util.inspect(this.toJSON(), options);
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
/* jshint ignore:start */
|
|
307
|
+
/**
|
|
308
|
+
* Initialize the InteractionContext
|
|
309
|
+
*
|
|
310
|
+
* @constructor Twilio.FlexApi.V1.InteractionContext
|
|
311
|
+
*
|
|
312
|
+
* @property {Twilio.FlexApi.V1.InteractionContext.InteractionChannelList} channels -
|
|
313
|
+
* channels resource
|
|
314
|
+
*
|
|
315
|
+
* @param {V1} version - Version of the resource
|
|
316
|
+
* @param {sid} sid - The SID that identifies the resource to fetch
|
|
317
|
+
*/
|
|
318
|
+
/* jshint ignore:end */
|
|
319
|
+
InteractionContext = function InteractionContext(version, sid) {
|
|
320
|
+
this._version = version;
|
|
321
|
+
|
|
322
|
+
// Path Solution
|
|
323
|
+
this._solution = {sid: sid, };
|
|
324
|
+
this._uri = `/Interactions/${sid}`;
|
|
325
|
+
|
|
326
|
+
// Dependents
|
|
327
|
+
this._channels = undefined;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/* jshint ignore:start */
|
|
331
|
+
/**
|
|
332
|
+
* fetch a InteractionInstance
|
|
333
|
+
*
|
|
334
|
+
* @function fetch
|
|
335
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext#
|
|
336
|
+
*
|
|
337
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
338
|
+
*
|
|
339
|
+
* @returns {Promise} Resolves to processed InteractionInstance
|
|
340
|
+
*/
|
|
341
|
+
/* jshint ignore:end */
|
|
342
|
+
InteractionContext.prototype.fetch = function fetch(callback) {
|
|
343
|
+
var deferred = Q.defer();
|
|
344
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
345
|
+
|
|
346
|
+
promise = promise.then(function(payload) {
|
|
347
|
+
deferred.resolve(new InteractionInstance(this._version, payload, this._solution.sid));
|
|
348
|
+
}.bind(this));
|
|
349
|
+
|
|
350
|
+
promise.catch(function(error) {
|
|
351
|
+
deferred.reject(error);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
if (_.isFunction(callback)) {
|
|
355
|
+
deferred.promise.nodeify(callback);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return deferred.promise;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
Object.defineProperty(InteractionContext.prototype,
|
|
362
|
+
'channels', {
|
|
363
|
+
get: function() {
|
|
364
|
+
if (!this._channels) {
|
|
365
|
+
this._channels = new InteractionChannelList(this._version, this._solution.sid);
|
|
366
|
+
}
|
|
367
|
+
return this._channels;
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
/* jshint ignore:start */
|
|
372
|
+
/**
|
|
373
|
+
* Provide a user-friendly representation
|
|
374
|
+
*
|
|
375
|
+
* @function toJSON
|
|
376
|
+
* @memberof Twilio.FlexApi.V1.InteractionContext#
|
|
377
|
+
*
|
|
378
|
+
* @returns Object
|
|
379
|
+
*/
|
|
380
|
+
/* jshint ignore:end */
|
|
381
|
+
InteractionContext.prototype.toJSON = function toJSON() {
|
|
382
|
+
return this._solution;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
InteractionContext.prototype[util.inspect.custom] = function inspect(depth,
|
|
386
|
+
options) {
|
|
387
|
+
return util.inspect(this.toJSON(), options);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
module.exports = {
|
|
391
|
+
InteractionList: InteractionList,
|
|
392
|
+
InteractionPage: InteractionPage,
|
|
393
|
+
InteractionInstance: InteractionInstance,
|
|
394
|
+
InteractionContext: InteractionContext
|
|
395
|
+
};
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import Insights = require('../Insights');
|
|
9
9
|
import Version = require('../../base/Version');
|
|
10
|
+
import { AnnotationList } from './v1/annotation';
|
|
11
|
+
import { AnnotationListInstance } from './v1/annotation';
|
|
10
12
|
import { CallList } from './v1/call';
|
|
11
13
|
import { CallListInstance } from './v1/call';
|
|
12
14
|
import { CallSummariesList } from './v1/callSummaries';
|
|
@@ -27,6 +29,7 @@ declare class V1 extends Version {
|
|
|
27
29
|
*/
|
|
28
30
|
constructor(domain: Insights);
|
|
29
31
|
|
|
32
|
+
readonly annotation: AnnotationListInstance;
|
|
30
33
|
readonly callSummaries: CallSummariesListInstance;
|
|
31
34
|
readonly calls: CallListInstance;
|
|
32
35
|
readonly conferences: ConferenceListInstance;
|
package/lib/rest/insights/V1.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
/* jshint ignore:end */
|
|
11
11
|
|
|
12
12
|
var _ = require('lodash'); /* jshint ignore:line */
|
|
13
|
+
var AnnotationList = require('./v1/annotation').AnnotationList;
|
|
13
14
|
var CallList = require('./v1/call').CallList;
|
|
14
15
|
var CallSummariesList = require('./v1/callSummaries').CallSummariesList;
|
|
15
16
|
var ConferenceList = require('./v1/conference').ConferenceList;
|
|
@@ -25,6 +26,7 @@ var Version = require('../../base/Version'); /* jshint ignore:line */
|
|
|
25
26
|
* @constructor Twilio.Insights.V1
|
|
26
27
|
*
|
|
27
28
|
* @property {Twilio.Insights.V1.SettingList} settings - settings resource
|
|
29
|
+
* @property {Twilio.Insights.V1.AnnotationList} annotation - annotation resource
|
|
28
30
|
* @property {Twilio.Insights.V1.CallList} calls - calls resource
|
|
29
31
|
* @property {Twilio.Insights.V1.CallSummariesList} callSummaries -
|
|
30
32
|
* callSummaries resource
|
|
@@ -39,6 +41,7 @@ function V1(domain) {
|
|
|
39
41
|
|
|
40
42
|
// Resources
|
|
41
43
|
this._settings = undefined;
|
|
44
|
+
this._annotation = undefined;
|
|
42
45
|
this._calls = undefined;
|
|
43
46
|
this._callSummaries = undefined;
|
|
44
47
|
this._conferences = undefined;
|
|
@@ -56,6 +59,14 @@ Object.defineProperty(V1.prototype,
|
|
|
56
59
|
}
|
|
57
60
|
});
|
|
58
61
|
|
|
62
|
+
Object.defineProperty(V1.prototype,
|
|
63
|
+
'annotation', {
|
|
64
|
+
get: function() {
|
|
65
|
+
this._annotation = this._annotation || new AnnotationList(this);
|
|
66
|
+
return this._annotation;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
59
70
|
Object.defineProperty(V1.prototype,
|
|
60
71
|
'calls', {
|
|
61
72
|
get: function() {
|