twilio 5.0.0 → 5.0.2

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 (53) hide show
  1. package/lib/rest/Oauth.d.ts +4 -0
  2. package/lib/rest/{Media.js → Oauth.js} +3 -3
  3. package/lib/rest/{MediaBase.d.ts → OauthBase.d.ts} +4 -4
  4. package/lib/rest/{MediaBase.js → OauthBase.js} +5 -5
  5. package/lib/rest/Twilio.d.ts +5 -5
  6. package/lib/rest/Twilio.js +5 -5
  7. package/lib/rest/api/v2010/account/call.d.ts +34 -10
  8. package/lib/rest/api/v2010/account/call.js +8 -0
  9. package/lib/rest/api/v2010/account/conference/participant.d.ts +6 -0
  10. package/lib/rest/api/v2010/account/conference/participant.js +2 -0
  11. package/lib/rest/api/v2010/account/conference.d.ts +24 -0
  12. package/lib/rest/api/v2010/account/conference.js +8 -0
  13. package/lib/rest/api/v2010/account/message.d.ts +12 -0
  14. package/lib/rest/api/v2010/account/message.js +4 -0
  15. package/lib/rest/content/v1/content/approvalCreate.d.ts +3 -3
  16. package/lib/rest/content/v1/content/approvalCreate.js +7 -7
  17. package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
  18. package/lib/rest/content/v1/content/approvalFetch.js +14 -14
  19. package/lib/rest/content/v1/content.d.ts +20 -0
  20. package/lib/rest/content/v1/content.js +10 -1
  21. package/lib/rest/conversations/v1/service/conversation.d.ts +6 -6
  22. package/lib/rest/flexApi/v1/plugin.d.ts +4 -0
  23. package/lib/rest/flexApi/v1/plugin.js +4 -0
  24. package/lib/rest/numbers/v1/portingPortInFetch.d.ts +6 -0
  25. package/lib/rest/numbers/v1/portingPortInFetch.js +2 -0
  26. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +12 -0
  27. package/lib/rest/numbers/v2/regulatoryCompliance/bundle.js +4 -0
  28. package/lib/rest/oauth/V1.d.ts +20 -0
  29. package/lib/rest/oauth/V1.js +42 -0
  30. package/lib/rest/oauth/v1/authorize.d.ts +69 -0
  31. package/lib/rest/oauth/v1/authorize.js +83 -0
  32. package/lib/rest/oauth/v1/token.d.ts +88 -0
  33. package/lib/rest/oauth/v1/token.js +98 -0
  34. package/lib/rest/trusthub/v1/complianceRegistrationInquiries.d.ts +84 -10
  35. package/lib/rest/trusthub/v1/complianceRegistrationInquiries.js +92 -28
  36. package/lib/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.d.ts +6 -0
  37. package/lib/rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.js +2 -0
  38. package/lib/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.d.ts +6 -0
  39. package/lib/rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.js +2 -0
  40. package/lib/rest/trusthub/v1/trustProducts.d.ts +16 -16
  41. package/lib/twiml/VoiceResponse.d.ts +2 -2
  42. package/package.json +1 -1
  43. package/lib/rest/Media.d.ts +0 -4
  44. package/lib/rest/media/V1.d.ts +0 -25
  45. package/lib/rest/media/V1.js +0 -51
  46. package/lib/rest/media/v1/mediaProcessor.d.ts +0 -317
  47. package/lib/rest/media/v1/mediaProcessor.js +0 -256
  48. package/lib/rest/media/v1/mediaRecording.d.ts +0 -309
  49. package/lib/rest/media/v1/mediaRecording.js +0 -226
  50. package/lib/rest/media/v1/playerStreamer/playbackGrant.d.ts +0 -151
  51. package/lib/rest/media/v1/playerStreamer/playbackGrant.js +0 -146
  52. package/lib/rest/media/v1/playerStreamer.d.ts +0 -327
  53. package/lib/rest/media/v1/playerStreamer.js +0 -264
@@ -1,51 +0,0 @@
1
- "use strict";
2
- /*
3
- * This code was generated by
4
- * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
- * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
- * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
- *
8
- * Twilio - Media
9
- * This is the public Twilio REST API.
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator.
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- var __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- const Version_1 = __importDefault(require("../../base/Version"));
20
- const mediaProcessor_1 = require("./v1/mediaProcessor");
21
- const mediaRecording_1 = require("./v1/mediaRecording");
22
- const playerStreamer_1 = require("./v1/playerStreamer");
23
- class V1 extends Version_1.default {
24
- /**
25
- * Initialize the V1 version of Media
26
- *
27
- * @param domain - The Twilio (Twilio.Media) domain
28
- */
29
- constructor(domain) {
30
- super(domain, "v1");
31
- }
32
- /** Getter for mediaProcessor resource */
33
- get mediaProcessor() {
34
- this._mediaProcessor =
35
- this._mediaProcessor || (0, mediaProcessor_1.MediaProcessorListInstance)(this);
36
- return this._mediaProcessor;
37
- }
38
- /** Getter for mediaRecording resource */
39
- get mediaRecording() {
40
- this._mediaRecording =
41
- this._mediaRecording || (0, mediaRecording_1.MediaRecordingListInstance)(this);
42
- return this._mediaRecording;
43
- }
44
- /** Getter for playerStreamer resource */
45
- get playerStreamer() {
46
- this._playerStreamer =
47
- this._playerStreamer || (0, playerStreamer_1.PlayerStreamerListInstance)(this);
48
- return this._playerStreamer;
49
- }
50
- }
51
- exports.default = V1;
@@ -1,317 +0,0 @@
1
- /// <reference types="node" />
2
- import { inspect, InspectOptions } from "util";
3
- import Page, { TwilioResponsePayload } from "../../../base/Page";
4
- import Response from "../../../http/response";
5
- import V1 from "../V1";
6
- export type MediaProcessorOrder = "asc" | "desc";
7
- export type MediaProcessorStatus = "failed" | "started" | "ended";
8
- export type MediaProcessorUpdateStatus = "ended";
9
- /**
10
- * Options to pass to update a MediaProcessorInstance
11
- */
12
- export interface MediaProcessorContextUpdateOptions {
13
- /** */
14
- status: MediaProcessorUpdateStatus;
15
- }
16
- /**
17
- * Options to pass to create a MediaProcessorInstance
18
- */
19
- export interface MediaProcessorListInstanceCreateOptions {
20
- /** The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` */
21
- extension: string;
22
- /** The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. */
23
- extensionContext: string;
24
- /** User-defined environment variables for the Media Extension, represented as a JSON dictionary of key/value strings. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about whether you need to provide this. */
25
- extensionEnvironment?: any;
26
- /** The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. */
27
- statusCallback?: string;
28
- /** The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. */
29
- statusCallbackMethod?: string;
30
- /** The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. */
31
- maxDuration?: number;
32
- }
33
- /**
34
- * Options to pass to each
35
- */
36
- export interface MediaProcessorListInstanceEachOptions {
37
- /** The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. */
38
- order?: MediaProcessorOrder;
39
- /** Status to filter by, with possible values `started`, `ended` or `failed`. */
40
- status?: MediaProcessorStatus;
41
- /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
42
- pageSize?: number;
43
- /** Function to process each record. If this and a positional callback are passed, this one will be used */
44
- callback?: (item: MediaProcessorInstance, done: (err?: Error) => void) => void;
45
- /** Function to be called upon completion of streaming */
46
- done?: Function;
47
- /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
48
- limit?: number;
49
- }
50
- /**
51
- * Options to pass to list
52
- */
53
- export interface MediaProcessorListInstanceOptions {
54
- /** The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. */
55
- order?: MediaProcessorOrder;
56
- /** Status to filter by, with possible values `started`, `ended` or `failed`. */
57
- status?: MediaProcessorStatus;
58
- /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
59
- pageSize?: number;
60
- /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
61
- limit?: number;
62
- }
63
- /**
64
- * Options to pass to page
65
- */
66
- export interface MediaProcessorListInstancePageOptions {
67
- /** The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. */
68
- order?: MediaProcessorOrder;
69
- /** Status to filter by, with possible values `started`, `ended` or `failed`. */
70
- status?: MediaProcessorStatus;
71
- /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
72
- pageSize?: number;
73
- /** Page Number, this value is simply for client state */
74
- pageNumber?: number;
75
- /** PageToken provided by the API */
76
- pageToken?: string;
77
- }
78
- export interface MediaProcessorContext {
79
- /**
80
- * Fetch a MediaProcessorInstance
81
- *
82
- * @param callback - Callback to handle processed record
83
- *
84
- * @returns Resolves to processed MediaProcessorInstance
85
- */
86
- fetch(callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
87
- /**
88
- * Update a MediaProcessorInstance
89
- *
90
- * @param params - Parameter for request
91
- * @param callback - Callback to handle processed record
92
- *
93
- * @returns Resolves to processed MediaProcessorInstance
94
- */
95
- update(params: MediaProcessorContextUpdateOptions, callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
96
- /**
97
- * Provide a user-friendly representation
98
- */
99
- toJSON(): any;
100
- [inspect.custom](_depth: any, options: InspectOptions): any;
101
- }
102
- export interface MediaProcessorContextSolution {
103
- sid: string;
104
- }
105
- export declare class MediaProcessorContextImpl implements MediaProcessorContext {
106
- protected _version: V1;
107
- protected _solution: MediaProcessorContextSolution;
108
- protected _uri: string;
109
- constructor(_version: V1, sid: string);
110
- fetch(callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
111
- update(params: MediaProcessorContextUpdateOptions, callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
112
- /**
113
- * Provide a user-friendly representation
114
- *
115
- * @returns Object
116
- */
117
- toJSON(): MediaProcessorContextSolution;
118
- [inspect.custom](_depth: any, options: InspectOptions): string;
119
- }
120
- interface MediaProcessorPayload extends TwilioResponsePayload {
121
- media_processors: MediaProcessorResource[];
122
- }
123
- interface MediaProcessorResource {
124
- account_sid: string;
125
- sid: string;
126
- date_created: Date;
127
- date_updated: Date;
128
- extension: string;
129
- extension_context: string;
130
- status: MediaProcessorStatus;
131
- url: string;
132
- ended_reason: string;
133
- status_callback: string;
134
- status_callback_method: string;
135
- max_duration: number;
136
- }
137
- export declare class MediaProcessorInstance {
138
- protected _version: V1;
139
- protected _solution: MediaProcessorContextSolution;
140
- protected _context?: MediaProcessorContext;
141
- constructor(_version: V1, payload: MediaProcessorResource, sid?: string);
142
- /**
143
- * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaProcessor resource.
144
- */
145
- accountSid: string;
146
- /**
147
- * The unique string generated to identify the MediaProcessor resource.
148
- */
149
- sid: string;
150
- /**
151
- * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
152
- */
153
- dateCreated: Date;
154
- /**
155
- * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
156
- */
157
- dateUpdated: Date;
158
- /**
159
- * The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2`
160
- */
161
- extension: string;
162
- /**
163
- * The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send.
164
- */
165
- extensionContext: string;
166
- status: MediaProcessorStatus;
167
- /**
168
- * The absolute URL of the resource.
169
- */
170
- url: string;
171
- /**
172
- * The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be `null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details.
173
- */
174
- endedReason: string;
175
- /**
176
- * The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details.
177
- */
178
- statusCallback: string;
179
- /**
180
- * The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
181
- */
182
- statusCallbackMethod: string;
183
- /**
184
- * The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming.
185
- */
186
- maxDuration: number;
187
- private get _proxy();
188
- /**
189
- * Fetch a MediaProcessorInstance
190
- *
191
- * @param callback - Callback to handle processed record
192
- *
193
- * @returns Resolves to processed MediaProcessorInstance
194
- */
195
- fetch(callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
196
- /**
197
- * Update a MediaProcessorInstance
198
- *
199
- * @param params - Parameter for request
200
- * @param callback - Callback to handle processed record
201
- *
202
- * @returns Resolves to processed MediaProcessorInstance
203
- */
204
- update(params: MediaProcessorContextUpdateOptions, callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
205
- /**
206
- * Provide a user-friendly representation
207
- *
208
- * @returns Object
209
- */
210
- toJSON(): {
211
- accountSid: string;
212
- sid: string;
213
- dateCreated: Date;
214
- dateUpdated: Date;
215
- extension: string;
216
- extensionContext: string;
217
- status: MediaProcessorStatus;
218
- url: string;
219
- endedReason: string;
220
- statusCallback: string;
221
- statusCallbackMethod: string;
222
- maxDuration: number;
223
- };
224
- [inspect.custom](_depth: any, options: InspectOptions): string;
225
- }
226
- export interface MediaProcessorSolution {
227
- }
228
- export interface MediaProcessorListInstance {
229
- _version: V1;
230
- _solution: MediaProcessorSolution;
231
- _uri: string;
232
- (sid: string): MediaProcessorContext;
233
- get(sid: string): MediaProcessorContext;
234
- /**
235
- * Create a MediaProcessorInstance
236
- *
237
- * @param params - Parameter for request
238
- * @param callback - Callback to handle processed record
239
- *
240
- * @returns Resolves to processed MediaProcessorInstance
241
- */
242
- create(params: MediaProcessorListInstanceCreateOptions, callback?: (error: Error | null, item?: MediaProcessorInstance) => any): Promise<MediaProcessorInstance>;
243
- /**
244
- * Streams MediaProcessorInstance records from the API.
245
- *
246
- * This operation lazily loads records as efficiently as possible until the limit
247
- * is reached.
248
- *
249
- * The results are passed into the callback function, so this operation is memory
250
- * efficient.
251
- *
252
- * If a function is passed as the first argument, it will be used as the callback
253
- * function.
254
- *
255
- * @param { MediaProcessorListInstanceEachOptions } [params] - Options for request
256
- * @param { function } [callback] - Function to process each record
257
- */
258
- each(callback?: (item: MediaProcessorInstance, done: (err?: Error) => void) => void): void;
259
- each(params: MediaProcessorListInstanceEachOptions, callback?: (item: MediaProcessorInstance, done: (err?: Error) => void) => void): void;
260
- /**
261
- * Retrieve a single target page of MediaProcessorInstance records from the API.
262
- *
263
- * The request is executed immediately.
264
- *
265
- * @param { string } [targetUrl] - API-generated URL for the requested results page
266
- * @param { function } [callback] - Callback to handle list of records
267
- */
268
- getPage(targetUrl: string, callback?: (error: Error | null, items: MediaProcessorPage) => any): Promise<MediaProcessorPage>;
269
- /**
270
- * Lists MediaProcessorInstance records from the API as a list.
271
- *
272
- * If a function is passed as the first argument, it will be used as the callback
273
- * function.
274
- *
275
- * @param { MediaProcessorListInstanceOptions } [params] - Options for request
276
- * @param { function } [callback] - Callback to handle list of records
277
- */
278
- list(callback?: (error: Error | null, items: MediaProcessorInstance[]) => any): Promise<MediaProcessorInstance[]>;
279
- list(params: MediaProcessorListInstanceOptions, callback?: (error: Error | null, items: MediaProcessorInstance[]) => any): Promise<MediaProcessorInstance[]>;
280
- /**
281
- * Retrieve a single page of MediaProcessorInstance records from the API.
282
- *
283
- * The request is executed immediately.
284
- *
285
- * If a function is passed as the first argument, it will be used as the callback
286
- * function.
287
- *
288
- * @param { MediaProcessorListInstancePageOptions } [params] - Options for request
289
- * @param { function } [callback] - Callback to handle list of records
290
- */
291
- page(callback?: (error: Error | null, items: MediaProcessorPage) => any): Promise<MediaProcessorPage>;
292
- page(params: MediaProcessorListInstancePageOptions, callback?: (error: Error | null, items: MediaProcessorPage) => any): Promise<MediaProcessorPage>;
293
- /**
294
- * Provide a user-friendly representation
295
- */
296
- toJSON(): any;
297
- [inspect.custom](_depth: any, options: InspectOptions): any;
298
- }
299
- export declare function MediaProcessorListInstance(version: V1): MediaProcessorListInstance;
300
- export declare class MediaProcessorPage extends Page<V1, MediaProcessorPayload, MediaProcessorResource, MediaProcessorInstance> {
301
- /**
302
- * Initialize the MediaProcessorPage
303
- *
304
- * @param version - Version of the resource
305
- * @param response - Response from the API
306
- * @param solution - Path solution
307
- */
308
- constructor(version: V1, response: Response<string>, solution: MediaProcessorSolution);
309
- /**
310
- * Build an instance of MediaProcessorInstance
311
- *
312
- * @param payload - Payload response from the API
313
- */
314
- getInstance(payload: MediaProcessorResource): MediaProcessorInstance;
315
- [inspect.custom](depth: any, options: InspectOptions): string;
316
- }
317
- export {};
@@ -1,256 +0,0 @@
1
- "use strict";
2
- /*
3
- * This code was generated by
4
- * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
- * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
- * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
- *
8
- * Twilio - Media
9
- * This is the public Twilio REST API.
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator.
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- var __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.MediaProcessorPage = exports.MediaProcessorListInstance = exports.MediaProcessorInstance = exports.MediaProcessorContextImpl = void 0;
20
- const util_1 = require("util");
21
- const Page_1 = __importDefault(require("../../../base/Page"));
22
- const deserialize = require("../../../base/deserialize");
23
- const serialize = require("../../../base/serialize");
24
- const utility_1 = require("../../../base/utility");
25
- class MediaProcessorContextImpl {
26
- constructor(_version, sid) {
27
- this._version = _version;
28
- if (!(0, utility_1.isValidPathParam)(sid)) {
29
- throw new Error("Parameter 'sid' is not valid.");
30
- }
31
- this._solution = { sid };
32
- this._uri = `/MediaProcessors/${sid}`;
33
- }
34
- fetch(callback) {
35
- const instance = this;
36
- let operationVersion = instance._version, operationPromise = operationVersion.fetch({
37
- uri: instance._uri,
38
- method: "get",
39
- });
40
- operationPromise = operationPromise.then((payload) => new MediaProcessorInstance(operationVersion, payload, instance._solution.sid));
41
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
42
- return operationPromise;
43
- }
44
- update(params, callback) {
45
- if (params === null || params === undefined) {
46
- throw new Error('Required parameter "params" missing.');
47
- }
48
- if (params["status"] === null || params["status"] === undefined) {
49
- throw new Error("Required parameter \"params['status']\" missing.");
50
- }
51
- let data = {};
52
- data["Status"] = params["status"];
53
- const headers = {};
54
- headers["Content-Type"] = "application/x-www-form-urlencoded";
55
- const instance = this;
56
- let operationVersion = instance._version, operationPromise = operationVersion.update({
57
- uri: instance._uri,
58
- method: "post",
59
- data,
60
- headers,
61
- });
62
- operationPromise = operationPromise.then((payload) => new MediaProcessorInstance(operationVersion, payload, instance._solution.sid));
63
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
64
- return operationPromise;
65
- }
66
- /**
67
- * Provide a user-friendly representation
68
- *
69
- * @returns Object
70
- */
71
- toJSON() {
72
- return this._solution;
73
- }
74
- [util_1.inspect.custom](_depth, options) {
75
- return (0, util_1.inspect)(this.toJSON(), options);
76
- }
77
- }
78
- exports.MediaProcessorContextImpl = MediaProcessorContextImpl;
79
- class MediaProcessorInstance {
80
- constructor(_version, payload, sid) {
81
- this._version = _version;
82
- this.accountSid = payload.account_sid;
83
- this.sid = payload.sid;
84
- this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
85
- this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
86
- this.extension = payload.extension;
87
- this.extensionContext = payload.extension_context;
88
- this.status = payload.status;
89
- this.url = payload.url;
90
- this.endedReason = payload.ended_reason;
91
- this.statusCallback = payload.status_callback;
92
- this.statusCallbackMethod = payload.status_callback_method;
93
- this.maxDuration = deserialize.integer(payload.max_duration);
94
- this._solution = { sid: sid || this.sid };
95
- }
96
- get _proxy() {
97
- this._context =
98
- this._context ||
99
- new MediaProcessorContextImpl(this._version, this._solution.sid);
100
- return this._context;
101
- }
102
- /**
103
- * Fetch a MediaProcessorInstance
104
- *
105
- * @param callback - Callback to handle processed record
106
- *
107
- * @returns Resolves to processed MediaProcessorInstance
108
- */
109
- fetch(callback) {
110
- return this._proxy.fetch(callback);
111
- }
112
- update(params, callback) {
113
- return this._proxy.update(params, callback);
114
- }
115
- /**
116
- * Provide a user-friendly representation
117
- *
118
- * @returns Object
119
- */
120
- toJSON() {
121
- return {
122
- accountSid: this.accountSid,
123
- sid: this.sid,
124
- dateCreated: this.dateCreated,
125
- dateUpdated: this.dateUpdated,
126
- extension: this.extension,
127
- extensionContext: this.extensionContext,
128
- status: this.status,
129
- url: this.url,
130
- endedReason: this.endedReason,
131
- statusCallback: this.statusCallback,
132
- statusCallbackMethod: this.statusCallbackMethod,
133
- maxDuration: this.maxDuration,
134
- };
135
- }
136
- [util_1.inspect.custom](_depth, options) {
137
- return (0, util_1.inspect)(this.toJSON(), options);
138
- }
139
- }
140
- exports.MediaProcessorInstance = MediaProcessorInstance;
141
- function MediaProcessorListInstance(version) {
142
- const instance = ((sid) => instance.get(sid));
143
- instance.get = function get(sid) {
144
- return new MediaProcessorContextImpl(version, sid);
145
- };
146
- instance._version = version;
147
- instance._solution = {};
148
- instance._uri = `/MediaProcessors`;
149
- instance.create = function create(params, callback) {
150
- if (params === null || params === undefined) {
151
- throw new Error('Required parameter "params" missing.');
152
- }
153
- if (params["extension"] === null || params["extension"] === undefined) {
154
- throw new Error("Required parameter \"params['extension']\" missing.");
155
- }
156
- if (params["extensionContext"] === null ||
157
- params["extensionContext"] === undefined) {
158
- throw new Error("Required parameter \"params['extensionContext']\" missing.");
159
- }
160
- let data = {};
161
- data["Extension"] = params["extension"];
162
- data["ExtensionContext"] = params["extensionContext"];
163
- if (params["extensionEnvironment"] !== undefined)
164
- data["ExtensionEnvironment"] = serialize.object(params["extensionEnvironment"]);
165
- if (params["statusCallback"] !== undefined)
166
- data["StatusCallback"] = params["statusCallback"];
167
- if (params["statusCallbackMethod"] !== undefined)
168
- data["StatusCallbackMethod"] = params["statusCallbackMethod"];
169
- if (params["maxDuration"] !== undefined)
170
- data["MaxDuration"] = params["maxDuration"];
171
- const headers = {};
172
- headers["Content-Type"] = "application/x-www-form-urlencoded";
173
- let operationVersion = version, operationPromise = operationVersion.create({
174
- uri: instance._uri,
175
- method: "post",
176
- data,
177
- headers,
178
- });
179
- operationPromise = operationPromise.then((payload) => new MediaProcessorInstance(operationVersion, payload));
180
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
181
- return operationPromise;
182
- };
183
- instance.page = function page(params, callback) {
184
- if (params instanceof Function) {
185
- callback = params;
186
- params = {};
187
- }
188
- else {
189
- params = params || {};
190
- }
191
- let data = {};
192
- if (params["order"] !== undefined)
193
- data["Order"] = params["order"];
194
- if (params["status"] !== undefined)
195
- data["Status"] = params["status"];
196
- if (params["pageSize"] !== undefined)
197
- data["PageSize"] = params["pageSize"];
198
- if (params.pageNumber !== undefined)
199
- data["Page"] = params.pageNumber;
200
- if (params.pageToken !== undefined)
201
- data["PageToken"] = params.pageToken;
202
- const headers = {};
203
- let operationVersion = version, operationPromise = operationVersion.page({
204
- uri: instance._uri,
205
- method: "get",
206
- params: data,
207
- headers,
208
- });
209
- operationPromise = operationPromise.then((payload) => new MediaProcessorPage(operationVersion, payload, instance._solution));
210
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
211
- return operationPromise;
212
- };
213
- instance.each = instance._version.each;
214
- instance.list = instance._version.list;
215
- instance.getPage = function getPage(targetUrl, callback) {
216
- const operationPromise = instance._version._domain.twilio.request({
217
- method: "get",
218
- uri: targetUrl,
219
- });
220
- let pagePromise = operationPromise.then((payload) => new MediaProcessorPage(instance._version, payload, instance._solution));
221
- pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
222
- return pagePromise;
223
- };
224
- instance.toJSON = function toJSON() {
225
- return instance._solution;
226
- };
227
- instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
228
- return (0, util_1.inspect)(instance.toJSON(), options);
229
- };
230
- return instance;
231
- }
232
- exports.MediaProcessorListInstance = MediaProcessorListInstance;
233
- class MediaProcessorPage extends Page_1.default {
234
- /**
235
- * Initialize the MediaProcessorPage
236
- *
237
- * @param version - Version of the resource
238
- * @param response - Response from the API
239
- * @param solution - Path solution
240
- */
241
- constructor(version, response, solution) {
242
- super(version, response, solution);
243
- }
244
- /**
245
- * Build an instance of MediaProcessorInstance
246
- *
247
- * @param payload - Payload response from the API
248
- */
249
- getInstance(payload) {
250
- return new MediaProcessorInstance(this._version, payload);
251
- }
252
- [util_1.inspect.custom](depth, options) {
253
- return (0, util_1.inspect)(this.toJSON(), options);
254
- }
255
- }
256
- exports.MediaProcessorPage = MediaProcessorPage;