twilio 3.83.2 → 3.83.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/LICENSE +1 -1
- package/lib/rest/Content.d.ts +26 -0
- package/lib/rest/Content.js +54 -0
- package/lib/rest/Twilio.d.ts +2 -0
- package/lib/rest/Twilio.js +14 -0
- package/lib/rest/content/V1.d.ts +25 -0
- package/lib/rest/content/V1.js +46 -0
- package/lib/rest/content/v1/content.d.ts +322 -0
- package/lib/rest/content/v1/content.js +668 -0
- package/lib/rest/flexApi/v1/goodData.d.ts +2 -0
- package/lib/rest/flexApi/v1/goodData.js +2 -0
- package/lib/rest/insights/v1/call/summary.d.ts +5 -1
- package/lib/rest/insights/v1/call/summary.js +2 -0
- package/lib/rest/insights/v1/callSummaries.d.ts +5 -1
- package/lib/rest/insights/v1/callSummaries.js +2 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (C)
|
|
3
|
+
Copyright (C) 2022, Twilio, Inc. <help@twilio.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by
|
|
3
|
+
* \ / _ _ _| _ _
|
|
4
|
+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
* / /
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import Domain = require('../base/Domain');
|
|
9
|
+
import Twilio = require('./Twilio');
|
|
10
|
+
import V1 = require('./content/V1');
|
|
11
|
+
import { ContentListInstance } from './content/v1/content';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
declare class Content extends Domain {
|
|
15
|
+
/**
|
|
16
|
+
* Initialize content domain
|
|
17
|
+
*
|
|
18
|
+
* @param twilio - The twilio client
|
|
19
|
+
*/
|
|
20
|
+
constructor(twilio: Twilio);
|
|
21
|
+
|
|
22
|
+
readonly contents: ContentListInstance;
|
|
23
|
+
readonly v1: V1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export = Content;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 _ = require('lodash'); /* jshint ignore:line */
|
|
13
|
+
var Domain = require('../base/Domain'); /* jshint ignore:line */
|
|
14
|
+
var V1 = require('./content/V1'); /* jshint ignore:line */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* jshint ignore:start */
|
|
18
|
+
/**
|
|
19
|
+
* Initialize content domain
|
|
20
|
+
*
|
|
21
|
+
* @constructor Twilio.Content
|
|
22
|
+
*
|
|
23
|
+
* @property {Twilio.Content.V1} v1 - v1 version
|
|
24
|
+
* @property {Twilio.Content.V1.ContentList} contents - contents resource
|
|
25
|
+
*
|
|
26
|
+
* @param {Twilio} twilio - The twilio client
|
|
27
|
+
*/
|
|
28
|
+
/* jshint ignore:end */
|
|
29
|
+
function Content(twilio) {
|
|
30
|
+
Domain.prototype.constructor.call(this, twilio, 'https://content.twilio.com');
|
|
31
|
+
|
|
32
|
+
// Versions
|
|
33
|
+
this._v1 = undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_.extend(Content.prototype, Domain.prototype);
|
|
37
|
+
Content.prototype.constructor = Content;
|
|
38
|
+
|
|
39
|
+
Object.defineProperty(Content.prototype,
|
|
40
|
+
'v1', {
|
|
41
|
+
get: function() {
|
|
42
|
+
this._v1 = this._v1 || new V1(this);
|
|
43
|
+
return this._v1;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
Object.defineProperty(Content.prototype,
|
|
48
|
+
'contents', {
|
|
49
|
+
get: function() {
|
|
50
|
+
return this.v1.contents;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
module.exports = Content;
|
package/lib/rest/Twilio.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import Api = require('./Api');
|
|
|
10
10
|
import Autopilot = require('./Autopilot');
|
|
11
11
|
import Bulkexports = require('./Bulkexports');
|
|
12
12
|
import Chat = require('./Chat');
|
|
13
|
+
import Content = require('./Content');
|
|
13
14
|
import Conversations = require('./Conversations');
|
|
14
15
|
import Events = require('./Events');
|
|
15
16
|
import FlexApi = require('./FlexApi');
|
|
@@ -64,6 +65,7 @@ declare class Twilio {
|
|
|
64
65
|
chat: Chat;
|
|
65
66
|
conferences: (typeof Api.prototype.account.conferences);
|
|
66
67
|
connectApps: (typeof Api.prototype.account.connectApps);
|
|
68
|
+
content: Content;
|
|
67
69
|
conversations: Conversations;
|
|
68
70
|
events: Events;
|
|
69
71
|
flexApi: FlexApi;
|
package/lib/rest/Twilio.js
CHANGED
|
@@ -26,6 +26,7 @@ var RestException = require('../base/RestException'); /* jshint ignore:line */
|
|
|
26
26
|
* @property {Twilio.Api} api - api domain
|
|
27
27
|
* @property {Twilio.Autopilot} autopilot - autopilot domain
|
|
28
28
|
* @property {Twilio.Chat} chat - chat domain
|
|
29
|
+
* @property {Twilio.Content} content - content domain
|
|
29
30
|
* @property {Twilio.Conversations} conversations - conversations domain
|
|
30
31
|
* @property {Twilio.Events} events - events domain
|
|
31
32
|
* @property {Twilio.FlexApi} flexApi - flex_api domain
|
|
@@ -154,6 +155,7 @@ function Twilio(username, password, opts) {
|
|
|
154
155
|
this._api = undefined;
|
|
155
156
|
this._autopilot = undefined;
|
|
156
157
|
this._chat = undefined;
|
|
158
|
+
this._content = undefined;
|
|
157
159
|
this._conversations = undefined;
|
|
158
160
|
this._events = undefined;
|
|
159
161
|
this._flexApi = undefined;
|
|
@@ -190,6 +192,7 @@ function Twilio(username, password, opts) {
|
|
|
190
192
|
this.api;
|
|
191
193
|
this.autopilot;
|
|
192
194
|
this.chat;
|
|
195
|
+
this.content;
|
|
193
196
|
this.conversations;
|
|
194
197
|
this.events;
|
|
195
198
|
this.flexApi;
|
|
@@ -412,6 +415,17 @@ Object.defineProperty(Twilio.prototype,
|
|
|
412
415
|
}
|
|
413
416
|
});
|
|
414
417
|
|
|
418
|
+
Object.defineProperty(Twilio.prototype,
|
|
419
|
+
'content', {
|
|
420
|
+
get: function() {
|
|
421
|
+
if (!this._content) {
|
|
422
|
+
var Content = require('./Content'); /* jshint ignore:line */
|
|
423
|
+
this._content = new Content(this);
|
|
424
|
+
}
|
|
425
|
+
return this._content;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
|
|
415
429
|
Object.defineProperty(Twilio.prototype,
|
|
416
430
|
'conversations', {
|
|
417
431
|
get: function() {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by
|
|
3
|
+
* \ / _ _ _| _ _
|
|
4
|
+
* | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
* / /
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import Content = require('../Content');
|
|
9
|
+
import Version = require('../../base/Version');
|
|
10
|
+
import { ContentList } from './v1/content';
|
|
11
|
+
import { ContentListInstance } from './v1/content';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
declare class V1 extends Version {
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the V1 version of Content
|
|
17
|
+
*
|
|
18
|
+
* @param domain - The twilio domain
|
|
19
|
+
*/
|
|
20
|
+
constructor(domain: Content);
|
|
21
|
+
|
|
22
|
+
readonly contents: ContentListInstance;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export = V1;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 _ = require('lodash'); /* jshint ignore:line */
|
|
13
|
+
var ContentList = require('./v1/content').ContentList;
|
|
14
|
+
var Version = require('../../base/Version'); /* jshint ignore:line */
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* jshint ignore:start */
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the V1 version of Content
|
|
20
|
+
*
|
|
21
|
+
* @constructor Twilio.Content.V1
|
|
22
|
+
*
|
|
23
|
+
* @property {Twilio.Content.V1.ContentList} contents - contents resource
|
|
24
|
+
*
|
|
25
|
+
* @param {Twilio.Content} domain - The twilio domain
|
|
26
|
+
*/
|
|
27
|
+
/* jshint ignore:end */
|
|
28
|
+
function V1(domain) {
|
|
29
|
+
Version.prototype.constructor.call(this, domain, 'v1');
|
|
30
|
+
|
|
31
|
+
// Resources
|
|
32
|
+
this._contents = undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_.extend(V1.prototype, Version.prototype);
|
|
36
|
+
V1.prototype.constructor = V1;
|
|
37
|
+
|
|
38
|
+
Object.defineProperty(V1.prototype,
|
|
39
|
+
'contents', {
|
|
40
|
+
get: function() {
|
|
41
|
+
this._contents = this._contents || new ContentList(this);
|
|
42
|
+
return this._contents;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
module.exports = V1;
|
|
@@ -0,0 +1,322 @@
|
|
|
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 ContentList
|
|
15
|
+
*
|
|
16
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
17
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
18
|
+
* access, please contact help@twilio.com.
|
|
19
|
+
*
|
|
20
|
+
* @param version - Version of the resource
|
|
21
|
+
*/
|
|
22
|
+
declare function ContentList(version: V1): ContentListInstance;
|
|
23
|
+
|
|
24
|
+
interface ContentListInstance {
|
|
25
|
+
/**
|
|
26
|
+
* @param sid - sid of instance
|
|
27
|
+
*/
|
|
28
|
+
(sid: string): ContentContext;
|
|
29
|
+
/**
|
|
30
|
+
* create a ContentInstance
|
|
31
|
+
*
|
|
32
|
+
* @param callback - Callback to handle processed record
|
|
33
|
+
*/
|
|
34
|
+
create(callback?: (error: Error | null, item: ContentInstance) => any): Promise<ContentInstance>;
|
|
35
|
+
/**
|
|
36
|
+
* Streams ContentInstance records from the API.
|
|
37
|
+
*
|
|
38
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
39
|
+
* is reached.
|
|
40
|
+
*
|
|
41
|
+
* The results are passed into the callback function, so this operation is memory
|
|
42
|
+
* efficient.
|
|
43
|
+
*
|
|
44
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
45
|
+
* function.
|
|
46
|
+
*
|
|
47
|
+
* @param callback - Function to process each record
|
|
48
|
+
*/
|
|
49
|
+
each(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Streams ContentInstance records from the API.
|
|
52
|
+
*
|
|
53
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
54
|
+
* is reached.
|
|
55
|
+
*
|
|
56
|
+
* The results are passed into the callback function, so this operation is memory
|
|
57
|
+
* efficient.
|
|
58
|
+
*
|
|
59
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
60
|
+
* function.
|
|
61
|
+
*
|
|
62
|
+
* @param opts - Options for request
|
|
63
|
+
* @param callback - Function to process each record
|
|
64
|
+
*/
|
|
65
|
+
each(opts?: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* Constructs a content
|
|
68
|
+
*
|
|
69
|
+
* @param sid - The unique string that identifies the resource
|
|
70
|
+
*/
|
|
71
|
+
get(sid: string): ContentContext;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve a single target page of ContentInstance records from the API.
|
|
74
|
+
*
|
|
75
|
+
* The request is executed immediately.
|
|
76
|
+
*
|
|
77
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
78
|
+
* function.
|
|
79
|
+
*
|
|
80
|
+
* @param callback - Callback to handle list of records
|
|
81
|
+
*/
|
|
82
|
+
getPage(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
|
|
83
|
+
/**
|
|
84
|
+
* Retrieve a single target page of ContentInstance records from the API.
|
|
85
|
+
*
|
|
86
|
+
* The request is executed immediately.
|
|
87
|
+
*
|
|
88
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
89
|
+
* function.
|
|
90
|
+
*
|
|
91
|
+
* @param targetUrl - API-generated URL for the requested results page
|
|
92
|
+
* @param callback - Callback to handle list of records
|
|
93
|
+
*/
|
|
94
|
+
getPage(targetUrl?: string, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
|
|
95
|
+
/**
|
|
96
|
+
* Lists ContentInstance records from the API as a list.
|
|
97
|
+
*
|
|
98
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
99
|
+
* function.
|
|
100
|
+
*
|
|
101
|
+
* @param callback - Callback to handle list of records
|
|
102
|
+
*/
|
|
103
|
+
list(callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Lists ContentInstance records from the API as a list.
|
|
106
|
+
*
|
|
107
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
108
|
+
* function.
|
|
109
|
+
*
|
|
110
|
+
* @param opts - Options for request
|
|
111
|
+
* @param callback - Callback to handle list of records
|
|
112
|
+
*/
|
|
113
|
+
list(opts?: ContentListInstanceOptions, callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Retrieve a single page of ContentInstance records from the API.
|
|
116
|
+
*
|
|
117
|
+
* The request is executed immediately.
|
|
118
|
+
*
|
|
119
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
120
|
+
* function.
|
|
121
|
+
*
|
|
122
|
+
* @param callback - Callback to handle list of records
|
|
123
|
+
*/
|
|
124
|
+
page(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
|
|
125
|
+
/**
|
|
126
|
+
* Retrieve a single page of ContentInstance records from the API.
|
|
127
|
+
*
|
|
128
|
+
* The request is executed immediately.
|
|
129
|
+
*
|
|
130
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
131
|
+
* function.
|
|
132
|
+
*
|
|
133
|
+
* @param opts - Options for request
|
|
134
|
+
* @param callback - Callback to handle list of records
|
|
135
|
+
*/
|
|
136
|
+
page(opts?: ContentListInstancePageOptions, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>;
|
|
137
|
+
/**
|
|
138
|
+
* Provide a user-friendly representation
|
|
139
|
+
*/
|
|
140
|
+
toJSON(): any;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Options to pass to each
|
|
145
|
+
*
|
|
146
|
+
* @property callback -
|
|
147
|
+
* Function to process each record. If this and a positional
|
|
148
|
+
* callback are passed, this one will be used
|
|
149
|
+
* @property done - Function to be called upon completion of streaming
|
|
150
|
+
* @property limit -
|
|
151
|
+
* Upper limit for the number of records to return.
|
|
152
|
+
* each() guarantees never to return more than limit.
|
|
153
|
+
* Default is no limit
|
|
154
|
+
* @property pageSize -
|
|
155
|
+
* Number of records to fetch per request,
|
|
156
|
+
* when not set will use the default value of 50 records.
|
|
157
|
+
* If no pageSize is defined but a limit is defined,
|
|
158
|
+
* each() will attempt to read the limit with the most efficient
|
|
159
|
+
* page size, i.e. min(limit, 1000)
|
|
160
|
+
*/
|
|
161
|
+
interface ContentListInstanceEachOptions {
|
|
162
|
+
callback?: (item: ContentInstance, done: (err?: Error) => void) => void;
|
|
163
|
+
done?: Function;
|
|
164
|
+
limit?: number;
|
|
165
|
+
pageSize?: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Options to pass to list
|
|
170
|
+
*
|
|
171
|
+
* @property limit -
|
|
172
|
+
* Upper limit for the number of records to return.
|
|
173
|
+
* list() guarantees never to return more than limit.
|
|
174
|
+
* Default is no limit
|
|
175
|
+
* @property pageSize -
|
|
176
|
+
* Number of records to fetch per request,
|
|
177
|
+
* when not set will use the default value of 50 records.
|
|
178
|
+
* If no page_size is defined but a limit is defined,
|
|
179
|
+
* list() will attempt to read the limit with the most
|
|
180
|
+
* efficient page size, i.e. min(limit, 1000)
|
|
181
|
+
*/
|
|
182
|
+
interface ContentListInstanceOptions {
|
|
183
|
+
limit?: number;
|
|
184
|
+
pageSize?: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Options to pass to page
|
|
189
|
+
*
|
|
190
|
+
* @property pageNumber - Page Number, this value is simply for client state
|
|
191
|
+
* @property pageSize - Number of records to return, defaults to 50
|
|
192
|
+
* @property pageToken - PageToken provided by the API
|
|
193
|
+
*/
|
|
194
|
+
interface ContentListInstancePageOptions {
|
|
195
|
+
pageNumber?: number;
|
|
196
|
+
pageSize?: number;
|
|
197
|
+
pageToken?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface ContentPayload extends ContentResource, Page.TwilioResponsePayload {
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface ContentResource {
|
|
204
|
+
account_sid: string;
|
|
205
|
+
date_created: Date;
|
|
206
|
+
date_updated: Date;
|
|
207
|
+
friendly_name: string;
|
|
208
|
+
language: string;
|
|
209
|
+
links: string;
|
|
210
|
+
sid: string;
|
|
211
|
+
types: object;
|
|
212
|
+
url: string;
|
|
213
|
+
variables: object;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface ContentSolution {
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
declare class ContentContext {
|
|
221
|
+
/**
|
|
222
|
+
* Initialize the ContentContext
|
|
223
|
+
*
|
|
224
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
225
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
226
|
+
* access, please contact help@twilio.com.
|
|
227
|
+
*
|
|
228
|
+
* @param version - Version of the resource
|
|
229
|
+
* @param sid - The unique string that identifies the resource
|
|
230
|
+
*/
|
|
231
|
+
constructor(version: V1, sid: string);
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* fetch a ContentInstance
|
|
235
|
+
*
|
|
236
|
+
* @param callback - Callback to handle processed record
|
|
237
|
+
*/
|
|
238
|
+
fetch(callback?: (error: Error | null, items: ContentInstance) => any): Promise<ContentInstance>;
|
|
239
|
+
/**
|
|
240
|
+
* remove a ContentInstance
|
|
241
|
+
*
|
|
242
|
+
* @param callback - Callback to handle processed record
|
|
243
|
+
*/
|
|
244
|
+
remove(callback?: (error: Error | null, items: ContentInstance) => any): Promise<boolean>;
|
|
245
|
+
/**
|
|
246
|
+
* Provide a user-friendly representation
|
|
247
|
+
*/
|
|
248
|
+
toJSON(): any;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
declare class ContentInstance extends SerializableClass {
|
|
253
|
+
/**
|
|
254
|
+
* Initialize the ContentContext
|
|
255
|
+
*
|
|
256
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
257
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
258
|
+
* access, please contact help@twilio.com.
|
|
259
|
+
*
|
|
260
|
+
* @param version - Version of the resource
|
|
261
|
+
* @param payload - The instance payload
|
|
262
|
+
* @param sid - The unique string that identifies the resource
|
|
263
|
+
*/
|
|
264
|
+
constructor(version: V1, payload: ContentPayload, sid: string);
|
|
265
|
+
|
|
266
|
+
private _proxy: ContentContext;
|
|
267
|
+
accountSid: string;
|
|
268
|
+
dateCreated: Date;
|
|
269
|
+
dateUpdated: Date;
|
|
270
|
+
/**
|
|
271
|
+
* fetch a ContentInstance
|
|
272
|
+
*
|
|
273
|
+
* @param callback - Callback to handle processed record
|
|
274
|
+
*/
|
|
275
|
+
fetch(callback?: (error: Error | null, items: ContentInstance) => any): Promise<ContentInstance>;
|
|
276
|
+
friendlyName: string;
|
|
277
|
+
language: string;
|
|
278
|
+
links: string;
|
|
279
|
+
/**
|
|
280
|
+
* remove a ContentInstance
|
|
281
|
+
*
|
|
282
|
+
* @param callback - Callback to handle processed record
|
|
283
|
+
*/
|
|
284
|
+
remove(callback?: (error: Error | null, items: ContentInstance) => any): Promise<boolean>;
|
|
285
|
+
sid: string;
|
|
286
|
+
/**
|
|
287
|
+
* Provide a user-friendly representation
|
|
288
|
+
*/
|
|
289
|
+
toJSON(): any;
|
|
290
|
+
types: any;
|
|
291
|
+
url: string;
|
|
292
|
+
variables: any;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
declare class ContentPage extends Page<V1, ContentPayload, ContentResource, ContentInstance> {
|
|
297
|
+
/**
|
|
298
|
+
* Initialize the ContentPage
|
|
299
|
+
*
|
|
300
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
301
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
302
|
+
* access, please contact help@twilio.com.
|
|
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: ContentSolution);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Build an instance of ContentInstance
|
|
312
|
+
*
|
|
313
|
+
* @param payload - Payload response from the API
|
|
314
|
+
*/
|
|
315
|
+
getInstance(payload: ContentPayload): ContentInstance;
|
|
316
|
+
/**
|
|
317
|
+
* Provide a user-friendly representation
|
|
318
|
+
*/
|
|
319
|
+
toJSON(): any;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export { ContentContext, ContentInstance, ContentList, ContentListInstance, ContentListInstanceEachOptions, ContentListInstanceOptions, ContentListInstancePageOptions, ContentPage, ContentPayload, ContentResource, ContentSolution }
|
|
@@ -0,0 +1,668 @@
|
|
|
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 ContentList;
|
|
21
|
+
var ContentPage;
|
|
22
|
+
var ContentInstance;
|
|
23
|
+
var ContentContext;
|
|
24
|
+
|
|
25
|
+
/* jshint ignore:start */
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the ContentList
|
|
28
|
+
*
|
|
29
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
30
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
31
|
+
* access, please contact help@twilio.com.
|
|
32
|
+
*
|
|
33
|
+
* @constructor Twilio.Content.V1.ContentList
|
|
34
|
+
*
|
|
35
|
+
* @param {Twilio.Content.V1} version - Version of the resource
|
|
36
|
+
*/
|
|
37
|
+
/* jshint ignore:end */
|
|
38
|
+
ContentList = function ContentList(version) {
|
|
39
|
+
/* jshint ignore:start */
|
|
40
|
+
/**
|
|
41
|
+
* @function contents
|
|
42
|
+
* @memberof Twilio.Content.V1#
|
|
43
|
+
*
|
|
44
|
+
* @param {string} sid - sid of instance
|
|
45
|
+
*
|
|
46
|
+
* @returns {Twilio.Content.V1.ContentContext}
|
|
47
|
+
*/
|
|
48
|
+
/* jshint ignore:end */
|
|
49
|
+
function ContentListInstance(sid) {
|
|
50
|
+
return ContentListInstance.get(sid);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ContentListInstance._version = version;
|
|
54
|
+
// Path Solution
|
|
55
|
+
ContentListInstance._solution = {};
|
|
56
|
+
ContentListInstance._uri = `/Content`;
|
|
57
|
+
/* jshint ignore:start */
|
|
58
|
+
/**
|
|
59
|
+
* create a ContentInstance
|
|
60
|
+
*
|
|
61
|
+
* @function create
|
|
62
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
63
|
+
*
|
|
64
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
65
|
+
*
|
|
66
|
+
* @returns {Promise} Resolves to processed ContentInstance
|
|
67
|
+
*/
|
|
68
|
+
/* jshint ignore:end */
|
|
69
|
+
ContentListInstance.create = function create(callback) {
|
|
70
|
+
var deferred = Q.defer();
|
|
71
|
+
var promise = this._version.create({uri: this._uri, method: 'POST'});
|
|
72
|
+
|
|
73
|
+
promise = promise.then(function(payload) {
|
|
74
|
+
deferred.resolve(new ContentInstance(this._version, payload, this._solution.sid));
|
|
75
|
+
}.bind(this));
|
|
76
|
+
|
|
77
|
+
promise.catch(function(error) {
|
|
78
|
+
deferred.reject(error);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (_.isFunction(callback)) {
|
|
82
|
+
deferred.promise.nodeify(callback);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return deferred.promise;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/* jshint ignore:start */
|
|
89
|
+
/**
|
|
90
|
+
* Streams ContentInstance records from the API.
|
|
91
|
+
*
|
|
92
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
93
|
+
* is reached.
|
|
94
|
+
*
|
|
95
|
+
* The results are passed into the callback function, so this operation is memory
|
|
96
|
+
* efficient.
|
|
97
|
+
*
|
|
98
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
99
|
+
* function.
|
|
100
|
+
*
|
|
101
|
+
* @function each
|
|
102
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
103
|
+
*
|
|
104
|
+
* @param {object} [opts] - Options for request
|
|
105
|
+
* @param {number} [opts.limit] -
|
|
106
|
+
* Upper limit for the number of records to return.
|
|
107
|
+
* each() guarantees never to return more than limit.
|
|
108
|
+
* Default is no limit
|
|
109
|
+
* @param {number} [opts.pageSize] -
|
|
110
|
+
* Number of records to fetch per request,
|
|
111
|
+
* when not set will use the default value of 50 records.
|
|
112
|
+
* If no pageSize is defined but a limit is defined,
|
|
113
|
+
* each() will attempt to read the limit with the most efficient
|
|
114
|
+
* page size, i.e. min(limit, 1000)
|
|
115
|
+
* @param {Function} [opts.callback] -
|
|
116
|
+
* Function to process each record. If this and a positional
|
|
117
|
+
* callback are passed, this one will be used
|
|
118
|
+
* @param {Function} [opts.done] -
|
|
119
|
+
* Function to be called upon completion of streaming
|
|
120
|
+
* @param {Function} [callback] - Function to process each record
|
|
121
|
+
*/
|
|
122
|
+
/* jshint ignore:end */
|
|
123
|
+
ContentListInstance.each = function each(opts, callback) {
|
|
124
|
+
if (_.isFunction(opts)) {
|
|
125
|
+
callback = opts;
|
|
126
|
+
opts = {};
|
|
127
|
+
}
|
|
128
|
+
opts = opts || {};
|
|
129
|
+
if (opts.callback) {
|
|
130
|
+
callback = opts.callback;
|
|
131
|
+
}
|
|
132
|
+
if (_.isUndefined(callback)) {
|
|
133
|
+
throw new Error('Callback function must be provided');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var done = false;
|
|
137
|
+
var currentPage = 1;
|
|
138
|
+
var currentResource = 0;
|
|
139
|
+
var limits = this._version.readLimits({
|
|
140
|
+
limit: opts.limit,
|
|
141
|
+
pageSize: opts.pageSize
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
function onComplete(error) {
|
|
145
|
+
done = true;
|
|
146
|
+
if (_.isFunction(opts.done)) {
|
|
147
|
+
opts.done(error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function fetchNextPage(fn) {
|
|
152
|
+
var promise = fn();
|
|
153
|
+
if (_.isUndefined(promise)) {
|
|
154
|
+
onComplete();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
promise.then(function(page) {
|
|
159
|
+
_.each(page.instances, function(instance) {
|
|
160
|
+
if (done || (!_.isUndefined(opts.limit) && currentResource >= opts.limit)) {
|
|
161
|
+
done = true;
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
currentResource++;
|
|
166
|
+
callback(instance, onComplete);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
if (!done) {
|
|
170
|
+
currentPage++;
|
|
171
|
+
fetchNextPage(_.bind(page.nextPage, page));
|
|
172
|
+
} else {
|
|
173
|
+
onComplete();
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
promise.catch(onComplete);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
fetchNextPage(_.bind(this.page, this, _.merge(opts, limits)));
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/* jshint ignore:start */
|
|
184
|
+
/**
|
|
185
|
+
* Lists ContentInstance records from the API as a list.
|
|
186
|
+
*
|
|
187
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
188
|
+
* function.
|
|
189
|
+
*
|
|
190
|
+
* @function list
|
|
191
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
192
|
+
*
|
|
193
|
+
* @param {object} [opts] - Options for request
|
|
194
|
+
* @param {number} [opts.limit] -
|
|
195
|
+
* Upper limit for the number of records to return.
|
|
196
|
+
* list() guarantees never to return more than limit.
|
|
197
|
+
* Default is no limit
|
|
198
|
+
* @param {number} [opts.pageSize] -
|
|
199
|
+
* Number of records to fetch per request,
|
|
200
|
+
* when not set will use the default value of 50 records.
|
|
201
|
+
* If no page_size is defined but a limit is defined,
|
|
202
|
+
* list() will attempt to read the limit with the most
|
|
203
|
+
* efficient page size, i.e. min(limit, 1000)
|
|
204
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
205
|
+
*
|
|
206
|
+
* @returns {Promise} Resolves to a list of records
|
|
207
|
+
*/
|
|
208
|
+
/* jshint ignore:end */
|
|
209
|
+
ContentListInstance.list = function list(opts, callback) {
|
|
210
|
+
if (_.isFunction(opts)) {
|
|
211
|
+
callback = opts;
|
|
212
|
+
opts = {};
|
|
213
|
+
}
|
|
214
|
+
opts = opts || {};
|
|
215
|
+
var deferred = Q.defer();
|
|
216
|
+
var allResources = [];
|
|
217
|
+
opts.callback = function(resource, done) {
|
|
218
|
+
allResources.push(resource);
|
|
219
|
+
|
|
220
|
+
if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
|
|
221
|
+
done();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
opts.done = function(error) {
|
|
226
|
+
if (_.isUndefined(error)) {
|
|
227
|
+
deferred.resolve(allResources);
|
|
228
|
+
} else {
|
|
229
|
+
deferred.reject(error);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
if (_.isFunction(callback)) {
|
|
234
|
+
deferred.promise.nodeify(callback);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
this.each(opts);
|
|
238
|
+
return deferred.promise;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/* jshint ignore:start */
|
|
242
|
+
/**
|
|
243
|
+
* Retrieve a single page of ContentInstance records from the API.
|
|
244
|
+
*
|
|
245
|
+
* The request is executed immediately.
|
|
246
|
+
*
|
|
247
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
248
|
+
* function.
|
|
249
|
+
*
|
|
250
|
+
* @function page
|
|
251
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
252
|
+
*
|
|
253
|
+
* @param {object} [opts] - Options for request
|
|
254
|
+
* @param {string} [opts.pageToken] - PageToken provided by the API
|
|
255
|
+
* @param {number} [opts.pageNumber] -
|
|
256
|
+
* Page Number, this value is simply for client state
|
|
257
|
+
* @param {number} [opts.pageSize] - Number of records to return, defaults to 50
|
|
258
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
259
|
+
*
|
|
260
|
+
* @returns {Promise} Resolves to a list of records
|
|
261
|
+
*/
|
|
262
|
+
/* jshint ignore:end */
|
|
263
|
+
ContentListInstance.page = function page(opts, callback) {
|
|
264
|
+
if (_.isFunction(opts)) {
|
|
265
|
+
callback = opts;
|
|
266
|
+
opts = {};
|
|
267
|
+
}
|
|
268
|
+
opts = opts || {};
|
|
269
|
+
|
|
270
|
+
var deferred = Q.defer();
|
|
271
|
+
var data = values.of({
|
|
272
|
+
'PageToken': opts.pageToken,
|
|
273
|
+
'Page': opts.pageNumber,
|
|
274
|
+
'PageSize': opts.pageSize
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
var promise = this._version.page({uri: this._uri, method: 'GET', params: data});
|
|
278
|
+
|
|
279
|
+
promise = promise.then(function(payload) {
|
|
280
|
+
deferred.resolve(new ContentPage(this._version, payload, this._solution));
|
|
281
|
+
}.bind(this));
|
|
282
|
+
|
|
283
|
+
promise.catch(function(error) {
|
|
284
|
+
deferred.reject(error);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
if (_.isFunction(callback)) {
|
|
288
|
+
deferred.promise.nodeify(callback);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return deferred.promise;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/* jshint ignore:start */
|
|
295
|
+
/**
|
|
296
|
+
* Retrieve a single target page of ContentInstance records from the API.
|
|
297
|
+
*
|
|
298
|
+
* The request is executed immediately.
|
|
299
|
+
*
|
|
300
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
301
|
+
* function.
|
|
302
|
+
*
|
|
303
|
+
* @function getPage
|
|
304
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
305
|
+
*
|
|
306
|
+
* @param {string} [targetUrl] - API-generated URL for the requested results page
|
|
307
|
+
* @param {function} [callback] - Callback to handle list of records
|
|
308
|
+
*
|
|
309
|
+
* @returns {Promise} Resolves to a list of records
|
|
310
|
+
*/
|
|
311
|
+
/* jshint ignore:end */
|
|
312
|
+
ContentListInstance.getPage = function getPage(targetUrl, callback) {
|
|
313
|
+
var deferred = Q.defer();
|
|
314
|
+
|
|
315
|
+
var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl});
|
|
316
|
+
|
|
317
|
+
promise = promise.then(function(payload) {
|
|
318
|
+
deferred.resolve(new ContentPage(this._version, payload, this._solution));
|
|
319
|
+
}.bind(this));
|
|
320
|
+
|
|
321
|
+
promise.catch(function(error) {
|
|
322
|
+
deferred.reject(error);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
if (_.isFunction(callback)) {
|
|
326
|
+
deferred.promise.nodeify(callback);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return deferred.promise;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/* jshint ignore:start */
|
|
333
|
+
/**
|
|
334
|
+
* Constructs a content
|
|
335
|
+
*
|
|
336
|
+
* @function get
|
|
337
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
338
|
+
*
|
|
339
|
+
* @param {string} sid - The unique string that identifies the resource
|
|
340
|
+
*
|
|
341
|
+
* @returns {Twilio.Content.V1.ContentContext}
|
|
342
|
+
*/
|
|
343
|
+
/* jshint ignore:end */
|
|
344
|
+
ContentListInstance.get = function get(sid) {
|
|
345
|
+
return new ContentContext(this._version, sid);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
/* jshint ignore:start */
|
|
349
|
+
/**
|
|
350
|
+
* Provide a user-friendly representation
|
|
351
|
+
*
|
|
352
|
+
* @function toJSON
|
|
353
|
+
* @memberof Twilio.Content.V1.ContentList#
|
|
354
|
+
*
|
|
355
|
+
* @returns Object
|
|
356
|
+
*/
|
|
357
|
+
/* jshint ignore:end */
|
|
358
|
+
ContentListInstance.toJSON = function toJSON() {
|
|
359
|
+
return this._solution;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
ContentListInstance[util.inspect.custom] = function inspect(depth, options) {
|
|
363
|
+
return util.inspect(this.toJSON(), options);
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
return ContentListInstance;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
/* jshint ignore:start */
|
|
371
|
+
/**
|
|
372
|
+
* Initialize the ContentPage
|
|
373
|
+
*
|
|
374
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
375
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
376
|
+
* access, please contact help@twilio.com.
|
|
377
|
+
*
|
|
378
|
+
* @constructor Twilio.Content.V1.ContentPage
|
|
379
|
+
*
|
|
380
|
+
* @param {V1} version - Version of the resource
|
|
381
|
+
* @param {Response<string>} response - Response from the API
|
|
382
|
+
* @param {ContentSolution} solution - Path solution
|
|
383
|
+
*
|
|
384
|
+
* @returns ContentPage
|
|
385
|
+
*/
|
|
386
|
+
/* jshint ignore:end */
|
|
387
|
+
ContentPage = function ContentPage(version, response, solution) {
|
|
388
|
+
// Path Solution
|
|
389
|
+
this._solution = solution;
|
|
390
|
+
|
|
391
|
+
Page.prototype.constructor.call(this, version, response, this._solution);
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
_.extend(ContentPage.prototype, Page.prototype);
|
|
395
|
+
ContentPage.prototype.constructor = ContentPage;
|
|
396
|
+
|
|
397
|
+
/* jshint ignore:start */
|
|
398
|
+
/**
|
|
399
|
+
* Build an instance of ContentInstance
|
|
400
|
+
*
|
|
401
|
+
* @function getInstance
|
|
402
|
+
* @memberof Twilio.Content.V1.ContentPage#
|
|
403
|
+
*
|
|
404
|
+
* @param {ContentPayload} payload - Payload response from the API
|
|
405
|
+
*
|
|
406
|
+
* @returns ContentInstance
|
|
407
|
+
*/
|
|
408
|
+
/* jshint ignore:end */
|
|
409
|
+
ContentPage.prototype.getInstance = function getInstance(payload) {
|
|
410
|
+
return new ContentInstance(this._version, payload);
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/* jshint ignore:start */
|
|
414
|
+
/**
|
|
415
|
+
* Provide a user-friendly representation
|
|
416
|
+
*
|
|
417
|
+
* @function toJSON
|
|
418
|
+
* @memberof Twilio.Content.V1.ContentPage#
|
|
419
|
+
*
|
|
420
|
+
* @returns Object
|
|
421
|
+
*/
|
|
422
|
+
/* jshint ignore:end */
|
|
423
|
+
ContentPage.prototype.toJSON = function toJSON() {
|
|
424
|
+
let clone = {};
|
|
425
|
+
_.forOwn(this, function(value, key) {
|
|
426
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
427
|
+
clone[key] = value;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
return clone;
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
ContentPage.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
434
|
+
return util.inspect(this.toJSON(), options);
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
/* jshint ignore:start */
|
|
439
|
+
/**
|
|
440
|
+
* Initialize the ContentContext
|
|
441
|
+
*
|
|
442
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
443
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
444
|
+
* access, please contact help@twilio.com.
|
|
445
|
+
*
|
|
446
|
+
* @constructor Twilio.Content.V1.ContentInstance
|
|
447
|
+
*
|
|
448
|
+
* @property {Date} dateCreated -
|
|
449
|
+
* The RFC 2822 date and time in GMT that the resource was created
|
|
450
|
+
* @property {Date} dateUpdated -
|
|
451
|
+
* The RFC 2822 date and time in GMT that the resource was last updated
|
|
452
|
+
* @property {string} sid - The unique string that identifies the resource
|
|
453
|
+
* @property {string} accountSid - The SID of the Account that created the resource
|
|
454
|
+
* @property {string} friendlyName -
|
|
455
|
+
* A string name used to describe the Content resource
|
|
456
|
+
* @property {string} language -
|
|
457
|
+
* Two-letter language code identifying the language the Content resource is in.
|
|
458
|
+
* @property {object} variables -
|
|
459
|
+
* Defines the default placeholder values for variables included in the Content resource
|
|
460
|
+
* @property {object} types -
|
|
461
|
+
* The Content types (e.g. twilio/text) for this Content resource
|
|
462
|
+
* @property {string} url -
|
|
463
|
+
* The URL of the resource, relative to `https://content.twilio.com`
|
|
464
|
+
* @property {string} links - A list of links related to the Content resource
|
|
465
|
+
*
|
|
466
|
+
* @param {V1} version - Version of the resource
|
|
467
|
+
* @param {ContentPayload} payload - The instance payload
|
|
468
|
+
* @param {sid} sid - The unique string that identifies the resource
|
|
469
|
+
*/
|
|
470
|
+
/* jshint ignore:end */
|
|
471
|
+
ContentInstance = function ContentInstance(version, payload, sid) {
|
|
472
|
+
this._version = version;
|
|
473
|
+
|
|
474
|
+
// Marshaled Properties
|
|
475
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
|
|
476
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
|
|
477
|
+
this.sid = payload.sid; // jshint ignore:line
|
|
478
|
+
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
479
|
+
this.friendlyName = payload.friendly_name; // jshint ignore:line
|
|
480
|
+
this.language = payload.language; // jshint ignore:line
|
|
481
|
+
this.variables = payload.variables; // jshint ignore:line
|
|
482
|
+
this.types = payload.types; // jshint ignore:line
|
|
483
|
+
this.url = payload.url; // jshint ignore:line
|
|
484
|
+
this.links = payload.links; // jshint ignore:line
|
|
485
|
+
|
|
486
|
+
// Context
|
|
487
|
+
this._context = undefined;
|
|
488
|
+
this._solution = {sid: sid || this.sid, };
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
Object.defineProperty(ContentInstance.prototype,
|
|
492
|
+
'_proxy', {
|
|
493
|
+
get: function() {
|
|
494
|
+
if (!this._context) {
|
|
495
|
+
this._context = new ContentContext(this._version, this._solution.sid);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return this._context;
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
/* jshint ignore:start */
|
|
503
|
+
/**
|
|
504
|
+
* fetch a ContentInstance
|
|
505
|
+
*
|
|
506
|
+
* @function fetch
|
|
507
|
+
* @memberof Twilio.Content.V1.ContentInstance#
|
|
508
|
+
*
|
|
509
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
510
|
+
*
|
|
511
|
+
* @returns {Promise} Resolves to processed ContentInstance
|
|
512
|
+
*/
|
|
513
|
+
/* jshint ignore:end */
|
|
514
|
+
ContentInstance.prototype.fetch = function fetch(callback) {
|
|
515
|
+
return this._proxy.fetch(callback);
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
/* jshint ignore:start */
|
|
519
|
+
/**
|
|
520
|
+
* remove a ContentInstance
|
|
521
|
+
*
|
|
522
|
+
* @function remove
|
|
523
|
+
* @memberof Twilio.Content.V1.ContentInstance#
|
|
524
|
+
*
|
|
525
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
526
|
+
*
|
|
527
|
+
* @returns {Promise} Resolves to processed ContentInstance
|
|
528
|
+
*/
|
|
529
|
+
/* jshint ignore:end */
|
|
530
|
+
ContentInstance.prototype.remove = function remove(callback) {
|
|
531
|
+
return this._proxy.remove(callback);
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/* jshint ignore:start */
|
|
535
|
+
/**
|
|
536
|
+
* Provide a user-friendly representation
|
|
537
|
+
*
|
|
538
|
+
* @function toJSON
|
|
539
|
+
* @memberof Twilio.Content.V1.ContentInstance#
|
|
540
|
+
*
|
|
541
|
+
* @returns Object
|
|
542
|
+
*/
|
|
543
|
+
/* jshint ignore:end */
|
|
544
|
+
ContentInstance.prototype.toJSON = function toJSON() {
|
|
545
|
+
let clone = {};
|
|
546
|
+
_.forOwn(this, function(value, key) {
|
|
547
|
+
if (!_.startsWith(key, '_') && ! _.isFunction(value)) {
|
|
548
|
+
clone[key] = value;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
return clone;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
ContentInstance.prototype[util.inspect.custom] = function inspect(depth,
|
|
555
|
+
options) {
|
|
556
|
+
return util.inspect(this.toJSON(), options);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
/* jshint ignore:start */
|
|
561
|
+
/**
|
|
562
|
+
* Initialize the ContentContext
|
|
563
|
+
*
|
|
564
|
+
* PLEASE NOTE that this class contains preview products that are subject to
|
|
565
|
+
* change. Use them with caution. If you currently do not have developer preview
|
|
566
|
+
* access, please contact help@twilio.com.
|
|
567
|
+
*
|
|
568
|
+
* @constructor Twilio.Content.V1.ContentContext
|
|
569
|
+
*
|
|
570
|
+
* @param {V1} version - Version of the resource
|
|
571
|
+
* @param {sid} sid - The unique string that identifies the resource
|
|
572
|
+
*/
|
|
573
|
+
/* jshint ignore:end */
|
|
574
|
+
ContentContext = function ContentContext(version, sid) {
|
|
575
|
+
this._version = version;
|
|
576
|
+
|
|
577
|
+
// Path Solution
|
|
578
|
+
this._solution = {sid: sid, };
|
|
579
|
+
this._uri = `/Content/${sid}`;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
/* jshint ignore:start */
|
|
583
|
+
/**
|
|
584
|
+
* fetch a ContentInstance
|
|
585
|
+
*
|
|
586
|
+
* @function fetch
|
|
587
|
+
* @memberof Twilio.Content.V1.ContentContext#
|
|
588
|
+
*
|
|
589
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
590
|
+
*
|
|
591
|
+
* @returns {Promise} Resolves to processed ContentInstance
|
|
592
|
+
*/
|
|
593
|
+
/* jshint ignore:end */
|
|
594
|
+
ContentContext.prototype.fetch = function fetch(callback) {
|
|
595
|
+
var deferred = Q.defer();
|
|
596
|
+
var promise = this._version.fetch({uri: this._uri, method: 'GET'});
|
|
597
|
+
|
|
598
|
+
promise = promise.then(function(payload) {
|
|
599
|
+
deferred.resolve(new ContentInstance(this._version, payload, this._solution.sid));
|
|
600
|
+
}.bind(this));
|
|
601
|
+
|
|
602
|
+
promise.catch(function(error) {
|
|
603
|
+
deferred.reject(error);
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
if (_.isFunction(callback)) {
|
|
607
|
+
deferred.promise.nodeify(callback);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return deferred.promise;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
/* jshint ignore:start */
|
|
614
|
+
/**
|
|
615
|
+
* remove a ContentInstance
|
|
616
|
+
*
|
|
617
|
+
* @function remove
|
|
618
|
+
* @memberof Twilio.Content.V1.ContentContext#
|
|
619
|
+
*
|
|
620
|
+
* @param {function} [callback] - Callback to handle processed record
|
|
621
|
+
*
|
|
622
|
+
* @returns {Promise} Resolves to processed ContentInstance
|
|
623
|
+
*/
|
|
624
|
+
/* jshint ignore:end */
|
|
625
|
+
ContentContext.prototype.remove = function remove(callback) {
|
|
626
|
+
var deferred = Q.defer();
|
|
627
|
+
var promise = this._version.remove({uri: this._uri, method: 'DELETE'});
|
|
628
|
+
|
|
629
|
+
promise = promise.then(function(payload) {
|
|
630
|
+
deferred.resolve(payload);
|
|
631
|
+
}.bind(this));
|
|
632
|
+
|
|
633
|
+
promise.catch(function(error) {
|
|
634
|
+
deferred.reject(error);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
if (_.isFunction(callback)) {
|
|
638
|
+
deferred.promise.nodeify(callback);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return deferred.promise;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
/* jshint ignore:start */
|
|
645
|
+
/**
|
|
646
|
+
* Provide a user-friendly representation
|
|
647
|
+
*
|
|
648
|
+
* @function toJSON
|
|
649
|
+
* @memberof Twilio.Content.V1.ContentContext#
|
|
650
|
+
*
|
|
651
|
+
* @returns Object
|
|
652
|
+
*/
|
|
653
|
+
/* jshint ignore:end */
|
|
654
|
+
ContentContext.prototype.toJSON = function toJSON() {
|
|
655
|
+
return this._solution;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
ContentContext.prototype[util.inspect.custom] = function inspect(depth, options)
|
|
659
|
+
{
|
|
660
|
+
return util.inspect(this.toJSON(), options);
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
module.exports = {
|
|
664
|
+
ContentList: ContentList,
|
|
665
|
+
ContentPage: ContentPage,
|
|
666
|
+
ContentInstance: ContentInstance,
|
|
667
|
+
ContentContext: ContentContext
|
|
668
|
+
};
|
|
@@ -45,6 +45,7 @@ interface GoodDataPayload extends GoodDataResource, Page.TwilioResponsePayload {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
interface GoodDataResource {
|
|
48
|
+
gd_base_url: string;
|
|
48
49
|
session_expiry: string;
|
|
49
50
|
session_id: string;
|
|
50
51
|
url: string;
|
|
@@ -106,6 +107,7 @@ declare class GoodDataInstance extends SerializableClass {
|
|
|
106
107
|
* @param callback - Callback to handle processed record
|
|
107
108
|
*/
|
|
108
109
|
create(opts?: GoodDataInstanceCreateOptions, callback?: (error: Error | null, items: GoodDataInstance) => any): Promise<GoodDataInstance>;
|
|
110
|
+
gdBaseUrl: string;
|
|
109
111
|
sessionExpiry: string;
|
|
110
112
|
sessionId: string;
|
|
111
113
|
/**
|
|
@@ -156,6 +156,7 @@ GoodDataPage.prototype[util.inspect.custom] = function inspect(depth, options) {
|
|
|
156
156
|
* @property {string} workspaceId - Unique workspace ID in gooddata
|
|
157
157
|
* @property {string} sessionExpiry - The session expiry date and time
|
|
158
158
|
* @property {string} sessionId - Unique session ID
|
|
159
|
+
* @property {string} gdBaseUrl - GoodData login base URL
|
|
159
160
|
* @property {string} url - The URL of this resource.
|
|
160
161
|
*
|
|
161
162
|
* @param {V1} version - Version of the resource
|
|
@@ -169,6 +170,7 @@ GoodDataInstance = function GoodDataInstance(version, payload) {
|
|
|
169
170
|
this.workspaceId = payload.workspace_id; // jshint ignore:line
|
|
170
171
|
this.sessionExpiry = payload.session_expiry; // jshint ignore:line
|
|
171
172
|
this.sessionId = payload.session_id; // jshint ignore:line
|
|
173
|
+
this.gdBaseUrl = payload.gd_base_url; // jshint ignore:line
|
|
172
174
|
this.url = payload.url; // jshint ignore:line
|
|
173
175
|
|
|
174
176
|
// Context
|
|
@@ -10,6 +10,8 @@ import Response = require('../../../../http/response');
|
|
|
10
10
|
import V1 = require('../../V1');
|
|
11
11
|
import { SerializableClass } from '../../../../interfaces';
|
|
12
12
|
|
|
13
|
+
type CallSummaryAnsweredBy = 'unknown'|'machine_start'|'machine_end_beep'|'machine_end_silence'|'machine_end_other'|'human'|'fax';
|
|
14
|
+
|
|
13
15
|
type CallSummaryCallState = 'ringing'|'completed'|'busy'|'fail'|'noanswer'|'canceled'|'answered'|'undialed';
|
|
14
16
|
|
|
15
17
|
type CallSummaryCallType = 'carrier'|'sip'|'trunking'|'client';
|
|
@@ -54,6 +56,7 @@ interface CallSummaryPayload extends CallSummaryResource, Page.TwilioResponsePay
|
|
|
54
56
|
interface CallSummaryResource {
|
|
55
57
|
account_sid: string;
|
|
56
58
|
annotation: object;
|
|
59
|
+
answered_by: CallSummaryAnsweredBy;
|
|
57
60
|
attributes: object;
|
|
58
61
|
call_sid: string;
|
|
59
62
|
call_state: CallSummaryCallState;
|
|
@@ -123,6 +126,7 @@ declare class CallSummaryInstance extends SerializableClass {
|
|
|
123
126
|
private _proxy: CallSummaryContext;
|
|
124
127
|
accountSid: string;
|
|
125
128
|
annotation: any;
|
|
129
|
+
answeredBy: CallSummaryAnsweredBy;
|
|
126
130
|
attributes: any;
|
|
127
131
|
callSid: string;
|
|
128
132
|
callState: CallSummaryCallState;
|
|
@@ -185,4 +189,4 @@ declare class CallSummaryPage extends Page<V1, CallSummaryPayload, CallSummaryRe
|
|
|
185
189
|
toJSON(): any;
|
|
186
190
|
}
|
|
187
191
|
|
|
188
|
-
export { CallSummaryCallState, CallSummaryCallType, CallSummaryContext, CallSummaryInstance, CallSummaryInstanceFetchOptions, CallSummaryList, CallSummaryListInstance, CallSummaryPage, CallSummaryPayload, CallSummaryProcessingState, CallSummaryResource, CallSummarySolution }
|
|
192
|
+
export { CallSummaryAnsweredBy, CallSummaryCallState, CallSummaryCallType, CallSummaryContext, CallSummaryInstance, CallSummaryInstanceFetchOptions, CallSummaryList, CallSummaryListInstance, CallSummaryPage, CallSummaryPayload, CallSummaryProcessingState, CallSummaryResource, CallSummarySolution }
|
|
@@ -162,6 +162,7 @@ CallSummaryPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
|
162
162
|
* @property {string} callSid - The call_sid
|
|
163
163
|
* @property {call_summary.call_type} callType - The call_type
|
|
164
164
|
* @property {call_summary.call_state} callState - The call_state
|
|
165
|
+
* @property {call_summary.answered_by} answeredBy - The answered_by
|
|
165
166
|
* @property {call_summary.processing_state} processingState - The processing_state
|
|
166
167
|
* @property {Date} createdTime - The created_time
|
|
167
168
|
* @property {Date} startTime - The start_time
|
|
@@ -194,6 +195,7 @@ CallSummaryInstance = function CallSummaryInstance(version, payload, callSid) {
|
|
|
194
195
|
this.callSid = payload.call_sid; // jshint ignore:line
|
|
195
196
|
this.callType = payload.call_type; // jshint ignore:line
|
|
196
197
|
this.callState = payload.call_state; // jshint ignore:line
|
|
198
|
+
this.answeredBy = payload.answered_by; // jshint ignore:line
|
|
197
199
|
this.processingState = payload.processing_state; // jshint ignore:line
|
|
198
200
|
this.createdTime = deserialize.iso8601DateTime(payload.created_time); // jshint ignore:line
|
|
199
201
|
this.startTime = deserialize.iso8601DateTime(payload.start_time); // jshint ignore:line
|
|
@@ -10,6 +10,8 @@ import Response = require('../../../http/response');
|
|
|
10
10
|
import V1 = require('../V1');
|
|
11
11
|
import { SerializableClass } from '../../../interfaces';
|
|
12
12
|
|
|
13
|
+
type CallSummariesAnsweredBy = 'unknown'|'machine_start'|'machine_end_beep'|'machine_end_silence'|'machine_end_other'|'human'|'fax';
|
|
14
|
+
|
|
13
15
|
type CallSummariesCallDirection = 'outbound_api'|'outbound_dial'|'inbound'|'trunking_originating'|'trunking_terminating';
|
|
14
16
|
|
|
15
17
|
type CallSummariesCallState = 'ringing'|'completed'|'busy'|'fail'|'noanswer'|'canceled'|'answered'|'undialed';
|
|
@@ -302,6 +304,7 @@ interface CallSummariesPayload extends CallSummariesResource, Page.TwilioRespons
|
|
|
302
304
|
|
|
303
305
|
interface CallSummariesResource {
|
|
304
306
|
account_sid: string;
|
|
307
|
+
answered_by: CallSummariesAnsweredBy;
|
|
305
308
|
attributes: object;
|
|
306
309
|
call_sid: string;
|
|
307
310
|
call_state: CallSummariesCallState;
|
|
@@ -338,6 +341,7 @@ declare class CallSummariesInstance extends SerializableClass {
|
|
|
338
341
|
constructor(version: V1, payload: CallSummariesPayload);
|
|
339
342
|
|
|
340
343
|
accountSid: string;
|
|
344
|
+
answeredBy: CallSummariesAnsweredBy;
|
|
341
345
|
attributes: any;
|
|
342
346
|
callSid: string;
|
|
343
347
|
callState: CallSummariesCallState;
|
|
@@ -387,4 +391,4 @@ declare class CallSummariesPage extends Page<V1, CallSummariesPayload, CallSumma
|
|
|
387
391
|
toJSON(): any;
|
|
388
392
|
}
|
|
389
393
|
|
|
390
|
-
export { CallSummariesCallDirection, CallSummariesCallState, CallSummariesCallType, CallSummariesInstance, CallSummariesList, CallSummariesListInstance, CallSummariesListInstanceEachOptions, CallSummariesListInstanceOptions, CallSummariesListInstancePageOptions, CallSummariesPage, CallSummariesPayload, CallSummariesProcessingState, CallSummariesProcessingStateRequest, CallSummariesResource, CallSummariesSolution, CallSummariesSortBy }
|
|
394
|
+
export { CallSummariesAnsweredBy, CallSummariesCallDirection, CallSummariesCallState, CallSummariesCallType, CallSummariesInstance, CallSummariesList, CallSummariesListInstance, CallSummariesListInstanceEachOptions, CallSummariesListInstanceOptions, CallSummariesListInstancePageOptions, CallSummariesPage, CallSummariesPayload, CallSummariesProcessingState, CallSummariesProcessingStateRequest, CallSummariesResource, CallSummariesSolution, CallSummariesSortBy }
|
|
@@ -465,6 +465,7 @@ CallSummariesPage.prototype[util.inspect.custom] = function inspect(depth,
|
|
|
465
465
|
*
|
|
466
466
|
* @property {string} accountSid - The account_sid
|
|
467
467
|
* @property {string} callSid - The call_sid
|
|
468
|
+
* @property {call_summaries.answered_by} answeredBy - The answered_by
|
|
468
469
|
* @property {call_summaries.call_type} callType - The call_type
|
|
469
470
|
* @property {call_summaries.call_state} callState - The call_state
|
|
470
471
|
* @property {call_summaries.processing_state} processingState -
|
|
@@ -496,6 +497,7 @@ CallSummariesInstance = function CallSummariesInstance(version, payload) {
|
|
|
496
497
|
// Marshaled Properties
|
|
497
498
|
this.accountSid = payload.account_sid; // jshint ignore:line
|
|
498
499
|
this.callSid = payload.call_sid; // jshint ignore:line
|
|
500
|
+
this.answeredBy = payload.answered_by; // jshint ignore:line
|
|
499
501
|
this.callType = payload.call_type; // jshint ignore:line
|
|
500
502
|
this.callState = payload.call_state; // jshint ignore:line
|
|
501
503
|
this.processingState = payload.processing_state; // jshint ignore:line
|