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,162 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Initialize the PlaybackGrantList
|
|
15
|
+
*
|
|
16
|
+
* @param version - Version of the resource
|
|
17
|
+
* @param sid - The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
|
18
|
+
*/
|
|
19
|
+
declare function PlaybackGrantList(version: V1, sid: string): PlaybackGrantListInstance;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Options to pass to create
|
|
23
|
+
*
|
|
24
|
+
* @property accessControlAllowOrigin - The full URL that is authorized to play back the livestream
|
|
25
|
+
* @property ttl - The time to live of the PlaybackGrant
|
|
26
|
+
*/
|
|
27
|
+
interface PlaybackGrantInstanceCreateOptions {
|
|
28
|
+
accessControlAllowOrigin?: string;
|
|
29
|
+
ttl?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface PlaybackGrantListInstance {
|
|
33
|
+
/**
|
|
34
|
+
* @param sid - sid of instance
|
|
35
|
+
*/
|
|
36
|
+
(sid: string): PlaybackGrantContext;
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a playback_grant
|
|
39
|
+
*/
|
|
40
|
+
get(): PlaybackGrantContext;
|
|
41
|
+
/**
|
|
42
|
+
* Provide a user-friendly representation
|
|
43
|
+
*/
|
|
44
|
+
toJSON(): any;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PlaybackGrantPayload extends PlaybackGrantResource, Page.TwilioResponsePayload {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface PlaybackGrantResource {
|
|
51
|
+
account_sid: string;
|
|
52
|
+
date_created: Date;
|
|
53
|
+
grant: object;
|
|
54
|
+
sid: string;
|
|
55
|
+
url: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface PlaybackGrantSolution {
|
|
59
|
+
sid?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
declare class PlaybackGrantContext {
|
|
64
|
+
/**
|
|
65
|
+
* Initialize the PlaybackGrantContext
|
|
66
|
+
*
|
|
67
|
+
* @param version - Version of the resource
|
|
68
|
+
* @param sid - The SID that identifies the resource to fetch
|
|
69
|
+
*/
|
|
70
|
+
constructor(version: V1, sid: string);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* create a PlaybackGrantInstance
|
|
74
|
+
*
|
|
75
|
+
* @param callback - Callback to handle processed record
|
|
76
|
+
*/
|
|
77
|
+
create(callback?: (error: Error | null, item: PlaybackGrantInstance) => any): Promise<PlaybackGrantInstance>;
|
|
78
|
+
/**
|
|
79
|
+
* create a PlaybackGrantInstance
|
|
80
|
+
*
|
|
81
|
+
* @param opts - Options for request
|
|
82
|
+
* @param callback - Callback to handle processed record
|
|
83
|
+
*/
|
|
84
|
+
create(opts?: PlaybackGrantInstanceCreateOptions, callback?: (error: Error | null, item: PlaybackGrantInstance) => any): Promise<PlaybackGrantInstance>;
|
|
85
|
+
/**
|
|
86
|
+
* fetch a PlaybackGrantInstance
|
|
87
|
+
*
|
|
88
|
+
* @param callback - Callback to handle processed record
|
|
89
|
+
*/
|
|
90
|
+
fetch(callback?: (error: Error | null, items: PlaybackGrantInstance) => any): Promise<PlaybackGrantInstance>;
|
|
91
|
+
/**
|
|
92
|
+
* Provide a user-friendly representation
|
|
93
|
+
*/
|
|
94
|
+
toJSON(): any;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
declare class PlaybackGrantInstance extends SerializableClass {
|
|
99
|
+
/**
|
|
100
|
+
* Initialize the PlaybackGrantContext
|
|
101
|
+
*
|
|
102
|
+
* @param version - Version of the resource
|
|
103
|
+
* @param payload - The instance payload
|
|
104
|
+
* @param sid - The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
|
105
|
+
*/
|
|
106
|
+
constructor(version: V1, payload: PlaybackGrantPayload, sid: string);
|
|
107
|
+
|
|
108
|
+
private _proxy: PlaybackGrantContext;
|
|
109
|
+
accountSid: string;
|
|
110
|
+
/**
|
|
111
|
+
* create a PlaybackGrantInstance
|
|
112
|
+
*
|
|
113
|
+
* @param callback - Callback to handle processed record
|
|
114
|
+
*/
|
|
115
|
+
create(callback?: (error: Error | null, items: PlaybackGrantInstance) => any): Promise<PlaybackGrantInstance>;
|
|
116
|
+
/**
|
|
117
|
+
* create a PlaybackGrantInstance
|
|
118
|
+
*
|
|
119
|
+
* @param opts - Options for request
|
|
120
|
+
* @param callback - Callback to handle processed record
|
|
121
|
+
*/
|
|
122
|
+
create(opts?: PlaybackGrantInstanceCreateOptions, callback?: (error: Error | null, items: PlaybackGrantInstance) => any): Promise<PlaybackGrantInstance>;
|
|
123
|
+
dateCreated: Date;
|
|
124
|
+
/**
|
|
125
|
+
* fetch a PlaybackGrantInstance
|
|
126
|
+
*
|
|
127
|
+
* @param callback - Callback to handle processed record
|
|
128
|
+
*/
|
|
129
|
+
fetch(callback?: (error: Error | null, items: PlaybackGrantInstance) => any): Promise<PlaybackGrantInstance>;
|
|
130
|
+
grant: any;
|
|
131
|
+
sid: string;
|
|
132
|
+
/**
|
|
133
|
+
* Provide a user-friendly representation
|
|
134
|
+
*/
|
|
135
|
+
toJSON(): any;
|
|
136
|
+
url: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
declare class PlaybackGrantPage extends Page<V1, PlaybackGrantPayload, PlaybackGrantResource, PlaybackGrantInstance> {
|
|
141
|
+
/**
|
|
142
|
+
* Initialize the PlaybackGrantPage
|
|
143
|
+
*
|
|
144
|
+
* @param version - Version of the resource
|
|
145
|
+
* @param response - Response from the API
|
|
146
|
+
* @param solution - Path solution
|
|
147
|
+
*/
|
|
148
|
+
constructor(version: V1, response: Response<string>, solution: PlaybackGrantSolution);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Build an instance of PlaybackGrantInstance
|
|
152
|
+
*
|
|
153
|
+
* @param payload - Payload response from the API
|
|
154
|
+
*/
|
|
155
|
+
getInstance(payload: PlaybackGrantPayload): PlaybackGrantInstance;
|
|
156
|
+
/**
|
|
157
|
+
* Provide a user-friendly representation
|
|
158
|
+
*/
|
|
159
|
+
toJSON(): any;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export { PlaybackGrantContext, PlaybackGrantInstance, PlaybackGrantInstanceCreateOptions, PlaybackGrantList, PlaybackGrantListInstance, PlaybackGrantPage, PlaybackGrantPayload, PlaybackGrantResource, PlaybackGrantSolution }
|
|
@@ -0,0 +1,384 @@
|
|
|
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 values = require('../../../../base/values'); /* jshint ignore:line */
|
|
19
|
+
|
|
20
|
+
var PlaybackGrantList;
|
|
21
|
+
var PlaybackGrantPage;
|
|
22
|
+
var PlaybackGrantInstance;
|
|
23
|
+
var PlaybackGrantContext;
|
|
24
|
+
|
|
25
|
+
/* jshint ignore:start */
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the PlaybackGrantList
|
|
28
|
+
*
|
|
29
|
+
* @constructor Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantList
|
|
30
|
+
*
|
|
31
|
+
* @param {Twilio.Media.V1} version - Version of the resource
|
|
32
|
+
* @param {string} sid -
|
|
33
|
+
* The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
|
34
|
+
*/
|
|
35
|
+
/* jshint ignore:end */
|
|
36
|
+
PlaybackGrantList = function PlaybackGrantList(version, sid) {
|
|
37
|
+
/* jshint ignore:start */
|
|
38
|
+
/**
|
|
39
|
+
* @function playbackGrant
|
|
40
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext#
|
|
41
|
+
*
|
|
42
|
+
* @param {string} sid - sid of instance
|
|
43
|
+
*
|
|
44
|
+
* @returns {Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantContext}
|
|
45
|
+
*/
|
|
46
|
+
/* jshint ignore:end */
|
|
47
|
+
function PlaybackGrantListInstance(sid) {
|
|
48
|
+
return PlaybackGrantListInstance.get(sid);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
PlaybackGrantListInstance._version = version;
|
|
52
|
+
// Path Solution
|
|
53
|
+
PlaybackGrantListInstance._solution = {sid: sid};
|
|
54
|
+
/* jshint ignore:start */
|
|
55
|
+
/**
|
|
56
|
+
* Constructs a playback_grant
|
|
57
|
+
*
|
|
58
|
+
* @function get
|
|
59
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantList#
|
|
60
|
+
*
|
|
61
|
+
* @returns {Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantContext}
|
|
62
|
+
*/
|
|
63
|
+
/* jshint ignore:end */
|
|
64
|
+
PlaybackGrantListInstance.get = function get() {
|
|
65
|
+
return new PlaybackGrantContext(this._version, this._solution.sid);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/* jshint ignore:start */
|
|
69
|
+
/**
|
|
70
|
+
* Provide a user-friendly representation
|
|
71
|
+
*
|
|
72
|
+
* @function toJSON
|
|
73
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantList#
|
|
74
|
+
*
|
|
75
|
+
* @returns Object
|
|
76
|
+
*/
|
|
77
|
+
/* jshint ignore:end */
|
|
78
|
+
PlaybackGrantListInstance.toJSON = function toJSON() {
|
|
79
|
+
return this._solution;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
PlaybackGrantListInstance[util.inspect.custom] = function inspect(depth,
|
|
83
|
+
options) {
|
|
84
|
+
return util.inspect(this.toJSON(), options);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return PlaybackGrantListInstance;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
/* jshint ignore:start */
|
|
92
|
+
/**
|
|
93
|
+
* Initialize the PlaybackGrantPage
|
|
94
|
+
*
|
|
95
|
+
* @constructor Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantPage
|
|
96
|
+
*
|
|
97
|
+
* @param {V1} version - Version of the resource
|
|
98
|
+
* @param {Response<string>} response - Response from the API
|
|
99
|
+
* @param {PlaybackGrantSolution} solution - Path solution
|
|
100
|
+
*
|
|
101
|
+
* @returns PlaybackGrantPage
|
|
102
|
+
*/
|
|
103
|
+
/* jshint ignore:end */
|
|
104
|
+
PlaybackGrantPage = function PlaybackGrantPage(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(PlaybackGrantPage.prototype, Page.prototype);
|
|
112
|
+
PlaybackGrantPage.prototype.constructor = PlaybackGrantPage;
|
|
113
|
+
|
|
114
|
+
/* jshint ignore:start */
|
|
115
|
+
/**
|
|
116
|
+
* Build an instance of PlaybackGrantInstance
|
|
117
|
+
*
|
|
118
|
+
* @function getInstance
|
|
119
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantPage#
|
|
120
|
+
*
|
|
121
|
+
* @param {PlaybackGrantPayload} payload - Payload response from the API
|
|
122
|
+
*
|
|
123
|
+
* @returns PlaybackGrantInstance
|
|
124
|
+
*/
|
|
125
|
+
/* jshint ignore:end */
|
|
126
|
+
PlaybackGrantPage.prototype.getInstance = function getInstance(payload) {
|
|
127
|
+
return new PlaybackGrantInstance(this._version, payload, this._solution.sid);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/* jshint ignore:start */
|
|
131
|
+
/**
|
|
132
|
+
* Provide a user-friendly representation
|
|
133
|
+
*
|
|
134
|
+
* @function toJSON
|
|
135
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantPage#
|
|
136
|
+
*
|
|
137
|
+
* @returns Object
|
|
138
|
+
*/
|
|
139
|
+
/* jshint ignore:end */
|
|
140
|
+
PlaybackGrantPage.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
|
+
PlaybackGrantPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
151
|
+
options) {
|
|
152
|
+
return util.inspect(this.toJSON(), options);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
/* jshint ignore:start */
|
|
157
|
+
/**
|
|
158
|
+
* Initialize the PlaybackGrantContext
|
|
159
|
+
*
|
|
160
|
+
* @constructor Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantInstance
|
|
161
|
+
*
|
|
162
|
+
* @property {string} sid -
|
|
163
|
+
* The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
|
164
|
+
* @property {string} url - The absolute URL of the resource
|
|
165
|
+
* @property {string} accountSid - The SID of the Account that created the resource
|
|
166
|
+
* @property {Date} dateCreated -
|
|
167
|
+
* The ISO 8601 date and time in GMT when the resource was created
|
|
168
|
+
* @property {object} grant -
|
|
169
|
+
* The grant that authorizes the player sdk to connect to the livestream
|
|
170
|
+
*
|
|
171
|
+
* @param {V1} version - Version of the resource
|
|
172
|
+
* @param {PlaybackGrantPayload} payload - The instance payload
|
|
173
|
+
* @param {sid} sid -
|
|
174
|
+
* The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
|
175
|
+
*/
|
|
176
|
+
/* jshint ignore:end */
|
|
177
|
+
PlaybackGrantInstance = function PlaybackGrantInstance(version, payload, sid) {
|
|
178
|
+
this._version = version;
|
|
179
|
+
|
|
180
|
+
// Marshaled Properties
|
|
181
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
182
|
+
this.url = payload.url; // jshint ignore:line
|
|
183
|
+
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
184
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
|
|
185
|
+
this.grant = payload.grant; // jshint ignore:line
|
|
186
|
+
|
|
187
|
+
// Context
|
|
188
|
+
this._context = undefined;
|
|
189
|
+
this._solution = {sid: sid, };
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
Object.defineProperty(PlaybackGrantInstance.prototype,
|
|
193
|
+
'_proxy', {
|
|
194
|
+
get: function() {
|
|
195
|
+
if (!this._context) {
|
|
196
|
+
this._context = new PlaybackGrantContext(this._version, this._solution.sid);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return this._context;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
/* jshint ignore:start */
|
|
204
|
+
/**
|
|
205
|
+
* create a PlaybackGrantInstance
|
|
206
|
+
*
|
|
207
|
+
* @function create
|
|
208
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantInstance#
|
|
209
|
+
*
|
|
210
|
+
* @param {object} [opts] - Options for request
|
|
211
|
+
* @param {number} [opts.ttl] - The time to live of the PlaybackGrant
|
|
212
|
+
* @param {string} [opts.accessControlAllowOrigin] -
|
|
213
|
+
* The full URL that is authorized to play back the livestream
|
|
214
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
215
|
+
*
|
|
216
|
+
* @returns {Promise} Resolves to processed PlaybackGrantInstance
|
|
217
|
+
*/
|
|
218
|
+
/* jshint ignore:end */
|
|
219
|
+
PlaybackGrantInstance.prototype.create = function create(opts, callback) {
|
|
220
|
+
return this._proxy.create(opts, callback);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/* jshint ignore:start */
|
|
224
|
+
/**
|
|
225
|
+
* fetch a PlaybackGrantInstance
|
|
226
|
+
*
|
|
227
|
+
* @function fetch
|
|
228
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantInstance#
|
|
229
|
+
*
|
|
230
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
231
|
+
*
|
|
232
|
+
* @returns {Promise} Resolves to processed PlaybackGrantInstance
|
|
233
|
+
*/
|
|
234
|
+
/* jshint ignore:end */
|
|
235
|
+
PlaybackGrantInstance.prototype.fetch = function fetch(callback) {
|
|
236
|
+
return this._proxy.fetch(callback);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/* jshint ignore:start */
|
|
240
|
+
/**
|
|
241
|
+
* Provide a user-friendly representation
|
|
242
|
+
*
|
|
243
|
+
* @function toJSON
|
|
244
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantInstance#
|
|
245
|
+
*
|
|
246
|
+
* @returns Object
|
|
247
|
+
*/
|
|
248
|
+
/* jshint ignore:end */
|
|
249
|
+
PlaybackGrantInstance.prototype.toJSON = function toJSON() {
|
|
250
|
+
let clone = {};
|
|
251
|
+
_.forOwn(this, function(value, key) {
|
|
252
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
253
|
+
clone[key] = value;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
return clone;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
PlaybackGrantInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
260
|
+
options) {
|
|
261
|
+
return util.inspect(this.toJSON(), options);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
/* jshint ignore:start */
|
|
266
|
+
/**
|
|
267
|
+
* Initialize the PlaybackGrantContext
|
|
268
|
+
*
|
|
269
|
+
* @constructor Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantContext
|
|
270
|
+
*
|
|
271
|
+
* @param {V1} version - Version of the resource
|
|
272
|
+
* @param {sid} sid - The SID that identifies the resource to fetch
|
|
273
|
+
*/
|
|
274
|
+
/* jshint ignore:end */
|
|
275
|
+
PlaybackGrantContext = function PlaybackGrantContext(version, sid) {
|
|
276
|
+
this._version = version;
|
|
277
|
+
|
|
278
|
+
// Path Solution
|
|
279
|
+
this._solution = {sid: sid, };
|
|
280
|
+
this._uri = `/PlayerStreamers/${sid}/PlaybackGrant`;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/* jshint ignore:start */
|
|
284
|
+
/**
|
|
285
|
+
* create a PlaybackGrantInstance
|
|
286
|
+
*
|
|
287
|
+
* @function create
|
|
288
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantContext#
|
|
289
|
+
*
|
|
290
|
+
* @param {object} [opts] - Options for request
|
|
291
|
+
* @param {number} [opts.ttl] - The time to live of the PlaybackGrant
|
|
292
|
+
* @param {string} [opts.accessControlAllowOrigin] -
|
|
293
|
+
* The full URL that is authorized to play back the livestream
|
|
294
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
295
|
+
*
|
|
296
|
+
* @returns {Promise} Resolves to processed PlaybackGrantInstance
|
|
297
|
+
*/
|
|
298
|
+
/* jshint ignore:end */
|
|
299
|
+
PlaybackGrantContext.prototype.create = function create(opts, callback) {
|
|
300
|
+
if (_.isFunction(opts)) {
|
|
301
|
+
callback = opts;
|
|
302
|
+
opts = {};
|
|
303
|
+
}
|
|
304
|
+
opts = opts || {};
|
|
305
|
+
|
|
306
|
+
var deferred = Q.defer();
|
|
307
|
+
var data = values.of({
|
|
308
|
+
'Ttl': _.get(opts, 'ttl'),
|
|
309
|
+
'AccessControlAllowOrigin': _.get(opts, 'accessControlAllowOrigin')
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
|
|
313
|
+
|
|
314
|
+
promise = promise.then(function(payload) {
|
|
315
|
+
deferred.resolve(new PlaybackGrantInstance(this._version, payload, this._solution.sid));
|
|
316
|
+
}.bind(this));
|
|
317
|
+
|
|
318
|
+
promise.catch(function(error) {
|
|
319
|
+
deferred.reject(error);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
if (_.isFunction(callback)) {
|
|
323
|
+
deferred.promise.nodeify(callback);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return deferred.promise;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/* jshint ignore:start */
|
|
330
|
+
/**
|
|
331
|
+
* fetch a PlaybackGrantInstance
|
|
332
|
+
*
|
|
333
|
+
* @function fetch
|
|
334
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantContext#
|
|
335
|
+
*
|
|
336
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
337
|
+
*
|
|
338
|
+
* @returns {Promise} Resolves to processed PlaybackGrantInstance
|
|
339
|
+
*/
|
|
340
|
+
/* jshint ignore:end */
|
|
341
|
+
PlaybackGrantContext.prototype.fetch = function fetch(callback) {
|
|
342
|
+
var deferred = Q.defer();
|
|
343
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
344
|
+
|
|
345
|
+
promise = promise.then(function(payload) {
|
|
346
|
+
deferred.resolve(new PlaybackGrantInstance(this._version, payload, this._solution.sid));
|
|
347
|
+
}.bind(this));
|
|
348
|
+
|
|
349
|
+
promise.catch(function(error) {
|
|
350
|
+
deferred.reject(error);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
if (_.isFunction(callback)) {
|
|
354
|
+
deferred.promise.nodeify(callback);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return deferred.promise;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/* jshint ignore:start */
|
|
361
|
+
/**
|
|
362
|
+
* Provide a user-friendly representation
|
|
363
|
+
*
|
|
364
|
+
* @function toJSON
|
|
365
|
+
* @memberof Twilio.Media.V1.PlayerStreamerContext.PlaybackGrantContext#
|
|
366
|
+
*
|
|
367
|
+
* @returns Object
|
|
368
|
+
*/
|
|
369
|
+
/* jshint ignore:end */
|
|
370
|
+
PlaybackGrantContext.prototype.toJSON = function toJSON() {
|
|
371
|
+
return this._solution;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
PlaybackGrantContext.prototype[util.inspect.custom] = function inspect(depth,
|
|
375
|
+
options) {
|
|
376
|
+
return util.inspect(this.toJSON(), options);
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
module.exports = {
|
|
380
|
+
PlaybackGrantList: PlaybackGrantList,
|
|
381
|
+
PlaybackGrantPage: PlaybackGrantPage,
|
|
382
|
+
PlaybackGrantInstance: PlaybackGrantInstance,
|
|
383
|
+
PlaybackGrantContext: PlaybackGrantContext
|
|
384
|
+
};
|