From 158bdd9cc2eb004cf5c8cbbaebe0744eaa496bcf Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 28 Sep 2020 20:25:54 +0000 Subject: [PATCH] [Librarian] Regenerated @ 38ba2b0d95a2827fc370f2fe666eb7cce8f2c9e3 --- CHANGES.md | 16 + .../v2010/account/conference/participant.d.ts | 2 + .../v2010/account/conference/participant.js | 4 +- lib/rest/conversations/v1/configuration.d.ts | 12 - lib/rest/conversations/v1/configuration.js | 17 +- .../v1/configuration/webhook.d.ts | 12 - .../conversations/v1/configuration/webhook.js | 12 - lib/rest/conversations/v1/conversation.d.ts | 12 - lib/rest/conversations/v1/conversation.js | 14 +- .../v1/conversation/message.d.ts | 12 - .../conversations/v1/conversation/message.js | 16 +- .../conversation/message/deliveryReceipt.d.ts | 12 - .../conversation/message/deliveryReceipt.js | 12 - .../v1/conversation/participant.d.ts | 12 - .../v1/conversation/participant.js | 12 - .../v1/conversation/webhook.d.ts | 12 - .../conversations/v1/conversation/webhook.js | 12 - lib/rest/conversations/v1/credential.d.ts | 12 - lib/rest/conversations/v1/credential.js | 12 - lib/rest/conversations/v1/role.d.ts | 12 - lib/rest/conversations/v1/role.js | 14 +- lib/rest/conversations/v1/service.d.ts | 12 - lib/rest/conversations/v1/service.js | 14 +- .../conversations/v1/service/binding.d.ts | 12 - lib/rest/conversations/v1/service/binding.js | 12 - .../v1/service/configuration.d.ts | 12 - .../conversations/v1/service/configuration.js | 16 +- .../service/configuration/notification.d.ts | 12 - .../v1/service/configuration/notification.js | 12 - .../v1/service/conversation.d.ts | 12 - .../conversations/v1/service/conversation.js | 14 +- .../v1/service/conversation/message.d.ts | 12 - .../v1/service/conversation/message.js | 14 +- .../conversation/message/deliveryReceipt.d.ts | 12 - .../conversation/message/deliveryReceipt.js | 12 - .../v1/service/conversation/participant.d.ts | 12 - .../v1/service/conversation/participant.js | 12 - .../v1/service/conversation/webhook.d.ts | 12 - .../v1/service/conversation/webhook.js | 12 - lib/rest/conversations/v1/service/role.d.ts | 12 - lib/rest/conversations/v1/service/role.js | 14 +- lib/rest/conversations/v1/service/user.d.ts | 43 ++- lib/rest/conversations/v1/service/user.js | 48 ++- lib/rest/conversations/v1/user.d.ts | 43 ++- lib/rest/conversations/v1/user.js | 48 ++- lib/rest/serverless/v1/service/build.d.ts | 9 + lib/rest/serverless/v1/service/build.js | 37 ++ .../v1/service/build/buildStatus.d.ts | 147 ++++++++ .../v1/service/build/buildStatus.js | 350 ++++++++++++++++++ lib/rest/verify/v2/service/entity/factor.d.ts | 2 - lib/rest/verify/v2/service/entity/factor.js | 6 +- lib/rest/video/v1/room.d.ts | 2 +- .../account/conference/participant.spec.js | 33 ++ .../conversations/v1/service/user.spec.js | 23 +- .../rest/conversations/v1/user.spec.js | 23 +- .../rest/serverless/v1/service/build.spec.js | 10 +- .../v1/service/build/buildStatus.spec.js | 79 ++++ .../verify/v2/service/entity/factor.spec.js | 5 +- spec/integration/rest/video/v1/room.spec.js | 4 +- 59 files changed, 857 insertions(+), 558 deletions(-) create mode 100644 lib/rest/serverless/v1/service/build/buildStatus.d.ts create mode 100644 lib/rest/serverless/v1/service/build/buildStatus.js create mode 100644 spec/integration/rest/serverless/v1/service/build/buildStatus.spec.js diff --git a/CHANGES.md b/CHANGES.md index 18c3e11183..09ef39a4e3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,22 @@ twilio-node changelog ===================== +[2020-09-28] Version 3.49.4 +--------------------------- +**Api** +- Add optional property `call_reason` in the participant create request +- Make sip-domain-service endpoints available in stage-au1 and prod-au1 + +**Messaging** +- Removed beta feature gate from WhatsApp Templates API + +**Serverless** +- Add Build Status endpoint + +**Video** +- [Rooms] Add new room type "go" for WebRTC Go + + [2020-09-21] Version 3.49.3 --------------------------- **Accounts** diff --git a/lib/rest/api/v2010/account/conference/participant.d.ts b/lib/rest/api/v2010/account/conference/participant.d.ts index bc5f6d35ee..e2d719d668 100644 --- a/lib/rest/api/v2010/account/conference/participant.d.ts +++ b/lib/rest/api/v2010/account/conference/participant.d.ts @@ -177,6 +177,7 @@ interface ParticipantListInstance { * * @property beep - Whether to play a notification beep to the conference when the participant joins * @property byoc - BYOC trunk SID (Beta) + * @property callReason - Reason for the call (Branded Calls Beta) * @property callSidToCoach - The SID of the participant who is being `coached` * @property callerId - The phone number, Client identifier, or username portion of SIP address that made this call. * @property coaching - Indicates if the participant changed to coach @@ -215,6 +216,7 @@ interface ParticipantListInstance { interface ParticipantListInstanceCreateOptions { beep?: string; byoc?: string; + callReason?: string; callSidToCoach?: string; callerId?: string; coaching?: boolean; diff --git a/lib/rest/api/v2010/account/conference/participant.js b/lib/rest/api/v2010/account/conference/participant.js index d2d15733da..ac6305bbd0 100644 --- a/lib/rest/api/v2010/account/conference/participant.js +++ b/lib/rest/api/v2010/account/conference/participant.js @@ -128,6 +128,7 @@ ParticipantList = function ParticipantList(version, accountSid, conferenceSid) { * @param {string} [opts.byoc] - BYOC trunk SID (Beta) * @param {string} [opts.callerId] - * The phone number, Client identifier, or username portion of SIP address that made this call. + * @param {string} [opts.callReason] - Reason for the call (Branded Calls Beta) * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed ParticipantInstance @@ -181,7 +182,8 @@ ParticipantList = function ParticipantList(version, accountSid, conferenceSid) { 'CallSidToCoach': _.get(opts, 'callSidToCoach'), 'JitterBufferSize': _.get(opts, 'jitterBufferSize'), 'Byoc': _.get(opts, 'byoc'), - 'CallerId': _.get(opts, 'callerId') + 'CallerId': _.get(opts, 'callerId'), + 'CallReason': _.get(opts, 'callReason') }); var promise = this._version.create({uri: this._uri, method: 'POST', data: data}); diff --git a/lib/rest/conversations/v1/configuration.d.ts b/lib/rest/conversations/v1/configuration.d.ts index 8ecf8f0f4f..3249d1fc52 100644 --- a/lib/rest/conversations/v1/configuration.d.ts +++ b/lib/rest/conversations/v1/configuration.d.ts @@ -14,9 +14,6 @@ import { WebhookListInstance } from './configuration/webhook'; /** * Initialize the ConfigurationList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource */ declare function ConfigurationList(version: V1): ConfigurationListInstance; @@ -73,9 +70,6 @@ declare class ConfigurationContext { /** * Initialize the ConfigurationContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource */ constructor(version: V1); @@ -110,9 +104,6 @@ declare class ConfigurationInstance extends SerializableClass { /** * Initialize the ConfigurationContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param payload - The instance payload */ @@ -156,9 +147,6 @@ declare class ConfigurationPage extends Page /** * Initialize the RolePage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution diff --git a/lib/rest/conversations/v1/role.js b/lib/rest/conversations/v1/role.js index a0ec7459c3..41f1cb111d 100644 --- a/lib/rest/conversations/v1/role.js +++ b/lib/rest/conversations/v1/role.js @@ -27,9 +27,6 @@ var RoleContext; /** * Initialize the RoleList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.RoleList * * @param {Twilio.Conversations.V1} version - Version of the resource @@ -394,9 +391,6 @@ RoleList = function RoleList(version) { /** * Initialize the RolePage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.RolePage * * @param {V1} version - Version of the resource @@ -461,9 +455,6 @@ RolePage.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the RoleContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.RoleInstance * * @property {string} sid - The unique string that identifies the resource @@ -479,7 +470,7 @@ RolePage.prototype[util.inspect.custom] = function inspect(depth, options) { * The ISO 8601 date and time in GMT when the resource was created * @property {Date} dateUpdated - * The ISO 8601 date and time in GMT when the resource was last updated - * @property {string} url - The absolute URL of the Role resource + * @property {string} url - An absolute URL for this user role. * * @param {V1} version - Version of the resource * @param {RolePayload} payload - The instance payload @@ -595,9 +586,6 @@ RoleInstance.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the RoleContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.RoleContext * * @param {V1} version - Version of the resource diff --git a/lib/rest/conversations/v1/service.d.ts b/lib/rest/conversations/v1/service.d.ts index 379515e30c..c4ff35bd6f 100644 --- a/lib/rest/conversations/v1/service.d.ts +++ b/lib/rest/conversations/v1/service.d.ts @@ -23,9 +23,6 @@ import { UserListInstance } from './service/user'; /** * Initialize the ServiceList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource */ declare function ServiceList(version: V1): ServiceListInstance; @@ -237,9 +234,6 @@ declare class ServiceContext { /** * Initialize the ServiceContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param sid - A 34 character string that uniquely identifies this resource. */ @@ -273,9 +267,6 @@ declare class ServiceInstance extends SerializableClass { /** * Initialize the ServiceContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param payload - The instance payload * @param sid - A 34 character string that uniquely identifies this resource. @@ -333,9 +324,6 @@ declare class ServicePage extends Page /** * Initialize the RolePage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution diff --git a/lib/rest/conversations/v1/service/role.js b/lib/rest/conversations/v1/service/role.js index c2517973ee..80707e8dcd 100644 --- a/lib/rest/conversations/v1/service/role.js +++ b/lib/rest/conversations/v1/service/role.js @@ -27,9 +27,6 @@ var RoleContext; /** * Initialize the RoleList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.RoleList * * @param {Twilio.Conversations.V1} version - Version of the resource @@ -401,9 +398,6 @@ RoleList = function RoleList(version, chatServiceSid) { /** * Initialize the RolePage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.RolePage * * @param {V1} version - Version of the resource @@ -468,9 +462,6 @@ RolePage.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the RoleContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.RoleInstance * * @property {string} sid - The unique string that identifies the resource @@ -486,7 +477,7 @@ RolePage.prototype[util.inspect.custom] = function inspect(depth, options) { * The ISO 8601 date and time in GMT when the resource was created * @property {Date} dateUpdated - * The ISO 8601 date and time in GMT when the resource was last updated - * @property {string} url - The absolute URL of the Role resource + * @property {string} url - An absolute URL for this user role. * * @param {V1} version - Version of the resource * @param {RolePayload} payload - The instance payload @@ -604,9 +595,6 @@ RoleInstance.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the RoleContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.RoleContext * * @param {V1} version - Version of the resource diff --git a/lib/rest/conversations/v1/service/user.d.ts b/lib/rest/conversations/v1/service/user.d.ts index 5cdcef50f1..691c58a421 100644 --- a/lib/rest/conversations/v1/service/user.d.ts +++ b/lib/rest/conversations/v1/service/user.d.ts @@ -10,28 +10,38 @@ import Response = require('../../../../http/response'); import V1 = require('../../V1'); import { SerializableClass } from '../../../../interfaces'; +type UserWebhookEnabledType = 'true'|'false'; + /** * Initialize the UserList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param chatServiceSid - The SID of the Conversation Service that the resource is associated with */ declare function UserList(version: V1, chatServiceSid: string): UserListInstance; +/** + * Options to pass to remove + * + * @property xTwilioWebhookEnabled - The X-Twilio-Webhook-Enabled HTTP request header + */ +interface UserInstanceRemoveOptions { + xTwilioWebhookEnabled?: UserWebhookEnabledType; +} + /** * Options to pass to update * * @property attributes - The JSON Object string that stores application-specific data * @property friendlyName - The string that you assigned to describe the resource * @property roleSid - The SID of a service-level Role to assign to the user + * @property xTwilioWebhookEnabled - The X-Twilio-Webhook-Enabled HTTP request header */ interface UserInstanceUpdateOptions { attributes?: string; friendlyName?: string; roleSid?: string; + xTwilioWebhookEnabled?: UserWebhookEnabledType; } interface UserListInstance { @@ -161,12 +171,14 @@ interface UserListInstance { * @property friendlyName - The string that you assigned to describe the resource * @property identity - The string that identifies the resource's User * @property roleSid - The SID of a service-level Role to assign to the user + * @property xTwilioWebhookEnabled - The X-Twilio-Webhook-Enabled HTTP request header */ interface UserListInstanceCreateOptions { attributes?: string; friendlyName?: string; identity: string; roleSid?: string; + xTwilioWebhookEnabled?: UserWebhookEnabledType; } /** @@ -252,9 +264,6 @@ declare class UserContext { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param chatServiceSid - The SID of the Conversation Service to fetch the resource from * @param sid - The SID of the User resource to fetch @@ -273,6 +282,13 @@ declare class UserContext { * @param callback - Callback to handle processed record */ remove(callback?: (error: Error | null, items: UserInstance) => any): Promise; + /** + * remove a UserInstance + * + * @param opts - Options for request + * @param callback - Callback to handle processed record + */ + remove(opts?: UserInstanceRemoveOptions, callback?: (error: Error | null, items: UserInstance) => any): Promise; /** * Provide a user-friendly representation */ @@ -297,9 +313,6 @@ declare class UserInstance extends SerializableClass { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param payload - The instance payload * @param chatServiceSid - The SID of the Conversation Service that the resource is associated with @@ -328,6 +341,13 @@ declare class UserInstance extends SerializableClass { * @param callback - Callback to handle processed record */ remove(callback?: (error: Error | null, items: UserInstance) => any): Promise; + /** + * remove a UserInstance + * + * @param opts - Options for request + * @param callback - Callback to handle processed record + */ + remove(opts?: UserInstanceRemoveOptions, callback?: (error: Error | null, items: UserInstance) => any): Promise; roleSid: string; sid: string; /** @@ -355,9 +375,6 @@ declare class UserPage extends Page /** * Initialize the UserPage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution @@ -376,4 +393,4 @@ declare class UserPage extends Page toJSON(): any; } -export { UserContext, UserInstance, UserInstanceUpdateOptions, UserList, UserListInstance, UserListInstanceCreateOptions, UserListInstanceEachOptions, UserListInstanceOptions, UserListInstancePageOptions, UserPage, UserPayload, UserResource, UserSolution } +export { UserContext, UserInstance, UserInstanceRemoveOptions, UserInstanceUpdateOptions, UserList, UserListInstance, UserListInstanceCreateOptions, UserListInstanceEachOptions, UserListInstanceOptions, UserListInstancePageOptions, UserPage, UserPayload, UserResource, UserSolution, UserWebhookEnabledType } diff --git a/lib/rest/conversations/v1/service/user.js b/lib/rest/conversations/v1/service/user.js index 2c453f702f..0ba80f710d 100644 --- a/lib/rest/conversations/v1/service/user.js +++ b/lib/rest/conversations/v1/service/user.js @@ -26,9 +26,6 @@ var UserContext; /** * Initialize the UserList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.UserList * * @param {Twilio.Conversations.V1} version - Version of the resource @@ -70,6 +67,8 @@ UserList = function UserList(version, chatServiceSid) { * The JSON Object string that stores application-specific data * @param {string} [opts.roleSid] - * The SID of a service-level Role to assign to the user + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance @@ -90,8 +89,9 @@ UserList = function UserList(version, chatServiceSid) { 'Attributes': _.get(opts, 'attributes'), 'RoleSid': _.get(opts, 'roleSid') }); + var headers = values.of({'X-Twilio-Webhook-Enabled': _.get(opts, 'xTwilioWebhookEnabled')}); - var promise = this._version.create({uri: this._uri, method: 'POST', data: data}); + var promise = this._version.create({uri: this._uri, method: 'POST', data: data, headers: headers}); promise = promise.then(function(payload) { deferred.resolve(new UserInstance( @@ -399,9 +399,6 @@ UserList = function UserList(version, chatServiceSid) { /** * Initialize the UserPage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.UserPage * * @param {V1} version - Version of the resource @@ -466,9 +463,6 @@ UserPage.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.UserInstance * * @property {string} sid - The unique string that identifies the resource @@ -488,7 +482,7 @@ UserPage.prototype[util.inspect.custom] = function inspect(depth, options) { * The ISO 8601 date and time in GMT when the resource was created * @property {Date} dateUpdated - * The ISO 8601 date and time in GMT when the resource was last updated - * @property {string} url - The absolute URL of the User resource + * @property {string} url - An absolute URL for this user. * * @param {V1} version - Version of the resource * @param {UserPayload} payload - The instance payload @@ -543,6 +537,8 @@ Object.defineProperty(UserInstance.prototype, * The JSON Object string that stores application-specific data * @param {string} [opts.roleSid] - * The SID of a service-level Role to assign to the user + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance @@ -559,13 +555,16 @@ UserInstance.prototype.update = function update(opts, callback) { * @function remove * @memberof Twilio.Conversations.V1.ServiceContext.UserInstance# * + * @param {object} [opts] - Options for request + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance */ /* jshint ignore:end */ -UserInstance.prototype.remove = function remove(callback) { - return this._proxy.remove(callback); +UserInstance.prototype.remove = function remove(opts, callback) { + return this._proxy.remove(opts, callback); }; /* jshint ignore:start */ @@ -613,9 +612,6 @@ UserInstance.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.ServiceContext.UserContext * * @param {V1} version - Version of the resource @@ -646,6 +642,8 @@ UserContext = function UserContext(version, chatServiceSid, sid) { * The JSON Object string that stores application-specific data * @param {string} [opts.roleSid] - * The SID of a service-level Role to assign to the user + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance @@ -664,8 +662,9 @@ UserContext.prototype.update = function update(opts, callback) { 'Attributes': _.get(opts, 'attributes'), 'RoleSid': _.get(opts, 'roleSid') }); + var headers = values.of({'X-Twilio-Webhook-Enabled': _.get(opts, 'xTwilioWebhookEnabled')}); - var promise = this._version.update({uri: this._uri, method: 'POST', data: data}); + var promise = this._version.update({uri: this._uri, method: 'POST', data: data, headers: headers}); promise = promise.then(function(payload) { deferred.resolve(new UserInstance( @@ -694,14 +693,25 @@ UserContext.prototype.update = function update(opts, callback) { * @function remove * @memberof Twilio.Conversations.V1.ServiceContext.UserContext# * + * @param {object} [opts] - Options for request + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance */ /* jshint ignore:end */ -UserContext.prototype.remove = function remove(callback) { +UserContext.prototype.remove = function remove(opts, callback) { + if (_.isFunction(opts)) { + callback = opts; + opts = {}; + } + opts = opts || {}; + var deferred = Q.defer(); - var promise = this._version.remove({uri: this._uri, method: 'DELETE'}); + var headers = values.of({'X-Twilio-Webhook-Enabled': _.get(opts, 'xTwilioWebhookEnabled')}); + + var promise = this._version.remove({uri: this._uri, method: 'DELETE', headers: headers}); promise = promise.then(function(payload) { deferred.resolve(payload); diff --git a/lib/rest/conversations/v1/user.d.ts b/lib/rest/conversations/v1/user.d.ts index 1f29626b76..3d6ee13734 100644 --- a/lib/rest/conversations/v1/user.d.ts +++ b/lib/rest/conversations/v1/user.d.ts @@ -10,27 +10,37 @@ import Response = require('../../../http/response'); import V1 = require('../V1'); import { SerializableClass } from '../../../interfaces'; +type UserWebhookEnabledType = 'true'|'false'; + /** * Initialize the UserList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource */ declare function UserList(version: V1): UserListInstance; +/** + * Options to pass to remove + * + * @property xTwilioWebhookEnabled - The X-Twilio-Webhook-Enabled HTTP request header + */ +interface UserInstanceRemoveOptions { + xTwilioWebhookEnabled?: UserWebhookEnabledType; +} + /** * Options to pass to update * * @property attributes - The JSON Object string that stores application-specific data * @property friendlyName - The string that you assigned to describe the resource * @property roleSid - The SID of a service-level Role to assign to the user + * @property xTwilioWebhookEnabled - The X-Twilio-Webhook-Enabled HTTP request header */ interface UserInstanceUpdateOptions { attributes?: string; friendlyName?: string; roleSid?: string; + xTwilioWebhookEnabled?: UserWebhookEnabledType; } interface UserListInstance { @@ -160,12 +170,14 @@ interface UserListInstance { * @property friendlyName - The string that you assigned to describe the resource * @property identity - The string that identifies the resource's User * @property roleSid - The SID of a service-level Role to assign to the user + * @property xTwilioWebhookEnabled - The X-Twilio-Webhook-Enabled HTTP request header */ interface UserListInstanceCreateOptions { attributes?: string; friendlyName?: string; identity: string; roleSid?: string; + xTwilioWebhookEnabled?: UserWebhookEnabledType; } /** @@ -250,9 +262,6 @@ declare class UserContext { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param sid - The SID of the User resource to fetch */ @@ -270,6 +279,13 @@ declare class UserContext { * @param callback - Callback to handle processed record */ remove(callback?: (error: Error | null, items: UserInstance) => any): Promise; + /** + * remove a UserInstance + * + * @param opts - Options for request + * @param callback - Callback to handle processed record + */ + remove(opts?: UserInstanceRemoveOptions, callback?: (error: Error | null, items: UserInstance) => any): Promise; /** * Provide a user-friendly representation */ @@ -294,9 +310,6 @@ declare class UserInstance extends SerializableClass { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param payload - The instance payload * @param sid - The SID of the User resource to fetch @@ -324,6 +337,13 @@ declare class UserInstance extends SerializableClass { * @param callback - Callback to handle processed record */ remove(callback?: (error: Error | null, items: UserInstance) => any): Promise; + /** + * remove a UserInstance + * + * @param opts - Options for request + * @param callback - Callback to handle processed record + */ + remove(opts?: UserInstanceRemoveOptions, callback?: (error: Error | null, items: UserInstance) => any): Promise; roleSid: string; sid: string; /** @@ -351,9 +371,6 @@ declare class UserPage extends Page /** * Initialize the UserPage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution @@ -372,4 +389,4 @@ declare class UserPage extends Page toJSON(): any; } -export { UserContext, UserInstance, UserInstanceUpdateOptions, UserList, UserListInstance, UserListInstanceCreateOptions, UserListInstanceEachOptions, UserListInstanceOptions, UserListInstancePageOptions, UserPage, UserPayload, UserResource, UserSolution } +export { UserContext, UserInstance, UserInstanceRemoveOptions, UserInstanceUpdateOptions, UserList, UserListInstance, UserListInstanceCreateOptions, UserListInstanceEachOptions, UserListInstanceOptions, UserListInstancePageOptions, UserPage, UserPayload, UserResource, UserSolution, UserWebhookEnabledType } diff --git a/lib/rest/conversations/v1/user.js b/lib/rest/conversations/v1/user.js index 93abf65a83..51cebc2b80 100644 --- a/lib/rest/conversations/v1/user.js +++ b/lib/rest/conversations/v1/user.js @@ -26,9 +26,6 @@ var UserContext; /** * Initialize the UserList * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.UserList * * @param {Twilio.Conversations.V1} version - Version of the resource @@ -68,6 +65,8 @@ UserList = function UserList(version) { * The JSON Object string that stores application-specific data * @param {string} [opts.roleSid] - * The SID of a service-level Role to assign to the user + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance @@ -88,8 +87,9 @@ UserList = function UserList(version) { 'Attributes': _.get(opts, 'attributes'), 'RoleSid': _.get(opts, 'roleSid') }); + var headers = values.of({'X-Twilio-Webhook-Enabled': _.get(opts, 'xTwilioWebhookEnabled')}); - var promise = this._version.create({uri: this._uri, method: 'POST', data: data}); + var promise = this._version.create({uri: this._uri, method: 'POST', data: data, headers: headers}); promise = promise.then(function(payload) { deferred.resolve(new UserInstance(this._version, payload, this._solution.sid)); @@ -392,9 +392,6 @@ UserList = function UserList(version) { /** * Initialize the UserPage * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.UserPage * * @param {V1} version - Version of the resource @@ -459,9 +456,6 @@ UserPage.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.UserInstance * * @property {string} sid - The unique string that identifies the resource @@ -481,7 +475,7 @@ UserPage.prototype[util.inspect.custom] = function inspect(depth, options) { * The ISO 8601 date and time in GMT when the resource was created * @property {Date} dateUpdated - * The ISO 8601 date and time in GMT when the resource was last updated - * @property {string} url - The absolute URL of the User resource + * @property {string} url - An absolute URL for this user. * * @param {V1} version - Version of the resource * @param {UserPayload} payload - The instance payload @@ -534,6 +528,8 @@ Object.defineProperty(UserInstance.prototype, * The JSON Object string that stores application-specific data * @param {string} [opts.roleSid] - * The SID of a service-level Role to assign to the user + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance @@ -550,13 +546,16 @@ UserInstance.prototype.update = function update(opts, callback) { * @function remove * @memberof Twilio.Conversations.V1.UserInstance# * + * @param {object} [opts] - Options for request + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance */ /* jshint ignore:end */ -UserInstance.prototype.remove = function remove(callback) { - return this._proxy.remove(callback); +UserInstance.prototype.remove = function remove(opts, callback) { + return this._proxy.remove(opts, callback); }; /* jshint ignore:start */ @@ -604,9 +603,6 @@ UserInstance.prototype[util.inspect.custom] = function inspect(depth, options) { /** * Initialize the UserContext * - * PLEASE NOTE that this class contains beta products that are subject to change. - * Use them with caution. - * * @constructor Twilio.Conversations.V1.UserContext * * @param {V1} version - Version of the resource @@ -635,6 +631,8 @@ UserContext = function UserContext(version, sid) { * The JSON Object string that stores application-specific data * @param {string} [opts.roleSid] - * The SID of a service-level Role to assign to the user + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance @@ -653,8 +651,9 @@ UserContext.prototype.update = function update(opts, callback) { 'Attributes': _.get(opts, 'attributes'), 'RoleSid': _.get(opts, 'roleSid') }); + var headers = values.of({'X-Twilio-Webhook-Enabled': _.get(opts, 'xTwilioWebhookEnabled')}); - var promise = this._version.update({uri: this._uri, method: 'POST', data: data}); + var promise = this._version.update({uri: this._uri, method: 'POST', data: data, headers: headers}); promise = promise.then(function(payload) { deferred.resolve(new UserInstance(this._version, payload, this._solution.sid)); @@ -678,14 +677,25 @@ UserContext.prototype.update = function update(opts, callback) { * @function remove * @memberof Twilio.Conversations.V1.UserContext# * + * @param {object} [opts] - Options for request + * @param {user.webhook_enabled_type} [opts.xTwilioWebhookEnabled] - + * The X-Twilio-Webhook-Enabled HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed UserInstance */ /* jshint ignore:end */ -UserContext.prototype.remove = function remove(callback) { +UserContext.prototype.remove = function remove(opts, callback) { + if (_.isFunction(opts)) { + callback = opts; + opts = {}; + } + opts = opts || {}; + var deferred = Q.defer(); - var promise = this._version.remove({uri: this._uri, method: 'DELETE'}); + var headers = values.of({'X-Twilio-Webhook-Enabled': _.get(opts, 'xTwilioWebhookEnabled')}); + + var promise = this._version.remove({uri: this._uri, method: 'DELETE', headers: headers}); promise = promise.then(function(payload) { deferred.resolve(payload); diff --git a/lib/rest/serverless/v1/service/build.d.ts b/lib/rest/serverless/v1/service/build.d.ts index ac0bd77a6c..e77dd31f06 100644 --- a/lib/rest/serverless/v1/service/build.d.ts +++ b/lib/rest/serverless/v1/service/build.d.ts @@ -8,6 +8,8 @@ import Page = require('../../../../base/Page'); import Response = require('../../../../http/response'); import V1 = require('../../V1'); +import { BuildStatusList } from './build/buildStatus'; +import { BuildStatusListInstance } from './build/buildStatus'; import { SerializableClass } from '../../../../interfaces'; type BuildStatus = 'building'|'completed'|'failed'; @@ -230,6 +232,7 @@ interface BuildResource { date_updated: Date; dependencies: object[]; function_versions: object[]; + links: string; service_sid: string; sid: string; status: BuildStatus; @@ -255,6 +258,7 @@ declare class BuildContext { */ constructor(version: V1, serviceSid: string, sid: string); + buildStatus: BuildStatusListInstance; /** * fetch a BuildInstance * @@ -292,6 +296,10 @@ declare class BuildInstance extends SerializableClass { private _proxy: BuildContext; accountSid: string; assetVersions: object[]; + /** + * Access the buildStatus + */ + buildStatus(): BuildStatusListInstance; dateCreated: Date; dateUpdated: Date; dependencies: object[]; @@ -302,6 +310,7 @@ declare class BuildInstance extends SerializableClass { */ fetch(callback?: (error: Error | null, items: BuildInstance) => any): Promise; functionVersions: object[]; + links: string; /** * remove a BuildInstance * diff --git a/lib/rest/serverless/v1/service/build.js b/lib/rest/serverless/v1/service/build.js index 9fc7a7c858..f4f98c6c1c 100644 --- a/lib/rest/serverless/v1/service/build.js +++ b/lib/rest/serverless/v1/service/build.js @@ -12,6 +12,7 @@ var Q = require('q'); /* jshint ignore:line */ var _ = require('lodash'); /* jshint ignore:line */ var util = require('util'); /* jshint ignore:line */ +var BuildStatusList = require('./build/buildStatus').BuildStatusList; var Page = require('../../../../base/Page'); /* jshint ignore:line */ var deserialize = require( '../../../../base/deserialize'); /* jshint ignore:line */ @@ -489,6 +490,7 @@ BuildPage.prototype[util.inspect.custom] = function inspect(depth, options) { * @property {Date} dateUpdated - * The ISO 8601 date and time in GMT when the Build resource was last updated * @property {string} url - The absolute URL of the Build resource + * @property {string} links - The links * * @param {V1} version - Version of the resource * @param {BuildPayload} payload - The instance payload @@ -511,6 +513,7 @@ BuildInstance = function BuildInstance(version, payload, serviceSid, sid) { this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line this.url = payload.url; // jshint ignore:line + this.links = payload.links; // jshint ignore:line // Context this._context = undefined; @@ -560,6 +563,20 @@ BuildInstance.prototype.remove = function remove(callback) { return this._proxy.remove(callback); }; +/* jshint ignore:start */ +/** + * Access the buildStatus + * + * @function buildStatus + * @memberof Twilio.Serverless.V1.ServiceContext.BuildInstance# + * + * @returns {Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusList} + */ +/* jshint ignore:end */ +BuildInstance.prototype.buildStatus = function buildStatus() { + return this._proxy.buildStatus; +}; + /* jshint ignore:start */ /** * Provide a user-friendly representation @@ -596,6 +613,9 @@ BuildInstance.prototype[util.inspect.custom] = function inspect(depth, options) * * @constructor Twilio.Serverless.V1.ServiceContext.BuildContext * + * @property {Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusList} buildStatus - + * buildStatus resource + * * @param {V1} version - Version of the resource * @param {sid_like} serviceSid - * The SID of the Service to fetch the Build resource from @@ -608,6 +628,9 @@ BuildContext = function BuildContext(version, serviceSid, sid) { // Path Solution this._solution = {serviceSid: serviceSid, sid: sid, }; this._uri = `/Services/${serviceSid}/Builds/${sid}`; + + // Dependents + this._buildStatus = undefined; }; /* jshint ignore:start */ @@ -677,6 +700,20 @@ BuildContext.prototype.remove = function remove(callback) { return deferred.promise; }; +Object.defineProperty(BuildContext.prototype, + 'buildStatus', { + get: function() { + if (!this._buildStatus) { + this._buildStatus = new BuildStatusList( + this._version, + this._solution.serviceSid, + this._solution.sid + ); + } + return this._buildStatus; + } +}); + /* jshint ignore:start */ /** * Provide a user-friendly representation diff --git a/lib/rest/serverless/v1/service/build/buildStatus.d.ts b/lib/rest/serverless/v1/service/build/buildStatus.d.ts new file mode 100644 index 0000000000..acde0d8f01 --- /dev/null +++ b/lib/rest/serverless/v1/service/build/buildStatus.d.ts @@ -0,0 +1,147 @@ +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +import Page = require('../../../../../base/Page'); +import Response = require('../../../../../http/response'); +import V1 = require('../../../V1'); +import { SerializableClass } from '../../../../../interfaces'; + +type BuildStatusStatus = 'building'|'completed'|'failed'; + +/** + * Initialize the BuildStatusList + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @param version - Version of the resource + * @param serviceSid - The SID of the Service that the Build resource is associated with + * @param sid - The unique string that identifies the Build resource + */ +declare function BuildStatusList(version: V1, serviceSid: string, sid: string): BuildStatusListInstance; + +interface BuildStatusListInstance { + /** + * @param sid - sid of instance + */ + (sid: string): BuildStatusContext; + /** + * Constructs a build_status + */ + get(): BuildStatusContext; + /** + * Provide a user-friendly representation + */ + toJSON(): any; +} + +interface BuildStatusPayload extends BuildStatusResource, Page.TwilioResponsePayload { +} + +interface BuildStatusResource { + account_sid: string; + service_sid: string; + sid: string; + status: BuildStatusStatus; + url: string; +} + +interface BuildStatusSolution { + serviceSid?: string; + sid?: string; +} + + +declare class BuildStatusContext { + /** + * Initialize the BuildStatusContext + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @param version - Version of the resource + * @param serviceSid - The SID of the Service to fetch the Build resource from + * @param sid - The SID of the Build resource to fetch + */ + constructor(version: V1, serviceSid: string, sid: string); + + /** + * fetch a BuildStatusInstance + * + * @param callback - Callback to handle processed record + */ + fetch(callback?: (error: Error | null, items: BuildStatusInstance) => any): Promise; + /** + * Provide a user-friendly representation + */ + toJSON(): any; +} + + +declare class BuildStatusInstance extends SerializableClass { + /** + * Initialize the BuildStatusContext + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @param version - Version of the resource + * @param payload - The instance payload + * @param serviceSid - The SID of the Service that the Build resource is associated with + * @param sid - The unique string that identifies the Build resource + */ + constructor(version: V1, payload: BuildStatusPayload, serviceSid: string, sid: string); + + private _proxy: BuildStatusContext; + accountSid: string; + /** + * fetch a BuildStatusInstance + * + * @param callback - Callback to handle processed record + */ + fetch(callback?: (error: Error | null, items: BuildStatusInstance) => any): Promise; + serviceSid: string; + sid: string; + status: BuildStatusStatus; + /** + * Provide a user-friendly representation + */ + toJSON(): any; + url: string; +} + + +declare class BuildStatusPage extends Page { + /** + * Initialize the BuildStatusPage + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @param version - Version of the resource + * @param response - Response from the API + * @param solution - Path solution + */ + constructor(version: V1, response: Response, solution: BuildStatusSolution); + + /** + * Build an instance of BuildStatusInstance + * + * @param payload - Payload response from the API + */ + getInstance(payload: BuildStatusPayload): BuildStatusInstance; + /** + * Provide a user-friendly representation + */ + toJSON(): any; +} + +export { BuildStatusContext, BuildStatusInstance, BuildStatusList, BuildStatusListInstance, BuildStatusPage, BuildStatusPayload, BuildStatusResource, BuildStatusSolution, BuildStatusStatus } diff --git a/lib/rest/serverless/v1/service/build/buildStatus.js b/lib/rest/serverless/v1/service/build/buildStatus.js new file mode 100644 index 0000000000..cf63adac14 --- /dev/null +++ b/lib/rest/serverless/v1/service/build/buildStatus.js @@ -0,0 +1,350 @@ +'use strict'; + +/* jshint ignore:start */ +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ +/* jshint ignore:end */ + +var Q = require('q'); /* jshint ignore:line */ +var _ = require('lodash'); /* jshint ignore:line */ +var util = require('util'); /* jshint ignore:line */ +var Page = require('../../../../../base/Page'); /* jshint ignore:line */ +var values = require('../../../../../base/values'); /* jshint ignore:line */ + +var BuildStatusList; +var BuildStatusPage; +var BuildStatusInstance; +var BuildStatusContext; + +/* jshint ignore:start */ +/** + * Initialize the BuildStatusList + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @constructor Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusList + * + * @param {Twilio.Serverless.V1} version - Version of the resource + * @param {string} serviceSid - + * The SID of the Service that the Build resource is associated with + * @param {string} sid - The unique string that identifies the Build resource + */ +/* jshint ignore:end */ +BuildStatusList = function BuildStatusList(version, serviceSid, sid) { + /* jshint ignore:start */ + /** + * @function buildStatus + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext# + * + * @param {string} sid - sid of instance + * + * @returns {Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusContext} + */ + /* jshint ignore:end */ + function BuildStatusListInstance(sid) { + return BuildStatusListInstance.get(sid); + } + + BuildStatusListInstance._version = version; + // Path Solution + BuildStatusListInstance._solution = {serviceSid: serviceSid, sid: sid}; + /* jshint ignore:start */ + /** + * Constructs a build_status + * + * @function get + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusList# + * + * @returns {Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusContext} + */ + /* jshint ignore:end */ + BuildStatusListInstance.get = function get() { + return new BuildStatusContext(this._version, this._solution.serviceSid, this._solution.sid); + }; + + /* jshint ignore:start */ + /** + * Provide a user-friendly representation + * + * @function toJSON + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusList# + * + * @returns Object + */ + /* jshint ignore:end */ + BuildStatusListInstance.toJSON = function toJSON() { + return this._solution; + }; + + BuildStatusListInstance[util.inspect.custom] = function inspect(depth, options) + { + return util.inspect(this.toJSON(), options); + }; + + return BuildStatusListInstance; +}; + + +/* jshint ignore:start */ +/** + * Initialize the BuildStatusPage + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @constructor Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusPage + * + * @param {V1} version - Version of the resource + * @param {Response} response - Response from the API + * @param {BuildStatusSolution} solution - Path solution + * + * @returns BuildStatusPage + */ +/* jshint ignore:end */ +BuildStatusPage = function BuildStatusPage(version, response, solution) { + // Path Solution + this._solution = solution; + + Page.prototype.constructor.call(this, version, response, this._solution); +}; + +_.extend(BuildStatusPage.prototype, Page.prototype); +BuildStatusPage.prototype.constructor = BuildStatusPage; + +/* jshint ignore:start */ +/** + * Build an instance of BuildStatusInstance + * + * @function getInstance + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusPage# + * + * @param {BuildStatusPayload} payload - Payload response from the API + * + * @returns BuildStatusInstance + */ +/* jshint ignore:end */ +BuildStatusPage.prototype.getInstance = function getInstance(payload) { + return new BuildStatusInstance( + this._version, + payload, + this._solution.serviceSid, + this._solution.sid + ); +}; + +/* jshint ignore:start */ +/** + * Provide a user-friendly representation + * + * @function toJSON + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusPage# + * + * @returns Object + */ +/* jshint ignore:end */ +BuildStatusPage.prototype.toJSON = function toJSON() { + let clone = {}; + _.forOwn(this, function(value, key) { + if (!_.startsWith(key, '_') && ! _.isFunction(value)) { + clone[key] = value; + } + }); + return clone; +}; + +BuildStatusPage.prototype[util.inspect.custom] = function inspect(depth, + options) { + return util.inspect(this.toJSON(), options); +}; + + +/* jshint ignore:start */ +/** + * Initialize the BuildStatusContext + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @constructor Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusInstance + * + * @property {string} sid - The unique string that identifies the Build resource + * @property {string} accountSid - + * The SID of the Account that created the Build resource + * @property {string} serviceSid - + * The SID of the Service that the Build resource is associated with + * @property {build_status.status} status - The status of the Build + * @property {string} url - The absolute URL of the Build Status resource + * + * @param {V1} version - Version of the resource + * @param {BuildStatusPayload} payload - The instance payload + * @param {sid} serviceSid - + * The SID of the Service that the Build resource is associated with + * @param {sid} sid - The unique string that identifies the Build resource + */ +/* jshint ignore:end */ +BuildStatusInstance = function BuildStatusInstance(version, payload, serviceSid, + sid) { + this._version = version; + + // Marshaled Properties + this.sid = payload.sid; // jshint ignore:line + this.accountSid = payload.account_sid; // jshint ignore:line + this.serviceSid = payload.service_sid; // jshint ignore:line + this.status = payload.status; // jshint ignore:line + this.url = payload.url; // jshint ignore:line + + // Context + this._context = undefined; + this._solution = {serviceSid: serviceSid, sid: sid, }; +}; + +Object.defineProperty(BuildStatusInstance.prototype, + '_proxy', { + get: function() { + if (!this._context) { + this._context = new BuildStatusContext( + this._version, + this._solution.serviceSid, + this._solution.sid + ); + } + + return this._context; + } +}); + +/* jshint ignore:start */ +/** + * fetch a BuildStatusInstance + * + * @function fetch + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusInstance# + * + * @param {function} [callback] - Callback to handle processed record + * + * @returns {Promise} Resolves to processed BuildStatusInstance + */ +/* jshint ignore:end */ +BuildStatusInstance.prototype.fetch = function fetch(callback) { + return this._proxy.fetch(callback); +}; + +/* jshint ignore:start */ +/** + * Provide a user-friendly representation + * + * @function toJSON + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusInstance# + * + * @returns Object + */ +/* jshint ignore:end */ +BuildStatusInstance.prototype.toJSON = function toJSON() { + let clone = {}; + _.forOwn(this, function(value, key) { + if (!_.startsWith(key, '_') && ! _.isFunction(value)) { + clone[key] = value; + } + }); + return clone; +}; + +BuildStatusInstance.prototype[util.inspect.custom] = function inspect(depth, + options) { + return util.inspect(this.toJSON(), options); +}; + + +/* jshint ignore:start */ +/** + * Initialize the BuildStatusContext + * + * PLEASE NOTE that this class contains preview products that are subject to + * change. Use them with caution. If you currently do not have developer preview + * access, please contact help@twilio.com. + * + * @constructor Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusContext + * + * @param {V1} version - Version of the resource + * @param {sid_like} serviceSid - + * The SID of the Service to fetch the Build resource from + * @param {sid} sid - The SID of the Build resource to fetch + */ +/* jshint ignore:end */ +BuildStatusContext = function BuildStatusContext(version, serviceSid, sid) { + this._version = version; + + // Path Solution + this._solution = {serviceSid: serviceSid, sid: sid, }; + this._uri = `/Services/${serviceSid}/Builds/${sid}/Status`; +}; + +/* jshint ignore:start */ +/** + * fetch a BuildStatusInstance + * + * @function fetch + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusContext# + * + * @param {function} [callback] - Callback to handle processed record + * + * @returns {Promise} Resolves to processed BuildStatusInstance + */ +/* jshint ignore:end */ +BuildStatusContext.prototype.fetch = function fetch(callback) { + var deferred = Q.defer(); + var promise = this._version.fetch({uri: this._uri, method: 'GET'}); + + promise = promise.then(function(payload) { + deferred.resolve(new BuildStatusInstance( + this._version, + payload, + this._solution.serviceSid, + this._solution.sid + )); + }.bind(this)); + + promise.catch(function(error) { + deferred.reject(error); + }); + + if (_.isFunction(callback)) { + deferred.promise.nodeify(callback); + } + + return deferred.promise; +}; + +/* jshint ignore:start */ +/** + * Provide a user-friendly representation + * + * @function toJSON + * @memberof Twilio.Serverless.V1.ServiceContext.BuildContext.BuildStatusContext# + * + * @returns Object + */ +/* jshint ignore:end */ +BuildStatusContext.prototype.toJSON = function toJSON() { + return this._solution; +}; + +BuildStatusContext.prototype[util.inspect.custom] = function inspect(depth, + options) { + return util.inspect(this.toJSON(), options); +}; + +module.exports = { + BuildStatusList: BuildStatusList, + BuildStatusPage: BuildStatusPage, + BuildStatusInstance: BuildStatusInstance, + BuildStatusContext: BuildStatusContext +}; diff --git a/lib/rest/verify/v2/service/entity/factor.d.ts b/lib/rest/verify/v2/service/entity/factor.d.ts index 35ebdd26c6..8821b792dc 100644 --- a/lib/rest/verify/v2/service/entity/factor.d.ts +++ b/lib/rest/verify/v2/service/entity/factor.d.ts @@ -183,7 +183,6 @@ interface FactorListInstance { /** * Options to pass to create * - * @property authorization - The Authorization HTTP request header * @property binding - A unique binding for this Factor as a json string * @property config - The config for this Factor as a json string * @property factorType - The Type of this Factor @@ -191,7 +190,6 @@ interface FactorListInstance { * @property twilioSandboxMode - The Twilio-Sandbox-Mode HTTP request header */ interface FactorListInstanceCreateOptions { - authorization?: string; binding: string; config: string; factorType: FactorFactorTypes; diff --git a/lib/rest/verify/v2/service/entity/factor.js b/lib/rest/verify/v2/service/entity/factor.js index 85f8ea8b90..26d343ecbd 100644 --- a/lib/rest/verify/v2/service/entity/factor.js +++ b/lib/rest/verify/v2/service/entity/factor.js @@ -70,7 +70,6 @@ FactorList = function FactorList(version, serviceSid, identity) { * @param {string} opts.config - The config for this Factor as a json string * @param {string} [opts.twilioSandboxMode] - * The Twilio-Sandbox-Mode HTTP request header - * @param {string} [opts.authorization] - The Authorization HTTP request header * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed FactorInstance @@ -100,10 +99,7 @@ FactorList = function FactorList(version, serviceSid, identity) { 'FactorType': _.get(opts, 'factorType'), 'Config': _.get(opts, 'config') }); - var headers = values.of({ - 'Twilio-Sandbox-Mode': _.get(opts, 'twilioSandboxMode'), - 'Authorization': _.get(opts, 'authorization') - }); + var headers = values.of({'Twilio-Sandbox-Mode': _.get(opts, 'twilioSandboxMode')}); var promise = this._version.create({uri: this._uri, method: 'POST', data: data, headers: headers}); diff --git a/lib/rest/video/v1/room.d.ts b/lib/rest/video/v1/room.d.ts index d4c2858299..18efa9f252 100644 --- a/lib/rest/video/v1/room.d.ts +++ b/lib/rest/video/v1/room.d.ts @@ -16,7 +16,7 @@ import { SerializableClass } from '../../../interfaces'; type RoomRoomStatus = 'in-progress'|'completed'|'failed'; -type RoomRoomType = 'peer-to-peer-basic'|'peer-to-peer'|'group'|'group-small'; +type RoomRoomType = 'go'|'peer-to-peer'|'group'|'group-small'; type RoomVideoCodec = 'VP8'|'H264'; diff --git a/spec/integration/rest/api/v2010/account/conference/participant.spec.js b/spec/integration/rest/api/v2010/account/conference/participant.spec.js index bc993e7d11..9b4c737871 100644 --- a/spec/integration/rest/api/v2010/account/conference/participant.spec.js +++ b/spec/integration/rest/api/v2010/account/conference/participant.spec.js @@ -529,6 +529,39 @@ describe('Participant', function() { }).done(); } ); + it('should generate valid create_with_friendly_name_reason response', + function(done) { + var body = { + 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'call_sid': 'CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'label': null, + 'conference_sid': 'CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'date_created': 'Fri, 18 Feb 2011 21:07:19 +0000', + 'date_updated': 'Fri, 18 Feb 2011 21:07:19 +0000', + 'end_conference_on_exit': false, + 'muted': false, + 'hold': false, + 'status': 'complete', + 'start_conference_on_enter': true, + 'coaching': false, + 'call_sid_to_coach': null, + 'uri': '/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conferences/CFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json' + }; + + holodeck.mock(new Response(201, body)); + + var opts = {from: '+15017122661', to: '+15558675310'}; + var promise = client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .participants.create(opts); + promise.then(function(response) { + expect(response).toBeDefined(); + done(); + }, function() { + throw new Error('failed'); + }).done(); + } + ); it('should generate valid remove request', function(done) { holodeck.mock(new Response(500, {})); diff --git a/spec/integration/rest/conversations/v1/service/user.spec.js b/spec/integration/rest/conversations/v1/service/user.spec.js index 74a24643a7..ff1f773d4b 100644 --- a/spec/integration/rest/conversations/v1/service/user.spec.js +++ b/spec/integration/rest/conversations/v1/service/user.spec.js @@ -33,7 +33,7 @@ describe('User', function() { function(done) { holodeck.mock(new Response(500, {})); - var opts = {identity: 'identity'}; + var opts = {identity: 'identity', xTwilioWebhookEnabled: 'true'}; var promise = client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .users.create(opts); promise.then(function() { @@ -52,6 +52,13 @@ describe('User', function() { url: url, data: values })); + + var headers = {'X-Twilio-Webhook-Enabled': 'true'}; + holodeck.assertHasRequest(new Request({ + method: 'POST', + url: url, + headers: headers + })); } ); it('should generate valid create response', @@ -87,8 +94,9 @@ describe('User', function() { function(done) { holodeck.mock(new Response(500, {})); + var opts = {xTwilioWebhookEnabled: 'true'}; var promise = client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(); + .users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(opts); promise.then(function() { throw new Error('failed'); }, function(error) { @@ -100,9 +108,11 @@ describe('User', function() { var sid = 'USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://conversations.twilio.com/v1/Services/${chatServiceSid}/Users/${sid}`; + var headers = {'X-Twilio-Webhook-Enabled': 'true'}; holodeck.assertHasRequest(new Request({ method: 'POST', - url: url + url: url, + headers: headers })); } ); @@ -138,8 +148,9 @@ describe('User', function() { function(done) { holodeck.mock(new Response(500, {})); + var opts = {xTwilioWebhookEnabled: 'true'}; var promise = client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(); + .users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(opts); promise.then(function() { throw new Error('failed'); }, function(error) { @@ -151,9 +162,11 @@ describe('User', function() { var sid = 'USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://conversations.twilio.com/v1/Services/${chatServiceSid}/Users/${sid}`; + var headers = {'X-Twilio-Webhook-Enabled': 'true'}; holodeck.assertHasRequest(new Request({ method: 'DELETE', - url: url + url: url, + headers: headers })); } ); diff --git a/spec/integration/rest/conversations/v1/user.spec.js b/spec/integration/rest/conversations/v1/user.spec.js index 29b3278eee..4a6c86a3d6 100644 --- a/spec/integration/rest/conversations/v1/user.spec.js +++ b/spec/integration/rest/conversations/v1/user.spec.js @@ -33,7 +33,7 @@ describe('User', function() { function(done) { holodeck.mock(new Response(500, {})); - var opts = {identity: 'identity'}; + var opts = {identity: 'identity', xTwilioWebhookEnabled: 'true'}; var promise = client.conversations.v1.users.create(opts); promise.then(function() { throw new Error('failed'); @@ -50,6 +50,13 @@ describe('User', function() { url: url, data: values })); + + var headers = {'X-Twilio-Webhook-Enabled': 'true'}; + holodeck.assertHasRequest(new Request({ + method: 'POST', + url: url, + headers: headers + })); } ); it('should generate valid create response', @@ -84,7 +91,8 @@ describe('User', function() { function(done) { holodeck.mock(new Response(500, {})); - var promise = client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(); + var opts = {xTwilioWebhookEnabled: 'true'}; + var promise = client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(opts); promise.then(function() { throw new Error('failed'); }, function(error) { @@ -95,9 +103,11 @@ describe('User', function() { var sid = 'USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://conversations.twilio.com/v1/Users/${sid}`; + var headers = {'X-Twilio-Webhook-Enabled': 'true'}; holodeck.assertHasRequest(new Request({ method: 'POST', - url: url + url: url, + headers: headers })); } ); @@ -132,7 +142,8 @@ describe('User', function() { function(done) { holodeck.mock(new Response(500, {})); - var promise = client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(); + var opts = {xTwilioWebhookEnabled: 'true'}; + var promise = client.conversations.v1.users('USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(opts); promise.then(function() { throw new Error('failed'); }, function(error) { @@ -143,9 +154,11 @@ describe('User', function() { var sid = 'USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://conversations.twilio.com/v1/Users/${sid}`; + var headers = {'X-Twilio-Webhook-Enabled': 'true'}; holodeck.assertHasRequest(new Request({ method: 'DELETE', - url: url + url: url, + headers: headers })); } ); diff --git a/spec/integration/rest/serverless/v1/service/build.spec.js b/spec/integration/rest/serverless/v1/service/build.spec.js index 9293822cd4..86c9f7c573 100644 --- a/spec/integration/rest/serverless/v1/service/build.spec.js +++ b/spec/integration/rest/serverless/v1/service/build.spec.js @@ -138,7 +138,10 @@ describe('Build', function() { 'status': 'deploying', 'date_created': '2018-11-10T20:00:00Z', 'date_updated': '2018-11-10T20:00:00Z', - 'url': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000' + 'url': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000', + 'links': { + 'build_status': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000/Status' + } }; holodeck.mock(new Response(200, body)); @@ -251,7 +254,10 @@ describe('Build', function() { 'status': 'building', 'date_created': '2018-11-10T20:00:00Z', 'date_updated': '2018-11-10T20:00:00Z', - 'url': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000' + 'url': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000', + 'links': { + 'build_status': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000/Status' + } }; holodeck.mock(new Response(201, body)); diff --git a/spec/integration/rest/serverless/v1/service/build/buildStatus.spec.js b/spec/integration/rest/serverless/v1/service/build/buildStatus.spec.js new file mode 100644 index 0000000000..d7f327868a --- /dev/null +++ b/spec/integration/rest/serverless/v1/service/build/buildStatus.spec.js @@ -0,0 +1,79 @@ +'use strict'; + +/* jshint ignore:start */ +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ +/* jshint ignore:end */ + +var Holodeck = require('../../../../../holodeck'); /* jshint ignore:line */ +var Request = require( + '../../../../../../../lib/http/request'); /* jshint ignore:line */ +var Response = require( + '../../../../../../../lib/http/response'); /* jshint ignore:line */ +var RestException = require( + '../../../../../../../lib/base/RestException'); /* jshint ignore:line */ +var Twilio = require('../../../../../../../lib'); /* jshint ignore:line */ + + +var client; +var holodeck; + +describe('BuildStatus', function() { + beforeEach(function() { + holodeck = new Holodeck(); + client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', { + httpClient: holodeck + }); + }); + it('should generate valid fetch request', + function(done) { + holodeck.mock(new Response(500, {})); + + var promise = client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .buildStatus().fetch(); + promise.then(function() { + throw new Error('failed'); + }, function(error) { + expect(error.constructor).toBe(RestException.prototype.constructor); + done(); + }).done(); + + var serviceSid = 'ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; + var sid = 'ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; + var url = `https://serverless.twilio.com/v1/Services/${serviceSid}/Builds/${sid}/Status`; + + holodeck.assertHasRequest(new Request({ + method: 'GET', + url: url + })); + } + ); + it('should generate valid fetch response', + function(done) { + var body = { + 'sid': 'ZB00000000000000000000000000000000', + 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'service_sid': 'ZS00000000000000000000000000000000', + 'status': 'completed', + 'url': 'https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds/ZB00000000000000000000000000000000/Status' + }; + + holodeck.mock(new Response(200, body)); + + var promise = client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') + .buildStatus().fetch(); + promise.then(function(response) { + expect(response).toBeDefined(); + done(); + }, function() { + throw new Error('failed'); + }).done(); + } + ); +}); diff --git a/spec/integration/rest/verify/v2/service/entity/factor.spec.js b/spec/integration/rest/verify/v2/service/entity/factor.spec.js index 9fccd03f0f..9d7f59e175 100644 --- a/spec/integration/rest/verify/v2/service/entity/factor.spec.js +++ b/spec/integration/rest/verify/v2/service/entity/factor.spec.js @@ -38,8 +38,7 @@ describe('Factor', function() { friendlyName: 'friendly_name', factorType: 'push', config: 'config', - twilioSandboxMode: 'twilio_sandbox_mode', - authorization: 'authorization' + twilioSandboxMode: 'twilio_sandbox_mode' }; var promise = client.verify.v2.services('VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .entities('identity') @@ -67,7 +66,7 @@ describe('Factor', function() { data: values })); - var headers = {'Twilio-Sandbox-Mode': 'twilio_sandbox_mode', 'Authorization': 'authorization'}; + var headers = {'Twilio-Sandbox-Mode': 'twilio_sandbox_mode'}; holodeck.assertHasRequest(new Request({ method: 'POST', url: url, diff --git a/spec/integration/rest/video/v1/room.spec.js b/spec/integration/rest/video/v1/room.spec.js index d8d5b0b404..8d812f0d68 100644 --- a/spec/integration/rest/video/v1/room.spec.js +++ b/spec/integration/rest/video/v1/room.spec.js @@ -148,14 +148,14 @@ describe('Room', function() { }).done(); } ); - it('should generate valid create_p2p_basic response', + it('should generate valid create_webrtc_go response', function(done) { var body = { 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T20:00:00Z', 'date_updated': '2015-07-30T20:00:00Z', 'status': 'in-progress', - 'type': 'peer-to-peer-basic', + 'type': 'go', 'sid': 'RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'enable_turn': true, 'unique_name': 'room1',