twilio 3.83.4 → 3.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,6 +32,12 @@ TypeScript is supported for TypeScript version 2.9 and above.
32
32
 
33
33
  `npm install twilio` or `yarn add twilio`
34
34
 
35
+ ### Installing Release Candidates
36
+
37
+ Or, if you're wanting to install the latest release candidate use:
38
+
39
+ `npm install twilio@rc` or `yarn add twilio@rc`
40
+
35
41
  ## Sample Usage
36
42
 
37
43
  Check out these [code examples](examples) in JavaScript and TypeScript to get up and running quickly.
@@ -8,6 +8,7 @@
8
8
  import Domain = require('../base/Domain');
9
9
  import Twilio = require('./Twilio');
10
10
  import V1 = require('./flexApi/V1');
11
+ import V2 = require('./flexApi/V2');
11
12
  import { AssessmentsListInstance } from './flexApi/v1/assessments';
12
13
  import { ChannelListInstance } from './flexApi/v1/channel';
13
14
  import { ConfigurationListInstance } from './flexApi/v1/configuration';
@@ -16,6 +17,7 @@ import { GoodDataListInstance } from './flexApi/v1/goodData';
16
17
  import { InteractionListInstance } from './flexApi/v1/interaction';
17
18
  import { UserRolesListInstance } from './flexApi/v1/userRoles';
18
19
  import { WebChannelListInstance } from './flexApi/v1/webChannel';
20
+ import { WebChannelsListInstance } from './flexApi/v2/webChannels';
19
21
 
20
22
 
21
23
  declare class FlexApi extends Domain {
@@ -34,7 +36,9 @@ declare class FlexApi extends Domain {
34
36
  readonly interaction: InteractionListInstance;
35
37
  readonly userRoles: UserRolesListInstance;
36
38
  readonly v1: V1;
39
+ readonly v2: V2;
37
40
  readonly webChannel: WebChannelListInstance;
41
+ readonly webChannels: WebChannelsListInstance;
38
42
  }
39
43
 
40
44
  export = FlexApi;
@@ -12,6 +12,7 @@
12
12
  var _ = require('lodash'); /* jshint ignore:line */
13
13
  var Domain = require('../base/Domain'); /* jshint ignore:line */
14
14
  var V1 = require('./flexApi/V1'); /* jshint ignore:line */
15
+ var V2 = require('./flexApi/V2'); /* jshint ignore:line */
15
16
 
16
17
 
17
18
  /* jshint ignore:start */
@@ -21,6 +22,7 @@ var V1 = require('./flexApi/V1'); /* jshint ignore:line */
21
22
  * @constructor Twilio.FlexApi
22
23
  *
23
24
  * @property {Twilio.FlexApi.V1} v1 - v1 version
25
+ * @property {Twilio.FlexApi.V2} v2 - v2 version
24
26
  * @property {Twilio.FlexApi.V1.AssessmentsList} assessments - assessments resource
25
27
  * @property {Twilio.FlexApi.V1.ChannelList} channel - channel resource
26
28
  * @property {Twilio.FlexApi.V1.ConfigurationList} configuration -
@@ -30,6 +32,7 @@ var V1 = require('./flexApi/V1'); /* jshint ignore:line */
30
32
  * @property {Twilio.FlexApi.V1.InteractionList} interaction - interaction resource
31
33
  * @property {Twilio.FlexApi.V1.UserRolesList} userRoles - userRoles resource
32
34
  * @property {Twilio.FlexApi.V1.WebChannelList} webChannel - webChannel resource
35
+ * @property {Twilio.FlexApi.V2.WebChannelsList} webChannels - webChannels resource
33
36
  *
34
37
  * @param {Twilio} twilio - The twilio client
35
38
  */
@@ -39,6 +42,7 @@ function FlexApi(twilio) {
39
42
 
40
43
  // Versions
41
44
  this._v1 = undefined;
45
+ this._v2 = undefined;
42
46
  }
43
47
 
44
48
  _.extend(FlexApi.prototype, Domain.prototype);
@@ -52,6 +56,14 @@ Object.defineProperty(FlexApi.prototype,
52
56
  }
53
57
  });
54
58
 
59
+ Object.defineProperty(FlexApi.prototype,
60
+ 'v2', {
61
+ get: function() {
62
+ this._v2 = this._v2 || new V2(this);
63
+ return this._v2;
64
+ }
65
+ });
66
+
55
67
  Object.defineProperty(FlexApi.prototype,
56
68
  'assessments', {
57
69
  get: function() {
@@ -108,4 +120,11 @@ Object.defineProperty(FlexApi.prototype,
108
120
  }
109
121
  });
110
122
 
123
+ Object.defineProperty(FlexApi.prototype,
124
+ 'webChannels', {
125
+ get: function() {
126
+ return this.v2.webChannels;
127
+ }
128
+ });
129
+
111
130
  module.exports = FlexApi;
@@ -8,6 +8,7 @@
8
8
  import Domain = require('../base/Domain');
9
9
  import Twilio = require('./Twilio');
10
10
  import V1 = require('./oauth/V1');
11
+ import { DeviceCodeListInstance } from './oauth/v1/deviceCode';
11
12
  import { OauthListInstance } from './oauth/v1/oauth';
12
13
  import { OpenidDiscoveryListInstance } from './oauth/v1/openidDiscovery';
13
14
  import { TokenListInstance } from './oauth/v1/token';
@@ -22,6 +23,7 @@ declare class Oauth extends Domain {
22
23
  */
23
24
  constructor(twilio: Twilio);
24
25
 
26
+ readonly deviceCode: DeviceCodeListInstance;
25
27
  readonly oauth: OauthListInstance;
26
28
  readonly openidDiscovery: OpenidDiscoveryListInstance;
27
29
  readonly token: TokenListInstance;
package/lib/rest/Oauth.js CHANGED
@@ -22,6 +22,7 @@ var V1 = require('./oauth/V1'); /* jshint ignore:line */
22
22
  *
23
23
  * @property {Twilio.Oauth.V1} v1 - v1 version
24
24
  * @property {Twilio.Oauth.V1.OauthList} oauth - oauth resource
25
+ * @property {Twilio.Oauth.V1.DeviceCodeList} deviceCode - deviceCode resource
25
26
  * @property {Twilio.Oauth.V1.OpenidDiscoveryList} openidDiscovery -
26
27
  * openidDiscovery resource
27
28
  * @property {Twilio.Oauth.V1.TokenList} token - token resource
@@ -55,6 +56,13 @@ Object.defineProperty(Oauth.prototype,
55
56
  }
56
57
  });
57
58
 
59
+ Object.defineProperty(Oauth.prototype,
60
+ 'deviceCode', {
61
+ get: function() {
62
+ return this.v1.deviceCode;
63
+ }
64
+ });
65
+
58
66
  Object.defineProperty(Oauth.prototype,
59
67
  'openidDiscovery', {
60
68
  get: function() {
@@ -31,6 +31,7 @@ declare function AddressList(version: V2010, accountSid: string): AddressListIns
31
31
  * @property postalCode - The postal code of the address
32
32
  * @property region - The state or region of the address
33
33
  * @property street - The number and street address of the address
34
+ * @property streetSecondary - The additional number and street address of the address
34
35
  */
35
36
  interface AddressInstanceUpdateOptions {
36
37
  autoCorrectAddress?: boolean;
@@ -41,6 +42,7 @@ interface AddressInstanceUpdateOptions {
41
42
  postalCode?: string;
42
43
  region?: string;
43
44
  street?: string;
45
+ streetSecondary?: string;
44
46
  }
45
47
 
46
48
  interface AddressListInstance {
@@ -175,6 +177,7 @@ interface AddressListInstance {
175
177
  * @property postalCode - The postal code of the new address
176
178
  * @property region - The state or region of the new address
177
179
  * @property street - The number and street address of the new address
180
+ * @property streetSecondary - The additional number and street address of the address
178
181
  */
179
182
  interface AddressListInstanceCreateOptions {
180
183
  autoCorrectAddress?: boolean;
@@ -186,6 +189,7 @@ interface AddressListInstanceCreateOptions {
186
189
  postalCode: string;
187
190
  region: string;
188
191
  street: string;
192
+ streetSecondary?: string;
189
193
  }
190
194
 
191
195
  /**
@@ -279,6 +283,7 @@ interface AddressResource {
279
283
  region: string;
280
284
  sid: string;
281
285
  street: string;
286
+ street_secondary: string;
282
287
  uri: string;
283
288
  validated: boolean;
284
289
  verified: boolean;
@@ -372,6 +377,7 @@ declare class AddressInstance extends SerializableClass {
372
377
  remove(callback?: (error: Error | null, items: AddressInstance) => any): Promise<boolean>;
373
378
  sid: string;
374
379
  street: string;
380
+ streetSecondary: string;
375
381
  /**
376
382
  * Provide a user-friendly representation
377
383
  */
@@ -74,6 +74,8 @@ AddressList = function AddressList(version, accountSid) {
74
74
  * Whether to enable emergency calling on the new address
75
75
  * @param {boolean} [opts.autoCorrectAddress] -
76
76
  * Whether we should automatically correct the address
77
+ * @param {string} [opts.streetSecondary] -
78
+ * The additional number and street address of the address
77
79
  * @param {function} [callback] - Callback to handle processed record
78
80
  *
79
81
  * @returns {Promise} Resolves to processed AddressInstance
@@ -112,7 +114,8 @@ AddressList = function AddressList(version, accountSid) {
112
114
  'IsoCountry': _.get(opts, 'isoCountry'),
113
115
  'FriendlyName': _.get(opts, 'friendlyName'),
114
116
  'EmergencyEnabled': serialize.bool(_.get(opts, 'emergencyEnabled')),
115
- 'AutoCorrectAddress': serialize.bool(_.get(opts, 'autoCorrectAddress'))
117
+ 'AutoCorrectAddress': serialize.bool(_.get(opts, 'autoCorrectAddress')),
118
+ 'StreetSecondary': _.get(opts, 'streetSecondary')
116
119
  });
117
120
 
118
121
  var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
@@ -533,6 +536,8 @@ AddressPage.prototype[util.inspect.custom] = function inspect(depth, options) {
533
536
  * Whether the address has been validated to comply with local regulation
534
537
  * @property {boolean} verified -
535
538
  * Whether the address has been verified to comply with regulation
539
+ * @property {string} streetSecondary -
540
+ * The additional number and street address of the address
536
541
  *
537
542
  * @param {V2010} version - Version of the resource
538
543
  * @param {AddressPayload} payload - The instance payload
@@ -560,6 +565,7 @@ AddressInstance = function AddressInstance(version, payload, accountSid, sid) {
560
565
  this.emergencyEnabled = payload.emergency_enabled; // jshint ignore:line
561
566
  this.validated = payload.validated; // jshint ignore:line
562
567
  this.verified = payload.verified; // jshint ignore:line
568
+ this.streetSecondary = payload.street_secondary; // jshint ignore:line
563
569
 
564
570
  // Context
565
571
  this._context = undefined;
@@ -627,6 +633,8 @@ AddressInstance.prototype.fetch = function fetch(callback) {
627
633
  * Whether to enable emergency calling on the address
628
634
  * @param {boolean} [opts.autoCorrectAddress] -
629
635
  * Whether we should automatically correct the address
636
+ * @param {string} [opts.streetSecondary] -
637
+ * The additional number and street address of the address
630
638
  * @param {function} [callback] - Callback to handle processed record
631
639
  *
632
640
  * @returns {Promise} Resolves to processed AddressInstance
@@ -788,6 +796,8 @@ AddressContext.prototype.fetch = function fetch(callback) {
788
796
  * Whether to enable emergency calling on the address
789
797
  * @param {boolean} [opts.autoCorrectAddress] -
790
798
  * Whether we should automatically correct the address
799
+ * @param {string} [opts.streetSecondary] -
800
+ * The additional number and street address of the address
791
801
  * @param {function} [callback] - Callback to handle processed record
792
802
  *
793
803
  * @returns {Promise} Resolves to processed AddressInstance
@@ -809,7 +819,8 @@ AddressContext.prototype.update = function update(opts, callback) {
809
819
  'Region': _.get(opts, 'region'),
810
820
  'PostalCode': _.get(opts, 'postalCode'),
811
821
  'EmergencyEnabled': serialize.bool(_.get(opts, 'emergencyEnabled')),
812
- 'AutoCorrectAddress': serialize.bool(_.get(opts, 'autoCorrectAddress'))
822
+ 'AutoCorrectAddress': serialize.bool(_.get(opts, 'autoCorrectAddress')),
823
+ 'StreetSecondary': _.get(opts, 'streetSecondary')
813
824
  });
814
825
 
815
826
  var promise = this._version.update({uri: this._uri, method: 'POST', data: data});
@@ -53,7 +53,7 @@ interface UserDefinedMessageSubscriptionListInstance {
53
53
  interface UserDefinedMessageSubscriptionListInstanceCreateOptions {
54
54
  callback: string;
55
55
  idempotencyKey?: string;
56
- method: string;
56
+ method?: string;
57
57
  }
58
58
 
59
59
  interface UserDefinedMessageSubscriptionPayload extends UserDefinedMessageSubscriptionResource, Page.TwilioResponsePayload {
@@ -63,9 +63,9 @@ UserDefinedMessageSubscriptionList = function
63
63
  * @param {object} opts - Options for request
64
64
  * @param {string} opts.callback -
65
65
  * The URL we should call to send user defined messages.
66
- * @param {string} opts.method - HTTP method used with the callback.
67
66
  * @param {string} [opts.idempotencyKey] -
68
67
  * A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated.
68
+ * @param {string} [opts.method] - HTTP method used with the callback.
69
69
  * @param {function} [callback] - Callback to handle processed record
70
70
  *
71
71
  * @returns {Promise} Resolves to processed UserDefinedMessageSubscriptionInstance
@@ -79,15 +79,12 @@ UserDefinedMessageSubscriptionList = function
79
79
  if (_.isUndefined(opts['callback'])) {
80
80
  throw new Error('Required parameter "opts[\'callback\']" missing.');
81
81
  }
82
- if (_.isUndefined(opts['method'])) {
83
- throw new Error('Required parameter "opts[\'method\']" missing.');
84
- }
85
82
 
86
83
  var deferred = Q.defer();
87
84
  var data = values.of({
88
85
  'Callback': _.get(opts, 'callback'),
89
- 'Method': _.get(opts, 'method'),
90
- 'IdempotencyKey': _.get(opts, 'idempotencyKey')
86
+ 'IdempotencyKey': _.get(opts, 'idempotencyKey'),
87
+ 'Method': _.get(opts, 'method')
91
88
  });
92
89
 
93
90
  var promise = this._version.create({uri: this._uri, method: 'POST', data: data});
@@ -0,0 +1,25 @@
1
+ /**
2
+ * This code was generated by
3
+ * \ / _ _ _| _ _
4
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ * / /
6
+ */
7
+
8
+ import FlexApi = require('../FlexApi');
9
+ import Version = require('../../base/Version');
10
+ import { WebChannelsList } from './v2/webChannels';
11
+ import { WebChannelsListInstance } from './v2/webChannels';
12
+
13
+
14
+ declare class V2 extends Version {
15
+ /**
16
+ * Initialize the V2 version of FlexApi
17
+ *
18
+ * @param domain - The twilio domain
19
+ */
20
+ constructor(domain: FlexApi);
21
+
22
+ readonly webChannels: WebChannelsListInstance;
23
+ }
24
+
25
+ export = V2;
@@ -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 Version = require('../../base/Version'); /* jshint ignore:line */
14
+ var WebChannelsList = require('./v2/webChannels').WebChannelsList;
15
+
16
+
17
+ /* jshint ignore:start */
18
+ /**
19
+ * Initialize the V2 version of FlexApi
20
+ *
21
+ * @constructor Twilio.FlexApi.V2
22
+ *
23
+ * @property {Twilio.FlexApi.V2.WebChannelsList} webChannels - webChannels resource
24
+ *
25
+ * @param {Twilio.FlexApi} domain - The twilio domain
26
+ */
27
+ /* jshint ignore:end */
28
+ function V2(domain) {
29
+ Version.prototype.constructor.call(this, domain, 'v2');
30
+
31
+ // Resources
32
+ this._webChannels = undefined;
33
+ }
34
+
35
+ _.extend(V2.prototype, Version.prototype);
36
+ V2.prototype.constructor = V2;
37
+
38
+ Object.defineProperty(V2.prototype,
39
+ 'webChannels', {
40
+ get: function() {
41
+ this._webChannels = this._webChannels || new WebChannelsList(this);
42
+ return this._webChannels;
43
+ }
44
+ });
45
+
46
+ module.exports = V2;
@@ -45,7 +45,7 @@ interface GoodDataPayload extends GoodDataResource, Page.TwilioResponsePayload {
45
45
  }
46
46
 
47
47
  interface GoodDataResource {
48
- gd_base_url: string;
48
+ base_url: string;
49
49
  session_expiry: string;
50
50
  session_id: string;
51
51
  url: string;
@@ -94,6 +94,7 @@ declare class GoodDataInstance extends SerializableClass {
94
94
  constructor(version: V1, payload: GoodDataPayload);
95
95
 
96
96
  private _proxy: GoodDataContext;
97
+ baseUrl: string;
97
98
  /**
98
99
  * create a GoodDataInstance
99
100
  *
@@ -107,7 +108,6 @@ declare class GoodDataInstance extends SerializableClass {
107
108
  * @param callback - Callback to handle processed record
108
109
  */
109
110
  create(opts?: GoodDataInstanceCreateOptions, callback?: (error: Error | null, items: GoodDataInstance) => any): Promise<GoodDataInstance>;
110
- gdBaseUrl: string;
111
111
  sessionExpiry: string;
112
112
  sessionId: string;
113
113
  /**
@@ -153,10 +153,10 @@ GoodDataPage.prototype[util.inspect.custom] = function inspect(depth, options) {
153
153
  *
154
154
  * @constructor Twilio.FlexApi.V1.GoodDataInstance
155
155
  *
156
- * @property {string} workspaceId - Unique workspace ID in gooddata
156
+ * @property {string} workspaceId - Unique ID to identify the user's workspace
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
+ * @property {string} baseUrl - Base URL to fetch reports and dashboards
160
160
  * @property {string} url - The URL of this resource.
161
161
  *
162
162
  * @param {V1} version - Version of the resource
@@ -170,7 +170,7 @@ GoodDataInstance = function GoodDataInstance(version, payload) {
170
170
  this.workspaceId = payload.workspace_id; // jshint ignore:line
171
171
  this.sessionExpiry = payload.session_expiry; // jshint ignore:line
172
172
  this.sessionId = payload.session_id; // jshint ignore:line
173
- this.gdBaseUrl = payload.gd_base_url; // jshint ignore:line
173
+ this.baseUrl = payload.base_url; // jshint ignore:line
174
174
  this.url = payload.url; // jshint ignore:line
175
175
 
176
176
  // Context
@@ -247,7 +247,7 @@ GoodDataContext = function GoodDataContext(version) {
247
247
 
248
248
  // Path Solution
249
249
  this._solution = {};
250
- this._uri = `/Accounts/GoodData`;
250
+ this._uri = `/Insights/Session`;
251
251
  };
252
252
 
253
253
  /* jshint ignore:start */
@@ -242,7 +242,7 @@ UserRolesContext = function UserRolesContext(version) {
242
242
 
243
243
  // Path Solution
244
244
  this._solution = {};
245
- this._uri = `/Accounts/UserRoles`;
245
+ this._uri = `/Insights/UserRoles`;
246
246
  };
247
247
 
248
248
  /* jshint ignore:start */
@@ -0,0 +1,101 @@
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 V2 = require('../V2');
11
+ import { SerializableClass } from '../../../interfaces';
12
+
13
+ /**
14
+ * Initialize the WebChannelsList
15
+ *
16
+ * @param version - Version of the resource
17
+ */
18
+ declare function WebChannelsList(version: V2): WebChannelsListInstance;
19
+
20
+ interface WebChannelsListInstance {
21
+ /**
22
+ * create a WebChannelsInstance
23
+ *
24
+ * @param opts - Options for request
25
+ * @param callback - Callback to handle processed record
26
+ */
27
+ create(opts: WebChannelsListInstanceCreateOptions, callback?: (error: Error | null, item: WebChannelsInstance) => any): Promise<WebChannelsInstance>;
28
+ /**
29
+ * Provide a user-friendly representation
30
+ */
31
+ toJSON(): any;
32
+ }
33
+
34
+ /**
35
+ * Options to pass to create
36
+ *
37
+ * @property addressSid - The SID of the Conversations Address
38
+ * @property chatFriendlyName - The Conversation's friendly name
39
+ * @property customerFriendlyName - The Conversation participant's friendly name
40
+ * @property preEngagementData - The pre-engagement data
41
+ */
42
+ interface WebChannelsListInstanceCreateOptions {
43
+ addressSid: string;
44
+ chatFriendlyName?: string;
45
+ customerFriendlyName?: string;
46
+ preEngagementData?: string;
47
+ }
48
+
49
+ interface WebChannelsPayload extends WebChannelsResource, Page.TwilioResponsePayload {
50
+ }
51
+
52
+ interface WebChannelsResource {
53
+ conversation_sid: string;
54
+ identity: string;
55
+ }
56
+
57
+ interface WebChannelsSolution {
58
+ }
59
+
60
+
61
+ declare class WebChannelsInstance extends SerializableClass {
62
+ /**
63
+ * Initialize the WebChannelsContext
64
+ *
65
+ * @param version - Version of the resource
66
+ * @param payload - The instance payload
67
+ */
68
+ constructor(version: V2, payload: WebChannelsPayload);
69
+
70
+ conversationSid: string;
71
+ identity: string;
72
+ /**
73
+ * Provide a user-friendly representation
74
+ */
75
+ toJSON(): any;
76
+ }
77
+
78
+
79
+ declare class WebChannelsPage extends Page<V2, WebChannelsPayload, WebChannelsResource, WebChannelsInstance> {
80
+ /**
81
+ * Initialize the WebChannelsPage
82
+ *
83
+ * @param version - Version of the resource
84
+ * @param response - Response from the API
85
+ * @param solution - Path solution
86
+ */
87
+ constructor(version: V2, response: Response<string>, solution: WebChannelsSolution);
88
+
89
+ /**
90
+ * Build an instance of WebChannelsInstance
91
+ *
92
+ * @param payload - Payload response from the API
93
+ */
94
+ getInstance(payload: WebChannelsPayload): WebChannelsInstance;
95
+ /**
96
+ * Provide a user-friendly representation
97
+ */
98
+ toJSON(): any;
99
+ }
100
+
101
+ export { WebChannelsInstance, WebChannelsList, WebChannelsListInstance, WebChannelsListInstanceCreateOptions, WebChannelsPage, WebChannelsPayload, WebChannelsResource, WebChannelsSolution }