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.
Files changed (90) hide show
  1. package/lib/rest/Chat.d.ts +4 -0
  2. package/lib/rest/Chat.js +19 -0
  3. package/lib/rest/FlexApi.d.ts +2 -0
  4. package/lib/rest/FlexApi.js +8 -0
  5. package/lib/rest/Insights.d.ts +2 -0
  6. package/lib/rest/Insights.js +8 -0
  7. package/lib/rest/Media.d.ts +2 -0
  8. package/lib/rest/Media.js +9 -0
  9. package/lib/rest/Supersim.d.ts +0 -2
  10. package/lib/rest/Supersim.js +0 -8
  11. package/lib/rest/api/v2010/account/call/payment.d.ts +1 -1
  12. package/lib/rest/api/v2010/account/call/payment.js +1 -1
  13. package/lib/rest/api/v2010/account/call/siprec.d.ts +2 -0
  14. package/lib/rest/api/v2010/account/call/siprec.js +3 -0
  15. package/lib/rest/api/v2010/account/call/stream.d.ts +4 -8
  16. package/lib/rest/api/v2010/account/call/stream.js +11 -7
  17. package/lib/rest/api/v2010/account/recording.d.ts +31 -2
  18. package/lib/rest/api/v2010/account/recording.js +25 -4
  19. package/lib/rest/api/v2010/account/usage/record/allTime.d.ts +1 -1
  20. package/lib/rest/api/v2010/account/usage/record/daily.d.ts +1 -1
  21. package/lib/rest/api/v2010/account/usage/record/lastMonth.d.ts +1 -1
  22. package/lib/rest/api/v2010/account/usage/record/monthly.d.ts +1 -1
  23. package/lib/rest/api/v2010/account/usage/record/thisMonth.d.ts +1 -1
  24. package/lib/rest/api/v2010/account/usage/record/today.d.ts +1 -1
  25. package/lib/rest/api/v2010/account/usage/record/yearly.d.ts +1 -1
  26. package/lib/rest/api/v2010/account/usage/record/yesterday.d.ts +1 -1
  27. package/lib/rest/api/v2010/account/usage/record.d.ts +1 -1
  28. package/lib/rest/api/v2010/account/usage/trigger.d.ts +1 -1
  29. package/lib/rest/chat/V3.d.ts +25 -0
  30. package/lib/rest/chat/V3.js +46 -0
  31. package/lib/rest/chat/v2/service/user/userChannel.d.ts +26 -1
  32. package/lib/rest/chat/v2/service/user/userChannel.js +18 -4
  33. package/lib/rest/chat/v3/channel.d.ts +177 -0
  34. package/lib/rest/chat/v3/channel.js +373 -0
  35. package/lib/rest/conversations/v1/addressConfiguration.d.ts +3 -3
  36. package/lib/rest/conversations/v1/addressConfiguration.js +4 -4
  37. package/lib/rest/flexApi/V1.d.ts +3 -0
  38. package/lib/rest/flexApi/V1.js +11 -0
  39. package/lib/rest/flexApi/v1/configuration.d.ts +2 -0
  40. package/lib/rest/flexApi/v1/configuration.js +3 -0
  41. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.d.ts +266 -0
  42. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.js +505 -0
  43. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.d.ts +323 -0
  44. package/lib/rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.js +674 -0
  45. package/lib/rest/flexApi/v1/interaction/interactionChannel.d.ts +327 -0
  46. package/lib/rest/flexApi/v1/interaction/interactionChannel.js +718 -0
  47. package/lib/rest/flexApi/v1/interaction.d.ts +152 -0
  48. package/lib/rest/flexApi/v1/interaction.js +395 -0
  49. package/lib/rest/insights/V1.d.ts +3 -0
  50. package/lib/rest/insights/V1.js +11 -0
  51. package/lib/rest/insights/v1/annotation.d.ts +188 -0
  52. package/lib/rest/insights/v1/annotation.js +406 -0
  53. package/lib/rest/media/V1.d.ts +3 -0
  54. package/lib/rest/media/V1.js +12 -0
  55. package/lib/rest/media/v1/mediaProcessor.js +1 -1
  56. package/lib/rest/media/v1/mediaRecording.d.ts +358 -0
  57. package/lib/rest/{supersim/v1/command.js → media/v1/mediaRecording.js} +190 -176
  58. package/lib/rest/media/v1/playerStreamer.d.ts +4 -0
  59. package/lib/rest/media/v1/playerStreamer.js +5 -1
  60. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +5 -5
  61. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.js +3 -3
  62. package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +2 -0
  63. package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +3 -0
  64. package/lib/rest/supersim/V1.d.ts +0 -3
  65. package/lib/rest/supersim/V1.js +0 -11
  66. package/lib/rest/supersim/v1/fleet.d.ts +0 -16
  67. package/lib/rest/supersim/v1/fleet.js +0 -18
  68. package/lib/rest/supersim/v1/usageRecord.d.ts +3 -3
  69. package/lib/rest/supersim/v1/usageRecord.js +3 -3
  70. package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.d.ts +1 -1
  71. package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.js +2 -2
  72. package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.d.ts +1 -1
  73. package/lib/rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.js +2 -2
  74. package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.d.ts +1 -1
  75. package/lib/rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.js +2 -2
  76. package/lib/rest/verify/v2/service/accessToken.d.ts +6 -0
  77. package/lib/rest/verify/v2/service/accessToken.js +9 -1
  78. package/lib/rest/verify/v2/service/entity/challenge.d.ts +4 -0
  79. package/lib/rest/verify/v2/service/entity/challenge.js +8 -1
  80. package/lib/rest/verify/v2/service/entity/factor.d.ts +2 -0
  81. package/lib/rest/verify/v2/service/entity/factor.js +2 -0
  82. package/lib/rest/verify/v2/service/entity/newFactor.d.ts +4 -0
  83. package/lib/rest/verify/v2/service/entity/newFactor.js +9 -3
  84. package/lib/rest/video/v1/composition.d.ts +4 -0
  85. package/lib/rest/video/v1/composition.js +6 -0
  86. package/lib/rest/video/v1/recording.d.ts +4 -0
  87. package/lib/rest/video/v1/recording.js +6 -0
  88. package/lib/twiml/VoiceResponse.d.ts +2 -2
  89. package/package.json +3 -3
  90. package/lib/rest/supersim/v1/command.d.ts +0 -342
@@ -0,0 +1,188 @@
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 AnnotationAnsweredBy = 'unknown_answered_by'|'human'|'machine';
14
+
15
+ type AnnotationConnectivityIssue = 'unknown_connectivity_issue'|'no_connectivity_issue'|'invalid_number'|'caller_id'|'dropped_call'|'number_reachability';
16
+
17
+ type AnnotationQualityIssues = 'unknown_quality_issue'|'no_quality_issue'|'low_volume'|'choppy_robotic'|'echo'|'dtmf'|'latency'|'owa'|'static_noise';
18
+
19
+ /**
20
+ * Initialize the AnnotationList
21
+ *
22
+ * @param version - Version of the resource
23
+ */
24
+ declare function AnnotationList(version: V1): AnnotationListInstance;
25
+
26
+ /**
27
+ * Options to pass to update
28
+ *
29
+ * @property answeredBy - The answered_by
30
+ * @property callScore - The call_score
31
+ * @property comment - The comment
32
+ * @property connectivityIssue - The connectivity_issue
33
+ * @property incident - The incident
34
+ * @property qualityIssues - The quality_issues
35
+ * @property spam - The spam
36
+ */
37
+ interface AnnotationInstanceUpdateOptions {
38
+ answeredBy?: AnnotationAnsweredBy;
39
+ callScore?: number;
40
+ comment?: string;
41
+ connectivityIssue?: AnnotationConnectivityIssue;
42
+ incident?: string;
43
+ qualityIssues?: string;
44
+ spam?: boolean;
45
+ }
46
+
47
+ interface AnnotationListInstance {
48
+ /**
49
+ * @param sid - sid of instance
50
+ */
51
+ (sid: string): AnnotationContext;
52
+ /**
53
+ * Constructs a annotation
54
+ *
55
+ * @param callSid - The call_sid
56
+ */
57
+ get(callSid: string): AnnotationContext;
58
+ /**
59
+ * Provide a user-friendly representation
60
+ */
61
+ toJSON(): any;
62
+ }
63
+
64
+ interface AnnotationPayload extends AnnotationResource, Page.TwilioResponsePayload {
65
+ }
66
+
67
+ interface AnnotationResource {
68
+ account_sid: string;
69
+ answered_by: AnnotationAnsweredBy;
70
+ call_score: number;
71
+ call_sid: string;
72
+ comment: string;
73
+ connectivity_issue: AnnotationConnectivityIssue;
74
+ incident: string;
75
+ quality_issues: string[];
76
+ spam: boolean;
77
+ url: string;
78
+ }
79
+
80
+ interface AnnotationSolution {
81
+ }
82
+
83
+
84
+ declare class AnnotationContext {
85
+ /**
86
+ * Initialize the AnnotationContext
87
+ *
88
+ * @param version - Version of the resource
89
+ * @param callSid - The call_sid
90
+ */
91
+ constructor(version: V1, callSid: string);
92
+
93
+ /**
94
+ * fetch a AnnotationInstance
95
+ *
96
+ * @param callback - Callback to handle processed record
97
+ */
98
+ fetch(callback?: (error: Error | null, items: AnnotationInstance) => any): Promise<AnnotationInstance>;
99
+ /**
100
+ * Provide a user-friendly representation
101
+ */
102
+ toJSON(): any;
103
+ /**
104
+ * update a AnnotationInstance
105
+ *
106
+ * @param callback - Callback to handle processed record
107
+ */
108
+ update(callback?: (error: Error | null, items: AnnotationInstance) => any): Promise<AnnotationInstance>;
109
+ /**
110
+ * update a AnnotationInstance
111
+ *
112
+ * @param opts - Options for request
113
+ * @param callback - Callback to handle processed record
114
+ */
115
+ update(opts?: AnnotationInstanceUpdateOptions, callback?: (error: Error | null, items: AnnotationInstance) => any): Promise<AnnotationInstance>;
116
+ }
117
+
118
+
119
+ declare class AnnotationInstance extends SerializableClass {
120
+ /**
121
+ * Initialize the AnnotationContext
122
+ *
123
+ * @param version - Version of the resource
124
+ * @param payload - The instance payload
125
+ * @param callSid - The call_sid
126
+ */
127
+ constructor(version: V1, payload: AnnotationPayload, callSid: string);
128
+
129
+ private _proxy: AnnotationContext;
130
+ accountSid: string;
131
+ answeredBy: AnnotationAnsweredBy;
132
+ callScore: number;
133
+ callSid: string;
134
+ comment: string;
135
+ connectivityIssue: AnnotationConnectivityIssue;
136
+ /**
137
+ * fetch a AnnotationInstance
138
+ *
139
+ * @param callback - Callback to handle processed record
140
+ */
141
+ fetch(callback?: (error: Error | null, items: AnnotationInstance) => any): Promise<AnnotationInstance>;
142
+ incident: string;
143
+ qualityIssues: string[];
144
+ spam: boolean;
145
+ /**
146
+ * Provide a user-friendly representation
147
+ */
148
+ toJSON(): any;
149
+ /**
150
+ * update a AnnotationInstance
151
+ *
152
+ * @param callback - Callback to handle processed record
153
+ */
154
+ update(callback?: (error: Error | null, items: AnnotationInstance) => any): Promise<AnnotationInstance>;
155
+ /**
156
+ * update a AnnotationInstance
157
+ *
158
+ * @param opts - Options for request
159
+ * @param callback - Callback to handle processed record
160
+ */
161
+ update(opts?: AnnotationInstanceUpdateOptions, callback?: (error: Error | null, items: AnnotationInstance) => any): Promise<AnnotationInstance>;
162
+ url: string;
163
+ }
164
+
165
+
166
+ declare class AnnotationPage extends Page<V1, AnnotationPayload, AnnotationResource, AnnotationInstance> {
167
+ /**
168
+ * Initialize the AnnotationPage
169
+ *
170
+ * @param version - Version of the resource
171
+ * @param response - Response from the API
172
+ * @param solution - Path solution
173
+ */
174
+ constructor(version: V1, response: Response<string>, solution: AnnotationSolution);
175
+
176
+ /**
177
+ * Build an instance of AnnotationInstance
178
+ *
179
+ * @param payload - Payload response from the API
180
+ */
181
+ getInstance(payload: AnnotationPayload): AnnotationInstance;
182
+ /**
183
+ * Provide a user-friendly representation
184
+ */
185
+ toJSON(): any;
186
+ }
187
+
188
+ export { AnnotationAnsweredBy, AnnotationConnectivityIssue, AnnotationContext, AnnotationInstance, AnnotationInstanceUpdateOptions, AnnotationList, AnnotationListInstance, AnnotationPage, AnnotationPayload, AnnotationQualityIssues, AnnotationResource, AnnotationSolution }
@@ -0,0 +1,406 @@
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 deserialize = require(
17
+ '../../../base/deserialize'); /* jshint ignore:line */
18
+ var serialize = require('../../../base/serialize'); /* jshint ignore:line */
19
+ var values = require('../../../base/values'); /* jshint ignore:line */
20
+
21
+ var AnnotationList;
22
+ var AnnotationPage;
23
+ var AnnotationInstance;
24
+ var AnnotationContext;
25
+
26
+ /* jshint ignore:start */
27
+ /**
28
+ * Initialize the AnnotationList
29
+ *
30
+ * @constructor Twilio.Insights.V1.AnnotationList
31
+ *
32
+ * @param {Twilio.Insights.V1} version - Version of the resource
33
+ */
34
+ /* jshint ignore:end */
35
+ AnnotationList = function AnnotationList(version) {
36
+ /* jshint ignore:start */
37
+ /**
38
+ * @function annotation
39
+ * @memberof Twilio.Insights.V1#
40
+ *
41
+ * @param {string} sid - sid of instance
42
+ *
43
+ * @returns {Twilio.Insights.V1.AnnotationContext}
44
+ */
45
+ /* jshint ignore:end */
46
+ function AnnotationListInstance(sid) {
47
+ return AnnotationListInstance.get(sid);
48
+ }
49
+
50
+ AnnotationListInstance._version = version;
51
+ // Path Solution
52
+ AnnotationListInstance._solution = {};
53
+ /* jshint ignore:start */
54
+ /**
55
+ * Constructs a annotation
56
+ *
57
+ * @function get
58
+ * @memberof Twilio.Insights.V1.AnnotationList#
59
+ *
60
+ * @param {string} callSid - The call_sid
61
+ *
62
+ * @returns {Twilio.Insights.V1.AnnotationContext}
63
+ */
64
+ /* jshint ignore:end */
65
+ AnnotationListInstance.get = function get(callSid) {
66
+ return new AnnotationContext(this._version, callSid);
67
+ };
68
+
69
+ /* jshint ignore:start */
70
+ /**
71
+ * Provide a user-friendly representation
72
+ *
73
+ * @function toJSON
74
+ * @memberof Twilio.Insights.V1.AnnotationList#
75
+ *
76
+ * @returns Object
77
+ */
78
+ /* jshint ignore:end */
79
+ AnnotationListInstance.toJSON = function toJSON() {
80
+ return this._solution;
81
+ };
82
+
83
+ AnnotationListInstance[util.inspect.custom] = function inspect(depth, options) {
84
+ return util.inspect(this.toJSON(), options);
85
+ };
86
+
87
+ return AnnotationListInstance;
88
+ };
89
+
90
+
91
+ /* jshint ignore:start */
92
+ /**
93
+ * Initialize the AnnotationPage
94
+ *
95
+ * @constructor Twilio.Insights.V1.AnnotationPage
96
+ *
97
+ * @param {V1} version - Version of the resource
98
+ * @param {Response<string>} response - Response from the API
99
+ * @param {AnnotationSolution} solution - Path solution
100
+ *
101
+ * @returns AnnotationPage
102
+ */
103
+ /* jshint ignore:end */
104
+ AnnotationPage = function AnnotationPage(version, response, solution) {
105
+ // Path Solution
106
+ this._solution = solution;
107
+
108
+ Page.prototype.constructor.call(this, version, response, this._solution);
109
+ };
110
+
111
+ _.extend(AnnotationPage.prototype, Page.prototype);
112
+ AnnotationPage.prototype.constructor = AnnotationPage;
113
+
114
+ /* jshint ignore:start */
115
+ /**
116
+ * Build an instance of AnnotationInstance
117
+ *
118
+ * @function getInstance
119
+ * @memberof Twilio.Insights.V1.AnnotationPage#
120
+ *
121
+ * @param {AnnotationPayload} payload - Payload response from the API
122
+ *
123
+ * @returns AnnotationInstance
124
+ */
125
+ /* jshint ignore:end */
126
+ AnnotationPage.prototype.getInstance = function getInstance(payload) {
127
+ return new AnnotationInstance(this._version, payload);
128
+ };
129
+
130
+ /* jshint ignore:start */
131
+ /**
132
+ * Provide a user-friendly representation
133
+ *
134
+ * @function toJSON
135
+ * @memberof Twilio.Insights.V1.AnnotationPage#
136
+ *
137
+ * @returns Object
138
+ */
139
+ /* jshint ignore:end */
140
+ AnnotationPage.prototype.toJSON = function toJSON() {
141
+ let clone = {};
142
+ _.forOwn(this, function(value, key) {
143
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
144
+ clone[key] = value;
145
+ }
146
+ });
147
+ return clone;
148
+ };
149
+
150
+ AnnotationPage.prototype[util.inspect.custom] = function inspect(depth, options)
151
+ {
152
+ return util.inspect(this.toJSON(), options);
153
+ };
154
+
155
+
156
+ /* jshint ignore:start */
157
+ /**
158
+ * Initialize the AnnotationContext
159
+ *
160
+ * @constructor Twilio.Insights.V1.AnnotationInstance
161
+ *
162
+ * @property {string} callSid - The call_sid
163
+ * @property {string} accountSid - The account_sid
164
+ * @property {annotation.answered_by} answeredBy - The answered_by
165
+ * @property {annotation.connectivity_issue} connectivityIssue -
166
+ * The connectivity_issue
167
+ * @property {string} qualityIssues - The quality_issues
168
+ * @property {boolean} spam - The spam
169
+ * @property {number} callScore - The call_score
170
+ * @property {string} comment - The comment
171
+ * @property {string} incident - The incident
172
+ * @property {string} url - The url
173
+ *
174
+ * @param {V1} version - Version of the resource
175
+ * @param {AnnotationPayload} payload - The instance payload
176
+ * @param {sid} callSid - The call_sid
177
+ */
178
+ /* jshint ignore:end */
179
+ AnnotationInstance = function AnnotationInstance(version, payload, callSid) {
180
+ this._version = version;
181
+
182
+ // Marshaled Properties
183
+ this.callSid = payload.call_sid; // jshint ignore:line
184
+ this.accountSid = payload.account_sid; // jshint ignore:line
185
+ this.answeredBy = payload.answered_by; // jshint ignore:line
186
+ this.connectivityIssue = payload.connectivity_issue; // jshint ignore:line
187
+ this.qualityIssues = payload.quality_issues; // jshint ignore:line
188
+ this.spam = payload.spam; // jshint ignore:line
189
+ this.callScore = deserialize.integer(payload.call_score); // jshint ignore:line
190
+ this.comment = payload.comment; // jshint ignore:line
191
+ this.incident = payload.incident; // jshint ignore:line
192
+ this.url = payload.url; // jshint ignore:line
193
+
194
+ // Context
195
+ this._context = undefined;
196
+ this._solution = {callSid: callSid || this.callSid, };
197
+ };
198
+
199
+ Object.defineProperty(AnnotationInstance.prototype,
200
+ '_proxy', {
201
+ get: function() {
202
+ if (!this._context) {
203
+ this._context = new AnnotationContext(this._version, this._solution.callSid);
204
+ }
205
+
206
+ return this._context;
207
+ }
208
+ });
209
+
210
+ /* jshint ignore:start */
211
+ /**
212
+ * update a AnnotationInstance
213
+ *
214
+ * @function update
215
+ * @memberof Twilio.Insights.V1.AnnotationInstance#
216
+ *
217
+ * @param {object} [opts] - Options for request
218
+ * @param {annotation.answered_by} [opts.answeredBy] - The answered_by
219
+ * @param {annotation.connectivity_issue} [opts.connectivityIssue] -
220
+ * The connectivity_issue
221
+ * @param {string} [opts.qualityIssues] - The quality_issues
222
+ * @param {boolean} [opts.spam] - The spam
223
+ * @param {number} [opts.callScore] - The call_score
224
+ * @param {string} [opts.comment] - The comment
225
+ * @param {string} [opts.incident] - The incident
226
+ * @param {function} [callback] - Callback to handle processed record
227
+ *
228
+ * @returns {Promise} Resolves to processed AnnotationInstance
229
+ */
230
+ /* jshint ignore:end */
231
+ AnnotationInstance.prototype.update = function update(opts, callback) {
232
+ return this._proxy.update(opts, callback);
233
+ };
234
+
235
+ /* jshint ignore:start */
236
+ /**
237
+ * fetch a AnnotationInstance
238
+ *
239
+ * @function fetch
240
+ * @memberof Twilio.Insights.V1.AnnotationInstance#
241
+ *
242
+ * @param {function} [callback] - Callback to handle processed record
243
+ *
244
+ * @returns {Promise} Resolves to processed AnnotationInstance
245
+ */
246
+ /* jshint ignore:end */
247
+ AnnotationInstance.prototype.fetch = function fetch(callback) {
248
+ return this._proxy.fetch(callback);
249
+ };
250
+
251
+ /* jshint ignore:start */
252
+ /**
253
+ * Provide a user-friendly representation
254
+ *
255
+ * @function toJSON
256
+ * @memberof Twilio.Insights.V1.AnnotationInstance#
257
+ *
258
+ * @returns Object
259
+ */
260
+ /* jshint ignore:end */
261
+ AnnotationInstance.prototype.toJSON = function toJSON() {
262
+ let clone = {};
263
+ _.forOwn(this, function(value, key) {
264
+ if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
265
+ clone[key] = value;
266
+ }
267
+ });
268
+ return clone;
269
+ };
270
+
271
+ AnnotationInstance.prototype[util.inspect.custom] = function inspect(depth,
272
+ options) {
273
+ return util.inspect(this.toJSON(), options);
274
+ };
275
+
276
+
277
+ /* jshint ignore:start */
278
+ /**
279
+ * Initialize the AnnotationContext
280
+ *
281
+ * @constructor Twilio.Insights.V1.AnnotationContext
282
+ *
283
+ * @param {V1} version - Version of the resource
284
+ * @param {sid} callSid - The call_sid
285
+ */
286
+ /* jshint ignore:end */
287
+ AnnotationContext = function AnnotationContext(version, callSid) {
288
+ this._version = version;
289
+
290
+ // Path Solution
291
+ this._solution = {callSid: callSid, };
292
+ this._uri = `/Voice/${callSid}/Annotation`;
293
+ };
294
+
295
+ /* jshint ignore:start */
296
+ /**
297
+ * update a AnnotationInstance
298
+ *
299
+ * @function update
300
+ * @memberof Twilio.Insights.V1.AnnotationContext#
301
+ *
302
+ * @param {object} [opts] - Options for request
303
+ * @param {annotation.answered_by} [opts.answeredBy] - The answered_by
304
+ * @param {annotation.connectivity_issue} [opts.connectivityIssue] -
305
+ * The connectivity_issue
306
+ * @param {string} [opts.qualityIssues] - The quality_issues
307
+ * @param {boolean} [opts.spam] - The spam
308
+ * @param {number} [opts.callScore] - The call_score
309
+ * @param {string} [opts.comment] - The comment
310
+ * @param {string} [opts.incident] - The incident
311
+ * @param {function} [callback] - Callback to handle processed record
312
+ *
313
+ * @returns {Promise} Resolves to processed AnnotationInstance
314
+ */
315
+ /* jshint ignore:end */
316
+ AnnotationContext.prototype.update = function update(opts, callback) {
317
+ if (_.isFunction(opts)) {
318
+ callback = opts;
319
+ opts = {};
320
+ }
321
+ opts = opts || {};
322
+
323
+ var deferred = Q.defer();
324
+ var data = values.of({
325
+ 'AnsweredBy': _.get(opts, 'answeredBy'),
326
+ 'ConnectivityIssue': _.get(opts, 'connectivityIssue'),
327
+ 'QualityIssues': _.get(opts, 'qualityIssues'),
328
+ 'Spam': serialize.bool(_.get(opts, 'spam')),
329
+ 'CallScore': _.get(opts, 'callScore'),
330
+ 'Comment': _.get(opts, 'comment'),
331
+ 'Incident': _.get(opts, 'incident')
332
+ });
333
+
334
+ var promise = this._version.update({uri: this._uri, method: 'POST', data: data});
335
+
336
+ promise = promise.then(function(payload) {
337
+ deferred.resolve(new AnnotationInstance(this._version, payload, this._solution.callSid));
338
+ }.bind(this));
339
+
340
+ promise.catch(function(error) {
341
+ deferred.reject(error);
342
+ });
343
+
344
+ if (_.isFunction(callback)) {
345
+ deferred.promise.nodeify(callback);
346
+ }
347
+
348
+ return deferred.promise;
349
+ };
350
+
351
+ /* jshint ignore:start */
352
+ /**
353
+ * fetch a AnnotationInstance
354
+ *
355
+ * @function fetch
356
+ * @memberof Twilio.Insights.V1.AnnotationContext#
357
+ *
358
+ * @param {function} [callback] - Callback to handle processed record
359
+ *
360
+ * @returns {Promise} Resolves to processed AnnotationInstance
361
+ */
362
+ /* jshint ignore:end */
363
+ AnnotationContext.prototype.fetch = function fetch(callback) {
364
+ var deferred = Q.defer();
365
+ var promise = this._version.fetch({uri: this._uri, method: 'GET'});
366
+
367
+ promise = promise.then(function(payload) {
368
+ deferred.resolve(new AnnotationInstance(this._version, payload, this._solution.callSid));
369
+ }.bind(this));
370
+
371
+ promise.catch(function(error) {
372
+ deferred.reject(error);
373
+ });
374
+
375
+ if (_.isFunction(callback)) {
376
+ deferred.promise.nodeify(callback);
377
+ }
378
+
379
+ return deferred.promise;
380
+ };
381
+
382
+ /* jshint ignore:start */
383
+ /**
384
+ * Provide a user-friendly representation
385
+ *
386
+ * @function toJSON
387
+ * @memberof Twilio.Insights.V1.AnnotationContext#
388
+ *
389
+ * @returns Object
390
+ */
391
+ /* jshint ignore:end */
392
+ AnnotationContext.prototype.toJSON = function toJSON() {
393
+ return this._solution;
394
+ };
395
+
396
+ AnnotationContext.prototype[util.inspect.custom] = function inspect(depth,
397
+ options) {
398
+ return util.inspect(this.toJSON(), options);
399
+ };
400
+
401
+ module.exports = {
402
+ AnnotationList: AnnotationList,
403
+ AnnotationPage: AnnotationPage,
404
+ AnnotationInstance: AnnotationInstance,
405
+ AnnotationContext: AnnotationContext
406
+ };
@@ -9,6 +9,8 @@ import Media = require('../Media');
9
9
  import Version = require('../../base/Version');
10
10
  import { MediaProcessorList } from './v1/mediaProcessor';
11
11
  import { MediaProcessorListInstance } from './v1/mediaProcessor';
12
+ import { MediaRecordingList } from './v1/mediaRecording';
13
+ import { MediaRecordingListInstance } from './v1/mediaRecording';
12
14
  import { PlayerStreamerList } from './v1/playerStreamer';
13
15
  import { PlayerStreamerListInstance } from './v1/playerStreamer';
14
16
 
@@ -22,6 +24,7 @@ declare class V1 extends Version {
22
24
  constructor(domain: Media);
23
25
 
24
26
  readonly mediaProcessor: MediaProcessorListInstance;
27
+ readonly mediaRecording: MediaRecordingListInstance;
25
28
  readonly playerStreamer: PlayerStreamerListInstance;
26
29
  }
27
30
 
@@ -11,6 +11,7 @@
11
11
 
12
12
  var _ = require('lodash'); /* jshint ignore:line */
13
13
  var MediaProcessorList = require('./v1/mediaProcessor').MediaProcessorList;
14
+ var MediaRecordingList = require('./v1/mediaRecording').MediaRecordingList;
14
15
  var PlayerStreamerList = require('./v1/playerStreamer').PlayerStreamerList;
15
16
  var Version = require('../../base/Version'); /* jshint ignore:line */
16
17
 
@@ -23,6 +24,8 @@ var Version = require('../../base/Version'); /* jshint ignore:line */
23
24
  *
24
25
  * @property {Twilio.Media.V1.MediaProcessorList} mediaProcessor -
25
26
  * mediaProcessor resource
27
+ * @property {Twilio.Media.V1.MediaRecordingList} mediaRecording -
28
+ * mediaRecording resource
26
29
  * @property {Twilio.Media.V1.PlayerStreamerList} playerStreamer -
27
30
  * playerStreamer resource
28
31
  *
@@ -34,6 +37,7 @@ function V1(domain) {
34
37
 
35
38
  // Resources
36
39
  this._mediaProcessor = undefined;
40
+ this._mediaRecording = undefined;
37
41
  this._playerStreamer = undefined;
38
42
  }
39
43
 
@@ -48,6 +52,14 @@ Object.defineProperty(V1.prototype,
48
52
  }
49
53
  });
50
54
 
55
+ Object.defineProperty(V1.prototype,
56
+ 'mediaRecording', {
57
+ get: function() {
58
+ this._mediaRecording = this._mediaRecording || new MediaRecordingList(this);
59
+ return this._mediaRecording;
60
+ }
61
+ });
62
+
51
63
  Object.defineProperty(V1.prototype,
52
64
  'playerStreamer', {
53
65
  get: function() {
@@ -487,7 +487,7 @@ MediaProcessorPage.prototype[util.inspect.custom] = function inspect(depth,
487
487
  * The URL to which Twilio will send MediaProcessor event updates
488
488
  * @property {string} statusCallbackMethod -
489
489
  * The HTTP method Twilio should use to call the `status_callback` URL
490
- * @property {number} maxDuration - Maximum MediaProcessor duration in minutes
490
+ * @property {number} maxDuration - Maximum MediaProcessor duration in seconds
491
491
  *
492
492
  * @param {V1} version - Version of the resource
493
493
  * @param {MediaProcessorPayload} payload - The instance payload