diff --git a/CHANGES.md b/CHANGES.md index 7b9b1ef8d2..3a7c03a7e6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,29 @@ twilio-node changelog ===================== +[2020-03-18] Version 3.41.0 +--------------------------- +**Library - Fix** +- [PR #546](https://github.com/twilio/twilio-node/pull/546): Page JSON parsing and integration tests. Thanks to [@eshanholtz](https://github.com/eshanholtz)! +- [PR #545](https://github.com/twilio/twilio-node/pull/545): add overloaded TS definitions for non-required params. Thanks to [@childish-sambino](https://github.com/childish-sambino)! +- [PR #544](https://github.com/twilio/twilio-node/pull/544): Add method overload to VoiceResponse.prototype.play. Thanks to [@DCtheTall](https://github.com/DCtheTall)! +- [PR #543](https://github.com/twilio/twilio-node/pull/543): don't re-parse parsed JSON. Thanks to [@eshanholtz](https://github.com/eshanholtz)! + +**Library - Feature** +- [PR #542](https://github.com/twilio/twilio-node/pull/542): migrate from deprecated request module to axios. Thanks to [@eshanholtz](https://github.com/eshanholtz)! + +**Api** +- Add optional `emergency_calling_enabled` parameter to SIP Domain +- Add optional property `call_reason` in the call create request + +**Authy** +- Added `friendly_name` and `config` as optional params to Factor update +- Added `config` param to Factor creation **(breaking change)** + +**Preview** +- Renamed `SuccessRate` endpoint to `ImpressionsRate` for Branded Calls (fka. Verified by Twilio) **(breaking change)** + + [2020-03-04] Version 3.40.0 --------------------------- **Library - Docs** diff --git a/lib/rest/api/v2010/account/call.d.ts b/lib/rest/api/v2010/account/call.d.ts index 27b786acf8..8e281cbf5a 100644 --- a/lib/rest/api/v2010/account/call.d.ts +++ b/lib/rest/api/v2010/account/call.d.ts @@ -185,6 +185,7 @@ interface CallListInstance { * @property asyncAmdStatusCallback - The URL we should call to send amd status information to your application * @property asyncAmdStatusCallbackMethod - HTTP Method to use with async_amd_status_callback * @property byoc - BYOC trunk SID (Beta) + * @property callReason - Reason for the call (Beta) * @property callerId - The phone number, SIP address, or Client identifier that made this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. * @property fallbackMethod - HTTP Method to use with fallback_url * @property fallbackUrl - Fallback URL in case of error @@ -218,6 +219,7 @@ interface CallListInstanceCreateOptions { asyncAmdStatusCallback?: string; asyncAmdStatusCallbackMethod?: string; byoc?: string; + callReason?: string; callerId?: string; fallbackMethod?: string; fallbackUrl?: string; diff --git a/lib/rest/api/v2010/account/call.js b/lib/rest/api/v2010/account/call.js index 70989bd530..b79105ad50 100644 --- a/lib/rest/api/v2010/account/call.js +++ b/lib/rest/api/v2010/account/call.js @@ -117,6 +117,7 @@ CallList = function CallList(version, accountSid) { * @param {string} [opts.asyncAmdStatusCallbackMethod] - * HTTP Method to use with async_amd_status_callback * @param {string} [opts.byoc] - BYOC trunk SID (Beta) + * @param {string} [opts.callReason] - Reason for the call (Beta) * @param {string} [opts.url] - The absolute URL that returns TwiML for this call * @param {string} [opts.twiml] - TwiML instructions for the call * @param {string} [opts.applicationSid] - @@ -169,7 +170,8 @@ CallList = function CallList(version, accountSid) { 'AsyncAmd': _.get(opts, 'asyncAmd'), 'AsyncAmdStatusCallback': _.get(opts, 'asyncAmdStatusCallback'), 'AsyncAmdStatusCallbackMethod': _.get(opts, 'asyncAmdStatusCallbackMethod'), - 'Byoc': _.get(opts, 'byoc') + 'Byoc': _.get(opts, 'byoc'), + 'CallReason': _.get(opts, 'callReason') }); var promise = this._version.create({uri: this._uri, method: 'POST', data: data}); diff --git a/lib/rest/api/v2010/account/sip/domain.d.ts b/lib/rest/api/v2010/account/sip/domain.d.ts index 64b0e9be45..a627de45d2 100644 --- a/lib/rest/api/v2010/account/sip/domain.d.ts +++ b/lib/rest/api/v2010/account/sip/domain.d.ts @@ -29,6 +29,7 @@ declare function DomainList(version: V2010, accountSid: string): DomainListInsta * Options to pass to update * * @property domainName - The unique address on Twilio to route SIP traffic + * @property emergencyCallingEnabled - Whether emergency calling is enabled for the domain. * @property friendlyName - A string to describe the resource * @property sipRegistration - Whether SIP registration is allowed * @property voiceFallbackMethod - The HTTP method used with voice_fallback_url @@ -40,6 +41,7 @@ declare function DomainList(version: V2010, accountSid: string): DomainListInsta */ interface DomainInstanceUpdateOptions { domainName?: string; + emergencyCallingEnabled?: boolean; friendlyName?: string; sipRegistration?: boolean; voiceFallbackMethod?: string; @@ -174,6 +176,7 @@ interface DomainListInstance { * Options to pass to create * * @property domainName - The unique address on Twilio to route SIP traffic + * @property emergencyCallingEnabled - Whether emergency calling is enabled for the domain. * @property friendlyName - A string to describe the resource * @property sipRegistration - Whether SIP registration is allowed * @property voiceFallbackMethod - The HTTP method to use with voice_fallback_url @@ -185,6 +188,7 @@ interface DomainListInstance { */ interface DomainListInstanceCreateOptions { domainName: string; + emergencyCallingEnabled?: boolean; friendlyName?: string; sipRegistration?: boolean; voiceFallbackMethod?: string; @@ -262,6 +266,7 @@ interface DomainResource { date_created: Date; date_updated: Date; domain_name: string; + emergency_calling_enabled: boolean; friendly_name: string; sid: string; sip_registration: boolean; @@ -351,6 +356,7 @@ declare class DomainInstance extends SerializableClass { dateCreated: Date; dateUpdated: Date; domainName: string; + emergencyCallingEnabled: boolean; /** * fetch a DomainInstance * diff --git a/lib/rest/api/v2010/account/sip/domain.js b/lib/rest/api/v2010/account/sip/domain.js index ac700fc2fb..0e10305d46 100644 --- a/lib/rest/api/v2010/account/sip/domain.js +++ b/lib/rest/api/v2010/account/sip/domain.js @@ -325,6 +325,8 @@ DomainList = function DomainList(version, accountSid) { * @param {string} [opts.voiceStatusCallbackMethod] - * The HTTP method we should use to call `voice_status_callback_url` * @param {boolean} [opts.sipRegistration] - Whether SIP registration is allowed + * @param {boolean} [opts.emergencyCallingEnabled] - + * Whether emergency calling is enabled for the domain. * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed DomainInstance @@ -348,7 +350,8 @@ DomainList = function DomainList(version, accountSid) { 'VoiceFallbackMethod': _.get(opts, 'voiceFallbackMethod'), 'VoiceStatusCallbackUrl': _.get(opts, 'voiceStatusCallbackUrl'), 'VoiceStatusCallbackMethod': _.get(opts, 'voiceStatusCallbackMethod'), - 'SipRegistration': serialize.bool(_.get(opts, 'sipRegistration')) + 'SipRegistration': serialize.bool(_.get(opts, 'sipRegistration')), + 'EmergencyCallingEnabled': serialize.bool(_.get(opts, 'emergencyCallingEnabled')) }); var promise = this._version.create({uri: this._uri, method: 'POST', data: data}); @@ -508,6 +511,8 @@ DomainPage.prototype[util.inspect.custom] = function inspect(depth, options) { * @property {string} subresourceUris - * A list mapping resources associated with the SIP Domain resource * @property {boolean} sipRegistration - Whether SIP registration is allowed + * @property {boolean} emergencyCallingEnabled - + * Whether emergency calling is enabled for the domain. * * @param {V2010} version - Version of the resource * @param {DomainPayload} payload - The instance payload @@ -537,6 +542,7 @@ DomainInstance = function DomainInstance(version, payload, accountSid, sid) { this.voiceUrl = payload.voice_url; // jshint ignore:line this.subresourceUris = payload.subresource_uris; // jshint ignore:line this.sipRegistration = payload.sip_registration; // jshint ignore:line + this.emergencyCallingEnabled = payload.emergency_calling_enabled; // jshint ignore:line // Context this._context = undefined; @@ -593,6 +599,8 @@ DomainInstance.prototype.fetch = function fetch(callback) { * @param {boolean} [opts.sipRegistration] - Whether SIP registration is allowed * @param {string} [opts.domainName] - * The unique address on Twilio to route SIP traffic + * @param {boolean} [opts.emergencyCallingEnabled] - + * Whether emergency calling is enabled for the domain. * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed DomainInstance @@ -779,6 +787,8 @@ DomainContext.prototype.fetch = function fetch(callback) { * @param {boolean} [opts.sipRegistration] - Whether SIP registration is allowed * @param {string} [opts.domainName] - * The unique address on Twilio to route SIP traffic + * @param {boolean} [opts.emergencyCallingEnabled] - + * Whether emergency calling is enabled for the domain. * @param {function} [callback] - Callback to handle processed record * * @returns {Promise} Resolves to processed DomainInstance @@ -801,7 +811,8 @@ DomainContext.prototype.update = function update(opts, callback) { 'VoiceStatusCallbackUrl': _.get(opts, 'voiceStatusCallbackUrl'), 'VoiceUrl': _.get(opts, 'voiceUrl'), 'SipRegistration': serialize.bool(_.get(opts, 'sipRegistration')), - 'DomainName': _.get(opts, 'domainName') + 'DomainName': _.get(opts, 'domainName'), + 'EmergencyCallingEnabled': serialize.bool(_.get(opts, 'emergencyCallingEnabled')) }); var promise = this._version.update({uri: this._uri, method: 'POST', data: data}); diff --git a/lib/rest/authy/v1/service/entity/factor.d.ts b/lib/rest/authy/v1/service/entity/factor.d.ts index ac5f17eb49..e03a159c40 100644 --- a/lib/rest/authy/v1/service/entity/factor.d.ts +++ b/lib/rest/authy/v1/service/entity/factor.d.ts @@ -51,10 +51,14 @@ interface FactorInstanceRemoveOptions { * Options to pass to update * * @property authPayload - Optional payload to verify the Factor for the first time + * @property config - The config for this Factor as a json string + * @property friendlyName - The friendly name of this Factor * @property twilioAuthySandboxMode - The Twilio-Authy-Sandbox-Mode HTTP request header */ interface FactorInstanceUpdateOptions { authPayload?: string; + config?: string; + friendlyName?: string; twilioAuthySandboxMode?: string; } @@ -181,13 +185,17 @@ 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 * @property friendlyName - The friendly name of this Factor * @property twilioAuthySandboxMode - The Twilio-Authy-Sandbox-Mode HTTP request header */ interface FactorListInstanceCreateOptions { + authorization?: string; binding: string; + config: string; factorType: FactorFactorTypes; friendlyName: string; twilioAuthySandboxMode?: string; @@ -261,6 +269,7 @@ interface FactorPayload extends FactorResource, Page.TwilioResponsePayload { interface FactorResource { account_sid: string; + config: object; date_created: Date; date_updated: Date; entity_sid: string; @@ -364,6 +373,7 @@ declare class FactorInstance extends SerializableClass { * Access the challenges */ challenges(): ChallengeListInstance; + config: object; dateCreated: Date; dateUpdated: Date; entitySid: string; diff --git a/lib/rest/authy/v1/service/entity/factor.js b/lib/rest/authy/v1/service/entity/factor.js index 4c52708011..70ac989f51 100644 --- a/lib/rest/authy/v1/service/entity/factor.js +++ b/lib/rest/authy/v1/service/entity/factor.js @@ -68,8 +68,10 @@ FactorList = function FactorList(version, serviceSid, identity) { * @param {string} opts.binding - A unique binding for this Factor as a json string * @param {string} opts.friendlyName - The friendly name of this Factor * @param {factor.factor_types} opts.factorType - The Type of this Factor + * @param {string} opts.config - The config for this Factor as a json string * @param {string} [opts.twilioAuthySandboxMode] - * The Twilio-Authy-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 @@ -88,14 +90,21 @@ FactorList = function FactorList(version, serviceSid, identity) { if (_.isUndefined(opts.factorType)) { throw new Error('Required parameter "opts.factorType" missing.'); } + if (_.isUndefined(opts.config)) { + throw new Error('Required parameter "opts.config" missing.'); + } var deferred = Q.defer(); var data = values.of({ 'Binding': _.get(opts, 'binding'), 'FriendlyName': _.get(opts, 'friendlyName'), - 'FactorType': _.get(opts, 'factorType') + 'FactorType': _.get(opts, 'factorType'), + 'Config': _.get(opts, 'config') + }); + var headers = values.of({ + 'Twilio-Authy-Sandbox-Mode': _.get(opts, 'twilioAuthySandboxMode'), + 'Authorization': _.get(opts, 'authorization') }); - var headers = values.of({'Twilio-Authy-Sandbox-Mode': _.get(opts, 'twilioAuthySandboxMode')}); var promise = this._version.create({uri: this._uri, method: 'POST', data: data, headers: headers}); @@ -502,6 +511,7 @@ FactorPage.prototype[util.inspect.custom] = function inspect(depth, options) { * @property {string} friendlyName - A human readable description of this resource. * @property {factor.factor_statuses} status - The Status of this Factor * @property {factor.factor_types} factorType - The Type of this Factor + * @property {object} config - The config * @property {string} url - The URL of this resource. * @property {string} links - Nested resource URLs. * @@ -527,6 +537,7 @@ FactorInstance = function FactorInstance(version, payload, serviceSid, identity, this.friendlyName = payload.friendly_name; // jshint ignore:line this.status = payload.status; // jshint ignore:line this.factorType = payload.factor_type; // jshint ignore:line + this.config = payload.config; // jshint ignore:line this.url = payload.url; // jshint ignore:line this.links = payload.links; // jshint ignore:line @@ -599,6 +610,8 @@ FactorInstance.prototype.fetch = function fetch(opts, callback) { * @param {object} [opts] - Options for request * @param {string} [opts.authPayload] - * Optional payload to verify the Factor for the first time + * @param {string} [opts.friendlyName] - The friendly name of this Factor + * @param {string} [opts.config] - The config for this Factor as a json string * @param {string} [opts.twilioAuthySandboxMode] - * The Twilio-Authy-Sandbox-Mode HTTP request header * @param {function} [callback] - Callback to handle processed record @@ -780,6 +793,8 @@ FactorContext.prototype.fetch = function fetch(opts, callback) { * @param {object} [opts] - Options for request * @param {string} [opts.authPayload] - * Optional payload to verify the Factor for the first time + * @param {string} [opts.friendlyName] - The friendly name of this Factor + * @param {string} [opts.config] - The config for this Factor as a json string * @param {string} [opts.twilioAuthySandboxMode] - * The Twilio-Authy-Sandbox-Mode HTTP request header * @param {function} [callback] - Callback to handle processed record @@ -795,7 +810,11 @@ FactorContext.prototype.update = function update(opts, callback) { opts = opts || {}; var deferred = Q.defer(); - var data = values.of({'AuthPayload': _.get(opts, 'authPayload')}); + var data = values.of({ + 'AuthPayload': _.get(opts, 'authPayload'), + 'FriendlyName': _.get(opts, 'friendlyName'), + 'Config': _.get(opts, 'config') + }); var headers = values.of({'Twilio-Authy-Sandbox-Mode': _.get(opts, 'twilioAuthySandboxMode')}); var promise = this._version.update({uri: this._uri, method: 'POST', data: data, headers: headers}); diff --git a/lib/rest/preview/trusted_comms/business/insights.d.ts b/lib/rest/preview/trusted_comms/business/insights.d.ts index 346f66e51a..266c212f7e 100644 --- a/lib/rest/preview/trusted_comms/business/insights.d.ts +++ b/lib/rest/preview/trusted_comms/business/insights.d.ts @@ -21,7 +21,7 @@ import TrustedComms = require('../../TrustedComms'); declare function InsightsList(version: TrustedComms, businessSid: string): InsightsListInstance; interface InsightsListInstance { - successRate?: object; + impressionsRate?: object; /** * Provide a user-friendly representation */ diff --git a/lib/rest/preview/trusted_comms/business/insights.js b/lib/rest/preview/trusted_comms/business/insights.js index 3e014ef56f..86b5061412 100644 --- a/lib/rest/preview/trusted_comms/business/insights.js +++ b/lib/rest/preview/trusted_comms/business/insights.js @@ -11,7 +11,8 @@ var _ = require('lodash'); /* jshint ignore:line */ var util = require('util'); /* jshint ignore:line */ -var SuccessRateList = require('./insights/successRate').SuccessRateList; +var ImpressionsRateList = require( + './insights/impressionsRate').ImpressionsRateList; var InsightsList; @@ -49,16 +50,16 @@ InsightsList = function InsightsList(version, businessSid) { InsightsListInstance._solution = {businessSid: businessSid}; // Components - InsightsListInstance._successRate = undefined; + InsightsListInstance._impressionsRate = undefined; Object.defineProperty(InsightsListInstance, - 'successRate', { - get: function successRate() { - if (!this._successRate) { - this._successRate = new SuccessRateList(this._version, this._solution.businessSid); + 'impressionsRate', { + get: function impressionsRate() { + if (!this._impressionsRate) { + this._impressionsRate = new ImpressionsRateList(this._version, this._solution.businessSid); } - return this._successRate; + return this._impressionsRate; } }); diff --git a/lib/rest/preview/trusted_comms/business/insights/successRate.d.ts b/lib/rest/preview/trusted_comms/business/insights/impressionsRate.d.ts similarity index 57% rename from lib/rest/preview/trusted_comms/business/insights/successRate.d.ts rename to lib/rest/preview/trusted_comms/business/insights/impressionsRate.d.ts index 02c1bbe94c..e016c87fe3 100644 --- a/lib/rest/preview/trusted_comms/business/insights/successRate.d.ts +++ b/lib/rest/preview/trusted_comms/business/insights/impressionsRate.d.ts @@ -11,10 +11,10 @@ import TrustedComms = require('../../../TrustedComms'); import serialize = require('../../../../../base/serialize'); import { SerializableClass } from '../../../../../interfaces'; -type SuccessRateIntervals = 'minute'|'hour'|'day'|'week'|'month'; +type ImpressionsRateIntervals = 'minute'|'hour'|'day'|'week'|'month'; /** - * Initialize the SuccessRateList + * Initialize the ImpressionsRateList * * 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 @@ -23,7 +23,7 @@ type SuccessRateIntervals = 'minute'|'hour'|'day'|'week'|'month'; * @param version - Version of the resource * @param businessSid - A string that uniquely identifies this Business. */ -declare function SuccessRateList(version: TrustedComms, businessSid: string): SuccessRateListInstance; +declare function ImpressionsRateList(version: TrustedComms, businessSid: string): ImpressionsRateListInstance; /** * Options to pass to fetch @@ -31,57 +31,57 @@ declare function SuccessRateList(version: TrustedComms, businessSid: string): Su * @property brandSid - Brand Sid. * @property brandedChannelSid - Branded Channel Sid. * @property country - Country 2-letter ISO 3166 code. - * @property end - The end date that for this Success Rate. - * @property interval - The Interval of this Success Rate. + * @property end - The end date that for this Impressions Rate. + * @property interval - The Interval of this Impressions Rate. * @property phoneNumberSid - Phone Number Sid. - * @property start - The start date that for this Success Rate. + * @property start - The start date that for this Impressions Rate. */ -interface SuccessRateInstanceFetchOptions { +interface ImpressionsRateInstanceFetchOptions { brandSid?: string; brandedChannelSid?: string; country?: string; end?: Date; - interval?: SuccessRateIntervals; + interval?: ImpressionsRateIntervals; phoneNumberSid?: string; start?: Date; } -interface SuccessRateListInstance { +interface ImpressionsRateListInstance { /** * @param sid - sid of instance */ - (sid: string): SuccessRateContext; + (sid: string): ImpressionsRateContext; /** - * Constructs a success_rate + * Constructs a impressions_rate */ - get(): SuccessRateContext; + get(): ImpressionsRateContext; /** * Provide a user-friendly representation */ toJSON(): any; } -interface SuccessRatePayload extends SuccessRateResource, Page.TwilioResponsePayload { +interface ImpressionsRatePayload extends ImpressionsRateResource, Page.TwilioResponsePayload { } -interface SuccessRateResource { +interface ImpressionsRateResource { account_sid: string; business_sid: string; end: Date; - interval: SuccessRateIntervals; + interval: ImpressionsRateIntervals; reports: object; start: Date; url: string; } -interface SuccessRateSolution { +interface ImpressionsRateSolution { businessSid?: string; } -declare class SuccessRateContext { +declare class ImpressionsRateContext { /** - * Initialize the SuccessRateContext + * Initialize the ImpressionsRateContext * * 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 @@ -93,18 +93,18 @@ declare class SuccessRateContext { constructor(version: TrustedComms, businessSid: string); /** - * fetch a SuccessRateInstance + * fetch a ImpressionsRateInstance * * @param callback - Callback to handle processed record */ - fetch(callback?: (error: Error | null, items: SuccessRateInstance) => any): Promise; + fetch(callback?: (error: Error | null, items: ImpressionsRateInstance) => any): Promise; /** - * fetch a SuccessRateInstance + * fetch a ImpressionsRateInstance * * @param opts - Options for request * @param callback - Callback to handle processed record */ - fetch(opts?: SuccessRateInstanceFetchOptions, callback?: (error: Error | null, items: SuccessRateInstance) => any): Promise; + fetch(opts?: ImpressionsRateInstanceFetchOptions, callback?: (error: Error | null, items: ImpressionsRateInstance) => any): Promise; /** * Provide a user-friendly representation */ @@ -112,9 +112,9 @@ declare class SuccessRateContext { } -declare class SuccessRateInstance extends SerializableClass { +declare class ImpressionsRateInstance extends SerializableClass { /** - * Initialize the SuccessRateContext + * Initialize the ImpressionsRateContext * * 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 @@ -124,26 +124,26 @@ declare class SuccessRateInstance extends SerializableClass { * @param payload - The instance payload * @param businessSid - A string that uniquely identifies this Business. */ - constructor(version: TrustedComms, payload: SuccessRatePayload, businessSid: string); + constructor(version: TrustedComms, payload: ImpressionsRatePayload, businessSid: string); - private _proxy: SuccessRateContext; + private _proxy: ImpressionsRateContext; accountSid: string; businessSid: string; end: Date; /** - * fetch a SuccessRateInstance + * fetch a ImpressionsRateInstance * * @param callback - Callback to handle processed record */ - fetch(callback?: (error: Error | null, items: SuccessRateInstance) => any): Promise; + fetch(callback?: (error: Error | null, items: ImpressionsRateInstance) => any): Promise; /** - * fetch a SuccessRateInstance + * fetch a ImpressionsRateInstance * * @param opts - Options for request * @param callback - Callback to handle processed record */ - fetch(opts?: SuccessRateInstanceFetchOptions, callback?: (error: Error | null, items: SuccessRateInstance) => any): Promise; - interval: SuccessRateIntervals; + fetch(opts?: ImpressionsRateInstanceFetchOptions, callback?: (error: Error | null, items: ImpressionsRateInstance) => any): Promise; + interval: ImpressionsRateIntervals; reports: object; start: Date; /** @@ -154,9 +154,9 @@ declare class SuccessRateInstance extends SerializableClass { } -declare class SuccessRatePage extends Page { +declare class ImpressionsRatePage extends Page { /** - * Initialize the SuccessRatePage + * Initialize the ImpressionsRatePage * * 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 @@ -166,18 +166,18 @@ declare class SuccessRatePage extends Page, solution: SuccessRateSolution); + constructor(version: TrustedComms, response: Response, solution: ImpressionsRateSolution); /** - * Build an instance of SuccessRateInstance + * Build an instance of ImpressionsRateInstance * * @param payload - Payload response from the API */ - getInstance(payload: SuccessRatePayload): SuccessRateInstance; + getInstance(payload: ImpressionsRatePayload): ImpressionsRateInstance; /** * Provide a user-friendly representation */ toJSON(): any; } -export { SuccessRateContext, SuccessRateInstance, SuccessRateInstanceFetchOptions, SuccessRateIntervals, SuccessRateList, SuccessRateListInstance, SuccessRatePage, SuccessRatePayload, SuccessRateResource, SuccessRateSolution } +export { ImpressionsRateContext, ImpressionsRateInstance, ImpressionsRateInstanceFetchOptions, ImpressionsRateIntervals, ImpressionsRateList, ImpressionsRateListInstance, ImpressionsRatePage, ImpressionsRatePayload, ImpressionsRateResource, ImpressionsRateSolution } diff --git a/lib/rest/preview/trusted_comms/business/insights/successRate.js b/lib/rest/preview/trusted_comms/business/insights/impressionsRate.js similarity index 63% rename from lib/rest/preview/trusted_comms/business/insights/successRate.js rename to lib/rest/preview/trusted_comms/business/insights/impressionsRate.js index c6b0627412..e273359f90 100644 --- a/lib/rest/preview/trusted_comms/business/insights/successRate.js +++ b/lib/rest/preview/trusted_comms/business/insights/impressionsRate.js @@ -19,55 +19,55 @@ var serialize = require( '../../../../../base/serialize'); /* jshint ignore:line */ var values = require('../../../../../base/values'); /* jshint ignore:line */ -var SuccessRateList; -var SuccessRatePage; -var SuccessRateInstance; -var SuccessRateContext; +var ImpressionsRateList; +var ImpressionsRatePage; +var ImpressionsRateInstance; +var ImpressionsRateContext; /* jshint ignore:start */ /** - * Initialize the SuccessRateList + * Initialize the ImpressionsRateList * * 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.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateList + * @constructor Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateList * * @param {Twilio.Preview.TrustedComms} version - Version of the resource * @param {string} businessSid - A string that uniquely identifies this Business. */ /* jshint ignore:end */ -SuccessRateList = function SuccessRateList(version, businessSid) { +ImpressionsRateList = function ImpressionsRateList(version, businessSid) { /* jshint ignore:start */ /** - * @function successRate + * @function impressionsRate * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext# * * @param {string} sid - sid of instance * - * @returns {Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateContext} + * @returns {Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateContext} */ /* jshint ignore:end */ - function SuccessRateListInstance(sid) { - return SuccessRateListInstance.get(sid); + function ImpressionsRateListInstance(sid) { + return ImpressionsRateListInstance.get(sid); } - SuccessRateListInstance._version = version; + ImpressionsRateListInstance._version = version; // Path Solution - SuccessRateListInstance._solution = {businessSid: businessSid}; + ImpressionsRateListInstance._solution = {businessSid: businessSid}; /* jshint ignore:start */ /** - * Constructs a success_rate + * Constructs a impressions_rate * * @function get - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateList# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateList# * - * @returns {Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateContext} + * @returns {Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateContext} */ /* jshint ignore:end */ - SuccessRateListInstance.get = function get() { - return new SuccessRateContext(this._version, this._solution.businessSid); + ImpressionsRateListInstance.get = function get() { + return new ImpressionsRateContext(this._version, this._solution.businessSid); }; /* jshint ignore:start */ @@ -75,65 +75,66 @@ SuccessRateList = function SuccessRateList(version, businessSid) { * Provide a user-friendly representation * * @function toJSON - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateList# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateList# * * @returns Object */ /* jshint ignore:end */ - SuccessRateListInstance.toJSON = function toJSON() { + ImpressionsRateListInstance.toJSON = function toJSON() { return this._solution; }; - SuccessRateListInstance[util.inspect.custom] = function inspect(depth, options) - { + ImpressionsRateListInstance[util.inspect.custom] = function inspect(depth, + options) { return util.inspect(this.toJSON(), options); }; - return SuccessRateListInstance; + return ImpressionsRateListInstance; }; /* jshint ignore:start */ /** - * Initialize the SuccessRatePage + * Initialize the ImpressionsRatePage * * 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.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRatePage + * @constructor Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRatePage * * @param {TrustedComms} version - Version of the resource * @param {Response} response - Response from the API - * @param {SuccessRateSolution} solution - Path solution + * @param {ImpressionsRateSolution} solution - Path solution * - * @returns SuccessRatePage + * @returns ImpressionsRatePage */ /* jshint ignore:end */ -SuccessRatePage = function SuccessRatePage(version, response, solution) { +ImpressionsRatePage = function ImpressionsRatePage(version, response, solution) + { // Path Solution this._solution = solution; Page.prototype.constructor.call(this, version, response, this._solution); }; -_.extend(SuccessRatePage.prototype, Page.prototype); -SuccessRatePage.prototype.constructor = SuccessRatePage; +_.extend(ImpressionsRatePage.prototype, Page.prototype); +ImpressionsRatePage.prototype.constructor = ImpressionsRatePage; /* jshint ignore:start */ /** - * Build an instance of SuccessRateInstance + * Build an instance of ImpressionsRateInstance * * @function getInstance - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRatePage# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRatePage# * - * @param {SuccessRatePayload} payload - Payload response from the API + * @param {ImpressionsRatePayload} payload - Payload response from the API * - * @returns SuccessRateInstance + * @returns ImpressionsRateInstance */ /* jshint ignore:end */ -SuccessRatePage.prototype.getInstance = function getInstance(payload) { - return new SuccessRateInstance(this._version, payload, this._solution.businessSid); +ImpressionsRatePage.prototype.getInstance = function getInstance(payload) { + return new ImpressionsRateInstance(this._version, payload, this._solution.businessSid); }; /* jshint ignore:start */ @@ -141,12 +142,12 @@ SuccessRatePage.prototype.getInstance = function getInstance(payload) { * Provide a user-friendly representation * * @function toJSON - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRatePage# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRatePage# * * @returns Object */ /* jshint ignore:end */ -SuccessRatePage.prototype.toJSON = function toJSON() { +ImpressionsRatePage.prototype.toJSON = function toJSON() { let clone = {}; _.forOwn(this, function(value, key) { if (!_.startsWith(key, '_') && ! _.isFunction(value)) { @@ -156,7 +157,7 @@ SuccessRatePage.prototype.toJSON = function toJSON() { return clone; }; -SuccessRatePage.prototype[util.inspect.custom] = function inspect(depth, +ImpressionsRatePage.prototype[util.inspect.custom] = function inspect(depth, options) { return util.inspect(this.toJSON(), options); }; @@ -164,29 +165,30 @@ SuccessRatePage.prototype[util.inspect.custom] = function inspect(depth, /* jshint ignore:start */ /** - * Initialize the SuccessRateContext + * Initialize the ImpressionsRateContext * * 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.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateInstance + * @constructor Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateInstance * * @property {string} accountSid - Account Sid. * @property {string} businessSid - Business Sid. - * @property {Date} end - The end date that for this Success Rate. - * @property {success_rate.intervals} interval - The Interval of this Success Rate. - * @property {object} reports - Values of Success Rate per interval. - * @property {Date} start - The start date that for this Success Rate. + * @property {Date} end - The end date that for this Impressions Rate. + * @property {impressions_rate.intervals} interval - + * The Interval of this Impressions Rate. + * @property {object} reports - Values of Impressions Rate per interval. + * @property {Date} start - The start date that for this Impressions Rate. * @property {string} url - The URL of this resource. * * @param {TrustedComms} version - Version of the resource - * @param {SuccessRatePayload} payload - The instance payload + * @param {ImpressionsRatePayload} payload - The instance payload * @param {sid} businessSid - A string that uniquely identifies this Business. */ /* jshint ignore:end */ -SuccessRateInstance = function SuccessRateInstance(version, payload, - businessSid) { +ImpressionsRateInstance = function ImpressionsRateInstance(version, payload, + businessSid) { this._version = version; // Marshaled Properties @@ -203,11 +205,11 @@ SuccessRateInstance = function SuccessRateInstance(version, payload, this._solution = {businessSid: businessSid, }; }; -Object.defineProperty(SuccessRateInstance.prototype, +Object.defineProperty(ImpressionsRateInstance.prototype, '_proxy', { get: function() { if (!this._context) { - this._context = new SuccessRateContext(this._version, this._solution.businessSid); + this._context = new ImpressionsRateContext(this._version, this._solution.businessSid); } return this._context; @@ -216,26 +218,26 @@ Object.defineProperty(SuccessRateInstance.prototype, /* jshint ignore:start */ /** - * fetch a SuccessRateInstance + * fetch a ImpressionsRateInstance * * @function fetch - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateInstance# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateInstance# * * @param {object} [opts] - Options for request * @param {string} [opts.brandSid] - Brand Sid. * @param {string} [opts.brandedChannelSid] - Branded Channel Sid. * @param {string} [opts.phoneNumberSid] - Phone Number Sid. * @param {string} [opts.country] - Country 2-letter ISO 3166 code. - * @param {Date} [opts.start] - The start date that for this Success Rate. - * @param {Date} [opts.end] - The end date that for this Success Rate. - * @param {success_rate.intervals} [opts.interval] - - * The Interval of this Success Rate. + * @param {Date} [opts.start] - The start date that for this Impressions Rate. + * @param {Date} [opts.end] - The end date that for this Impressions Rate. + * @param {impressions_rate.intervals} [opts.interval] - + * The Interval of this Impressions Rate. * @param {function} [callback] - Callback to handle processed record * - * @returns {Promise} Resolves to processed SuccessRateInstance + * @returns {Promise} Resolves to processed ImpressionsRateInstance */ /* jshint ignore:end */ -SuccessRateInstance.prototype.fetch = function fetch(opts, callback) { +ImpressionsRateInstance.prototype.fetch = function fetch(opts, callback) { return this._proxy.fetch(opts, callback); }; @@ -244,12 +246,12 @@ SuccessRateInstance.prototype.fetch = function fetch(opts, callback) { * Provide a user-friendly representation * * @function toJSON - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateInstance# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateInstance# * * @returns Object */ /* jshint ignore:end */ -SuccessRateInstance.prototype.toJSON = function toJSON() { +ImpressionsRateInstance.prototype.toJSON = function toJSON() { let clone = {}; _.forOwn(this, function(value, key) { if (!_.startsWith(key, '_') && ! _.isFunction(value)) { @@ -259,7 +261,7 @@ SuccessRateInstance.prototype.toJSON = function toJSON() { return clone; }; -SuccessRateInstance.prototype[util.inspect.custom] = function inspect(depth, +ImpressionsRateInstance.prototype[util.inspect.custom] = function inspect(depth, options) { return util.inspect(this.toJSON(), options); }; @@ -267,48 +269,48 @@ SuccessRateInstance.prototype[util.inspect.custom] = function inspect(depth, /* jshint ignore:start */ /** - * Initialize the SuccessRateContext + * Initialize the ImpressionsRateContext * * 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.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateContext + * @constructor Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateContext * * @param {TrustedComms} version - Version of the resource * @param {sid} businessSid - Business Sid. */ /* jshint ignore:end */ -SuccessRateContext = function SuccessRateContext(version, businessSid) { +ImpressionsRateContext = function ImpressionsRateContext(version, businessSid) { this._version = version; // Path Solution this._solution = {businessSid: businessSid, }; - this._uri = `/Businesses/${businessSid}/Insights/SuccessRate`; + this._uri = `/Businesses/${businessSid}/Insights/ImpressionsRate`; }; /* jshint ignore:start */ /** - * fetch a SuccessRateInstance + * fetch a ImpressionsRateInstance * * @function fetch - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateContext# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateContext# * * @param {object} [opts] - Options for request * @param {string} [opts.brandSid] - Brand Sid. * @param {string} [opts.brandedChannelSid] - Branded Channel Sid. * @param {string} [opts.phoneNumberSid] - Phone Number Sid. * @param {string} [opts.country] - Country 2-letter ISO 3166 code. - * @param {Date} [opts.start] - The start date that for this Success Rate. - * @param {Date} [opts.end] - The end date that for this Success Rate. - * @param {success_rate.intervals} [opts.interval] - - * The Interval of this Success Rate. + * @param {Date} [opts.start] - The start date that for this Impressions Rate. + * @param {Date} [opts.end] - The end date that for this Impressions Rate. + * @param {impressions_rate.intervals} [opts.interval] - + * The Interval of this Impressions Rate. * @param {function} [callback] - Callback to handle processed record * - * @returns {Promise} Resolves to processed SuccessRateInstance + * @returns {Promise} Resolves to processed ImpressionsRateInstance */ /* jshint ignore:end */ -SuccessRateContext.prototype.fetch = function fetch(opts, callback) { +ImpressionsRateContext.prototype.fetch = function fetch(opts, callback) { if (_.isFunction(opts)) { callback = opts; opts = {}; @@ -329,7 +331,7 @@ SuccessRateContext.prototype.fetch = function fetch(opts, callback) { var promise = this._version.fetch({uri: this._uri, method: 'GET', params: data}); promise = promise.then(function(payload) { - deferred.resolve(new SuccessRateInstance(this._version, payload, this._solution.businessSid)); + deferred.resolve(new ImpressionsRateInstance(this._version, payload, this._solution.businessSid)); }.bind(this)); promise.catch(function(error) { @@ -348,23 +350,23 @@ SuccessRateContext.prototype.fetch = function fetch(opts, callback) { * Provide a user-friendly representation * * @function toJSON - * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.SuccessRateContext# + * @memberof Twilio.Preview.TrustedComms.BusinessContext.InsightsContext.ImpressionsRateContext# * * @returns Object */ /* jshint ignore:end */ -SuccessRateContext.prototype.toJSON = function toJSON() { +ImpressionsRateContext.prototype.toJSON = function toJSON() { return this._solution; }; -SuccessRateContext.prototype[util.inspect.custom] = function inspect(depth, +ImpressionsRateContext.prototype[util.inspect.custom] = function inspect(depth, options) { return util.inspect(this.toJSON(), options); }; module.exports = { - SuccessRateList: SuccessRateList, - SuccessRatePage: SuccessRatePage, - SuccessRateInstance: SuccessRateInstance, - SuccessRateContext: SuccessRateContext + ImpressionsRateList: ImpressionsRateList, + ImpressionsRatePage: ImpressionsRatePage, + ImpressionsRateInstance: ImpressionsRateInstance, + ImpressionsRateContext: ImpressionsRateContext }; diff --git a/lib/rest/trunking/v1/trunk.d.ts b/lib/rest/trunking/v1/trunk.d.ts index e5b76eecdf..cb39087f35 100644 --- a/lib/rest/trunking/v1/trunk.d.ts +++ b/lib/rest/trunking/v1/trunk.d.ts @@ -18,8 +18,6 @@ import { OriginationUrlListInstance } from './trunk/originationUrl'; import { PhoneNumberList } from './trunk/phoneNumber'; import { PhoneNumberListInstance } from './trunk/phoneNumber'; import { SerializableClass } from '../../../interfaces'; -import { TerminatingSipDomainList } from './trunk/terminatingSipDomain'; -import { TerminatingSipDomainListInstance } from './trunk/terminatingSipDomain'; type TrunkRecordingSetting = 'do-not-record'|'record-from-ringing'|'record-from-answer'; @@ -305,7 +303,6 @@ declare class TrunkContext { * @param callback - Callback to handle processed record */ remove(callback?: (error: Error | null, items: TrunkInstance) => any): Promise; - terminatingSipDomains: TerminatingSipDomainListInstance; /** * Provide a user-friendly representation */ @@ -379,10 +376,6 @@ declare class TrunkInstance extends SerializableClass { remove(callback?: (error: Error | null, items: TrunkInstance) => any): Promise; secure: boolean; sid: string; - /** - * Access the terminatingSipDomains - */ - terminatingSipDomains(): TerminatingSipDomainListInstance; /** * Provide a user-friendly representation */ diff --git a/lib/rest/trunking/v1/trunk.js b/lib/rest/trunking/v1/trunk.js index f45623587b..c4fb53bbbc 100644 --- a/lib/rest/trunking/v1/trunk.js +++ b/lib/rest/trunking/v1/trunk.js @@ -18,8 +18,6 @@ var IpAccessControlListList = require( var OriginationUrlList = require('./trunk/originationUrl').OriginationUrlList; var Page = require('../../../base/Page'); /* jshint ignore:line */ var PhoneNumberList = require('./trunk/phoneNumber').PhoneNumberList; -var TerminatingSipDomainList = require( - './trunk/terminatingSipDomain').TerminatingSipDomainList; var deserialize = require( '../../../base/deserialize'); /* jshint ignore:line */ var serialize = require('../../../base/serialize'); /* jshint ignore:line */ @@ -653,21 +651,6 @@ TrunkInstance.prototype.phoneNumbers = function phoneNumbers() { return this._proxy.phoneNumbers; }; -/* jshint ignore:start */ -/** - * Access the terminatingSipDomains - * - * @function terminatingSipDomains - * @memberof Twilio.Trunking.V1.TrunkInstance# - * - * @returns {Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList} - */ -/* jshint ignore:end */ -TrunkInstance.prototype.terminatingSipDomains = function terminatingSipDomains() - { - return this._proxy.terminatingSipDomains; -}; - /* jshint ignore:start */ /** * Provide a user-friendly representation @@ -708,8 +691,6 @@ TrunkInstance.prototype[util.inspect.custom] = function inspect(depth, options) * ipAccessControlLists resource * @property {Twilio.Trunking.V1.TrunkContext.PhoneNumberList} phoneNumbers - * phoneNumbers resource - * @property {Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList} terminatingSipDomains - - * terminatingSipDomains resource * * @param {V1} version - Version of the resource * @param {sid} sid - The unique string that identifies the resource @@ -727,7 +708,6 @@ TrunkContext = function TrunkContext(version, sid) { this._credentialsLists = undefined; this._ipAccessControlLists = undefined; this._phoneNumbers = undefined; - this._terminatingSipDomains = undefined; }; /* jshint ignore:start */ @@ -893,16 +873,6 @@ Object.defineProperty(TrunkContext.prototype, } }); -Object.defineProperty(TrunkContext.prototype, - 'terminatingSipDomains', { - get: function() { - if (!this._terminatingSipDomains) { - this._terminatingSipDomains = new TerminatingSipDomainList(this._version, this._solution.sid); - } - return this._terminatingSipDomains; - } -}); - /* jshint ignore:start */ /** * Provide a user-friendly representation diff --git a/lib/rest/trunking/v1/trunk/terminatingSipDomain.d.ts b/lib/rest/trunking/v1/trunk/terminatingSipDomain.d.ts deleted file mode 100644 index f1020604ea..0000000000 --- a/lib/rest/trunking/v1/trunk/terminatingSipDomain.d.ts +++ /dev/null @@ -1,338 +0,0 @@ -/** - * 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'; - -/** - * Initialize the TerminatingSipDomainList - * - * @param version - Version of the resource - * @param trunkSid - The SID of the Trunk to which we should route calls - */ -declare function TerminatingSipDomainList(version: V1, trunkSid: string): TerminatingSipDomainListInstance; - -interface TerminatingSipDomainListInstance { - /** - * @param sid - sid of instance - */ - (sid: string): TerminatingSipDomainContext; - /** - * create a TerminatingSipDomainInstance - * - * @param opts - Options for request - * @param callback - Callback to handle processed record - */ - create(opts: TerminatingSipDomainListInstanceCreateOptions, callback?: (error: Error | null, item: TerminatingSipDomainInstance) => any): Promise; - /** - * Streams TerminatingSipDomainInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param callback - Function to process each record - */ - each(callback?: (item: TerminatingSipDomainInstance, done: (err?: Error) => void) => void): void; - /** - * Streams TerminatingSipDomainInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param opts - Options for request - * @param callback - Function to process each record - */ - each(opts?: TerminatingSipDomainListInstanceEachOptions, callback?: (item: TerminatingSipDomainInstance, done: (err?: Error) => void) => void): void; - /** - * Constructs a terminating_sip_domain - * - * @param sid - The unique string that identifies the resource - */ - get(sid: string): TerminatingSipDomainContext; - /** - * Retrieve a single target page of TerminatingSipDomainInstance records from the - * API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param callback - Callback to handle list of records - */ - getPage(callback?: (error: Error | null, items: TerminatingSipDomainPage) => any): Promise; - /** - * Retrieve a single target page of TerminatingSipDomainInstance records from the - * API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param targetUrl - API-generated URL for the requested results page - * @param callback - Callback to handle list of records - */ - getPage(targetUrl?: string, callback?: (error: Error | null, items: TerminatingSipDomainPage) => any): Promise; - /** - * Lists TerminatingSipDomainInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param callback - Callback to handle list of records - */ - list(callback?: (error: Error | null, items: TerminatingSipDomainInstance[]) => any): Promise; - /** - * Lists TerminatingSipDomainInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param opts - Options for request - * @param callback - Callback to handle list of records - */ - list(opts?: TerminatingSipDomainListInstanceOptions, callback?: (error: Error | null, items: TerminatingSipDomainInstance[]) => any): Promise; - /** - * Retrieve a single page of TerminatingSipDomainInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param callback - Callback to handle list of records - */ - page(callback?: (error: Error | null, items: TerminatingSipDomainPage) => any): Promise; - /** - * Retrieve a single page of TerminatingSipDomainInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param opts - Options for request - * @param callback - Callback to handle list of records - */ - page(opts?: TerminatingSipDomainListInstancePageOptions, callback?: (error: Error | null, items: TerminatingSipDomainPage) => any): Promise; - /** - * Provide a user-friendly representation - */ - toJSON(): any; -} - -/** - * Options to pass to create - * - * @property sipDomainSid - The SID of the SIP Domain to associate with the trunk - */ -interface TerminatingSipDomainListInstanceCreateOptions { - sipDomainSid: string; -} - -/** - * Options to pass to each - * - * @property callback - - * Function to process each record. If this and a positional - * callback are passed, this one will be used - * @property done - Function to be called upon completion of streaming - * @property limit - - * Upper limit for the number of records to return. - * each() guarantees never to return more than limit. - * Default is no limit - * @property pageSize - - * Number of records to fetch per request, - * when not set will use the default value of 50 records. - * If no pageSize is defined but a limit is defined, - * each() will attempt to read the limit with the most efficient - * page size, i.e. min(limit, 1000) - */ -interface TerminatingSipDomainListInstanceEachOptions { - callback?: (item: TerminatingSipDomainInstance, done: (err?: Error) => void) => void; - done?: Function; - limit?: number; - pageSize?: number; -} - -/** - * Options to pass to list - * - * @property limit - - * Upper limit for the number of records to return. - * list() guarantees never to return more than limit. - * Default is no limit - * @property pageSize - - * Number of records to fetch per request, - * when not set will use the default value of 50 records. - * If no page_size is defined but a limit is defined, - * list() will attempt to read the limit with the most - * efficient page size, i.e. min(limit, 1000) - */ -interface TerminatingSipDomainListInstanceOptions { - limit?: number; - pageSize?: number; -} - -/** - * Options to pass to page - * - * @property pageNumber - Page Number, this value is simply for client state - * @property pageSize - Number of records to return, defaults to 50 - * @property pageToken - PageToken provided by the API - */ -interface TerminatingSipDomainListInstancePageOptions { - pageNumber?: number; - pageSize?: number; - pageToken?: string; -} - -interface TerminatingSipDomainPayload extends TerminatingSipDomainResource, Page.TwilioResponsePayload { -} - -interface TerminatingSipDomainResource { - account_sid: string; - api_version: string; - auth_type: string; - date_created: Date; - date_updated: Date; - domain_name: string; - friendly_name: string; - links: string; - sid: string; - sip_registration: boolean; - trunk_sid: string; - url: string; - voice_fallback_method: string; - voice_fallback_url: string; - voice_method: string; - voice_status_callback_method: string; - voice_status_callback_url: string; - voice_url: string; -} - -interface TerminatingSipDomainSolution { - trunkSid?: string; -} - - -declare class TerminatingSipDomainContext { - /** - * Initialize the TerminatingSipDomainContext - * - * @param version - Version of the resource - * @param trunkSid - The SID of the Trunk with the resource to fetch - * @param sid - The unique string that identifies the resource - */ - constructor(version: V1, trunkSid: string, sid: string); - - /** - * fetch a TerminatingSipDomainInstance - * - * @param callback - Callback to handle processed record - */ - fetch(callback?: (error: Error | null, items: TerminatingSipDomainInstance) => any): Promise; - /** - * remove a TerminatingSipDomainInstance - * - * @param callback - Callback to handle processed record - */ - remove(callback?: (error: Error | null, items: TerminatingSipDomainInstance) => any): Promise; - /** - * Provide a user-friendly representation - */ - toJSON(): any; -} - - -declare class TerminatingSipDomainInstance extends SerializableClass { - /** - * Initialize the TerminatingSipDomainContext - * - * @param version - Version of the resource - * @param payload - The instance payload - * @param trunkSid - The SID of the Trunk to which we should route calls - * @param sid - The unique string that identifies the resource - */ - constructor(version: V1, payload: TerminatingSipDomainPayload, trunkSid: string, sid: string); - - private _proxy: TerminatingSipDomainContext; - accountSid: string; - apiVersion: string; - authType: string; - dateCreated: Date; - dateUpdated: Date; - domainName: string; - /** - * fetch a TerminatingSipDomainInstance - * - * @param callback - Callback to handle processed record - */ - fetch(callback?: (error: Error | null, items: TerminatingSipDomainInstance) => any): Promise; - friendlyName: string; - links: string; - /** - * remove a TerminatingSipDomainInstance - * - * @param callback - Callback to handle processed record - */ - remove(callback?: (error: Error | null, items: TerminatingSipDomainInstance) => any): Promise; - sid: string; - sipRegistration: boolean; - /** - * Provide a user-friendly representation - */ - toJSON(): any; - trunkSid: string; - url: string; - voiceFallbackMethod: string; - voiceFallbackUrl: string; - voiceMethod: string; - voiceStatusCallbackMethod: string; - voiceStatusCallbackUrl: string; - voiceUrl: string; -} - - -declare class TerminatingSipDomainPage extends Page { - /** - * Initialize the TerminatingSipDomainPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor(version: V1, response: Response, solution: TerminatingSipDomainSolution); - - /** - * Build an instance of TerminatingSipDomainInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: TerminatingSipDomainPayload): TerminatingSipDomainInstance; - /** - * Provide a user-friendly representation - */ - toJSON(): any; -} - -export { TerminatingSipDomainContext, TerminatingSipDomainInstance, TerminatingSipDomainList, TerminatingSipDomainListInstance, TerminatingSipDomainListInstanceCreateOptions, TerminatingSipDomainListInstanceEachOptions, TerminatingSipDomainListInstanceOptions, TerminatingSipDomainListInstancePageOptions, TerminatingSipDomainPage, TerminatingSipDomainPayload, TerminatingSipDomainResource, TerminatingSipDomainSolution } diff --git a/lib/rest/trunking/v1/trunk/terminatingSipDomain.js b/lib/rest/trunking/v1/trunk/terminatingSipDomain.js deleted file mode 100644 index d442e88ffc..0000000000 --- a/lib/rest/trunking/v1/trunk/terminatingSipDomain.js +++ /dev/null @@ -1,708 +0,0 @@ -'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 deserialize = require( - '../../../../base/deserialize'); /* jshint ignore:line */ -var values = require('../../../../base/values'); /* jshint ignore:line */ - -var TerminatingSipDomainList; -var TerminatingSipDomainPage; -var TerminatingSipDomainInstance; -var TerminatingSipDomainContext; - -/* jshint ignore:start */ -/** - * Initialize the TerminatingSipDomainList - * - * @constructor Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList - * - * @param {Twilio.Trunking.V1} version - Version of the resource - * @param {string} trunkSid - The SID of the Trunk to which we should route calls - */ -/* jshint ignore:end */ -TerminatingSipDomainList = function TerminatingSipDomainList(version, trunkSid) - { - /* jshint ignore:start */ - /** - * @function terminatingSipDomains - * @memberof Twilio.Trunking.V1.TrunkContext# - * - * @param {string} sid - sid of instance - * - * @returns {Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainContext} - */ - /* jshint ignore:end */ - function TerminatingSipDomainListInstance(sid) { - return TerminatingSipDomainListInstance.get(sid); - } - - TerminatingSipDomainListInstance._version = version; - // Path Solution - TerminatingSipDomainListInstance._solution = {trunkSid: trunkSid}; - TerminatingSipDomainListInstance._uri = `/Trunks/${trunkSid}/TerminatingSipDomains`; - /* jshint ignore:start */ - /** - * create a TerminatingSipDomainInstance - * - * @function create - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @param {object} opts - Options for request - * @param {string} opts.sipDomainSid - - * The SID of the SIP Domain to associate with the trunk - * @param {function} [callback] - Callback to handle processed record - * - * @returns {Promise} Resolves to processed TerminatingSipDomainInstance - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.create = function create(opts, callback) { - if (_.isUndefined(opts)) { - throw new Error('Required parameter "opts" missing.'); - } - if (_.isUndefined(opts.sipDomainSid)) { - throw new Error('Required parameter "opts.sipDomainSid" missing.'); - } - - var deferred = Q.defer(); - var data = values.of({'SipDomainSid': _.get(opts, 'sipDomainSid')}); - - var promise = this._version.create({uri: this._uri, method: 'POST', data: data}); - - promise = promise.then(function(payload) { - deferred.resolve(new TerminatingSipDomainInstance( - this._version, - payload, - this._solution.trunkSid, - 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 */ - /** - * Streams TerminatingSipDomainInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @function each - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @param {object} [opts] - Options for request - * @param {number} [opts.limit] - - * Upper limit for the number of records to return. - * each() guarantees never to return more than limit. - * Default is no limit - * @param {number} [opts.pageSize] - - * Number of records to fetch per request, - * when not set will use the default value of 50 records. - * If no pageSize is defined but a limit is defined, - * each() will attempt to read the limit with the most efficient - * page size, i.e. min(limit, 1000) - * @param {Function} [opts.callback] - - * Function to process each record. If this and a positional - * callback are passed, this one will be used - * @param {Function} [opts.done] - - * Function to be called upon completion of streaming - * @param {Function} [callback] - Function to process each record - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.each = function each(opts, callback) { - if (_.isFunction(opts)) { - callback = opts; - opts = {}; - } - opts = opts || {}; - if (opts.callback) { - callback = opts.callback; - } - if (_.isUndefined(callback)) { - throw new Error('Callback function must be provided'); - } - - var done = false; - var currentPage = 1; - var currentResource = 0; - var limits = this._version.readLimits({ - limit: opts.limit, - pageSize: opts.pageSize - }); - - function onComplete(error) { - done = true; - if (_.isFunction(opts.done)) { - opts.done(error); - } - } - - function fetchNextPage(fn) { - var promise = fn(); - if (_.isUndefined(promise)) { - onComplete(); - return; - } - - promise.then(function(page) { - _.each(page.instances, function(instance) { - if (done || (!_.isUndefined(opts.limit) && currentResource >= opts.limit)) { - done = true; - return false; - } - - currentResource++; - callback(instance, onComplete); - }); - - if ((limits.pageLimit && limits.pageLimit <= currentPage)) { - onComplete(); - } else if (!done) { - currentPage++; - fetchNextPage(_.bind(page.nextPage, page)); - } - }); - - promise.catch(onComplete); - } - - fetchNextPage(_.bind(this.page, this, _.merge(opts, limits))); - }; - - /* jshint ignore:start */ - /** - * Lists TerminatingSipDomainInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @function list - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @param {object} [opts] - Options for request - * @param {number} [opts.limit] - - * Upper limit for the number of records to return. - * list() guarantees never to return more than limit. - * Default is no limit - * @param {number} [opts.pageSize] - - * Number of records to fetch per request, - * when not set will use the default value of 50 records. - * If no page_size is defined but a limit is defined, - * list() will attempt to read the limit with the most - * efficient page size, i.e. min(limit, 1000) - * @param {function} [callback] - Callback to handle list of records - * - * @returns {Promise} Resolves to a list of records - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.list = function list(opts, callback) { - if (_.isFunction(opts)) { - callback = opts; - opts = {}; - } - opts = opts || {}; - var deferred = Q.defer(); - var allResources = []; - opts.callback = function(resource, done) { - allResources.push(resource); - - if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) { - done(); - } - }; - - opts.done = function(error) { - if (_.isUndefined(error)) { - deferred.resolve(allResources); - } else { - deferred.reject(error); - } - }; - - if (_.isFunction(callback)) { - deferred.promise.nodeify(callback); - } - - this.each(opts); - return deferred.promise; - }; - - /* jshint ignore:start */ - /** - * Retrieve a single page of TerminatingSipDomainInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @function page - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @param {object} [opts] - Options for request - * @param {string} [opts.pageToken] - PageToken provided by the API - * @param {number} [opts.pageNumber] - - * Page Number, this value is simply for client state - * @param {number} [opts.pageSize] - Number of records to return, defaults to 50 - * @param {function} [callback] - Callback to handle list of records - * - * @returns {Promise} Resolves to a list of records - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.page = function page(opts, callback) { - if (_.isFunction(opts)) { - callback = opts; - opts = {}; - } - opts = opts || {}; - - var deferred = Q.defer(); - var data = values.of({ - 'PageToken': opts.pageToken, - 'Page': opts.pageNumber, - 'PageSize': opts.pageSize - }); - - var promise = this._version.page({uri: this._uri, method: 'GET', params: data}); - - promise = promise.then(function(payload) { - deferred.resolve(new TerminatingSipDomainPage(this._version, payload, this._solution)); - }.bind(this)); - - promise.catch(function(error) { - deferred.reject(error); - }); - - if (_.isFunction(callback)) { - deferred.promise.nodeify(callback); - } - - return deferred.promise; - }; - - /* jshint ignore:start */ - /** - * Retrieve a single target page of TerminatingSipDomainInstance records from the - * API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @function getPage - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @param {string} [targetUrl] - API-generated URL for the requested results page - * @param {function} [callback] - Callback to handle list of records - * - * @returns {Promise} Resolves to a list of records - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.getPage = function getPage(targetUrl, callback) - { - var deferred = Q.defer(); - - var promise = this._version._domain.twilio.request({method: 'GET', uri: targetUrl}); - - promise = promise.then(function(payload) { - deferred.resolve(new TerminatingSipDomainPage(this._version, payload, this._solution)); - }.bind(this)); - - promise.catch(function(error) { - deferred.reject(error); - }); - - if (_.isFunction(callback)) { - deferred.promise.nodeify(callback); - } - - return deferred.promise; - }; - - /* jshint ignore:start */ - /** - * Constructs a terminating_sip_domain - * - * @function get - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @param {string} sid - The unique string that identifies the resource - * - * @returns {Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainContext} - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.get = function get(sid) { - return new TerminatingSipDomainContext(this._version, this._solution.trunkSid, sid); - }; - - /* jshint ignore:start */ - /** - * Provide a user-friendly representation - * - * @function toJSON - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainList# - * - * @returns Object - */ - /* jshint ignore:end */ - TerminatingSipDomainListInstance.toJSON = function toJSON() { - return this._solution; - }; - - TerminatingSipDomainListInstance[util.inspect.custom] = function inspect(depth, - options) { - return util.inspect(this.toJSON(), options); - }; - - return TerminatingSipDomainListInstance; -}; - - -/* jshint ignore:start */ -/** - * Initialize the TerminatingSipDomainPage - * - * @constructor Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainPage - * - * @param {V1} version - Version of the resource - * @param {Response} response - Response from the API - * @param {TerminatingSipDomainSolution} solution - Path solution - * - * @returns TerminatingSipDomainPage - */ -/* jshint ignore:end */ -TerminatingSipDomainPage = function TerminatingSipDomainPage(version, response, - solution) { - // Path Solution - this._solution = solution; - - Page.prototype.constructor.call(this, version, response, this._solution); -}; - -_.extend(TerminatingSipDomainPage.prototype, Page.prototype); -TerminatingSipDomainPage.prototype.constructor = TerminatingSipDomainPage; - -/* jshint ignore:start */ -/** - * Build an instance of TerminatingSipDomainInstance - * - * @function getInstance - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainPage# - * - * @param {TerminatingSipDomainPayload} payload - Payload response from the API - * - * @returns TerminatingSipDomainInstance - */ -/* jshint ignore:end */ -TerminatingSipDomainPage.prototype.getInstance = function getInstance(payload) { - return new TerminatingSipDomainInstance(this._version, payload, this._solution.trunkSid); -}; - -/* jshint ignore:start */ -/** - * Provide a user-friendly representation - * - * @function toJSON - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainPage# - * - * @returns Object - */ -/* jshint ignore:end */ -TerminatingSipDomainPage.prototype.toJSON = function toJSON() { - let clone = {}; - _.forOwn(this, function(value, key) { - if (!_.startsWith(key, '_') && ! _.isFunction(value)) { - clone[key] = value; - } - }); - return clone; -}; - -TerminatingSipDomainPage.prototype[util.inspect.custom] = function - inspect(depth, options) { - return util.inspect(this.toJSON(), options); -}; - - -/* jshint ignore:start */ -/** - * Initialize the TerminatingSipDomainContext - * - * @constructor Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainInstance - * - * @property {string} accountSid - The SID of the Account that created the resource - * @property {string} apiVersion - The API version used to process the call - * @property {string} authType - The types of authentication mapped to the domain - * @property {Date} dateCreated - - * The RFC 2822 date and time in GMT when the resource was created - * @property {Date} dateUpdated - - * The RFC 2822 date and time in GMT when the resource was last updated - * @property {string} domainName - - * The unique address you reserve on Twilio to which you route your SIP traffic - * @property {string} friendlyName - - * The string that you assigned to describe the resource - * @property {string} sid - The unique string that identifies the resource - * @property {string} url - The absolute URL of the resource - * @property {string} voiceFallbackMethod - - * The HTTP method used with voice_fallback_url - * @property {string} voiceFallbackUrl - - * The URL that we call when an error occurs in executing TwiML - * @property {string} voiceMethod - The HTTP method used with voice_url - * @property {string} voiceStatusCallbackMethod - - * The HTTP method that we use to call the voice_status_callback_url - * @property {string} voiceStatusCallbackUrl - - * The URL that we call to pass status parameters to your application - * @property {string} voiceUrl - The URL we call when the domain receives a call - * @property {boolean} sipRegistration - - * Whether SIP Endpoints can register with the domain to receive calls - * @property {string} trunkSid - - * The SID of the Trunk to which we should route calls - * @property {string} links - The URLs of related resources - * - * @param {V1} version - Version of the resource - * @param {TerminatingSipDomainPayload} payload - The instance payload - * @param {sid} trunkSid - The SID of the Trunk to which we should route calls - * @param {sid} sid - The unique string that identifies the resource - */ -/* jshint ignore:end */ -TerminatingSipDomainInstance = function TerminatingSipDomainInstance(version, - payload, trunkSid, sid) { - this._version = version; - - // Marshaled Properties - this.accountSid = payload.account_sid; // jshint ignore:line - this.apiVersion = payload.api_version; // jshint ignore:line - this.authType = payload.auth_type; // jshint ignore:line - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line - this.domainName = payload.domain_name; // jshint ignore:line - this.friendlyName = payload.friendly_name; // jshint ignore:line - this.sid = payload.sid; // jshint ignore:line - this.url = payload.url; // jshint ignore:line - this.voiceFallbackMethod = payload.voice_fallback_method; // jshint ignore:line - this.voiceFallbackUrl = payload.voice_fallback_url; // jshint ignore:line - this.voiceMethod = payload.voice_method; // jshint ignore:line - this.voiceStatusCallbackMethod = payload.voice_status_callback_method; // jshint ignore:line - this.voiceStatusCallbackUrl = payload.voice_status_callback_url; // jshint ignore:line - this.voiceUrl = payload.voice_url; // jshint ignore:line - this.sipRegistration = payload.sip_registration; // jshint ignore:line - this.trunkSid = payload.trunk_sid; // jshint ignore:line - this.links = payload.links; // jshint ignore:line - - // Context - this._context = undefined; - this._solution = {trunkSid: trunkSid, sid: sid || this.sid, }; -}; - -Object.defineProperty(TerminatingSipDomainInstance.prototype, - '_proxy', { - get: function() { - if (!this._context) { - this._context = new TerminatingSipDomainContext( - this._version, - this._solution.trunkSid, - this._solution.sid - ); - } - - return this._context; - } -}); - -/* jshint ignore:start */ -/** - * fetch a TerminatingSipDomainInstance - * - * @function fetch - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainInstance# - * - * @param {function} [callback] - Callback to handle processed record - * - * @returns {Promise} Resolves to processed TerminatingSipDomainInstance - */ -/* jshint ignore:end */ -TerminatingSipDomainInstance.prototype.fetch = function fetch(callback) { - return this._proxy.fetch(callback); -}; - -/* jshint ignore:start */ -/** - * remove a TerminatingSipDomainInstance - * - * @function remove - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainInstance# - * - * @param {function} [callback] - Callback to handle processed record - * - * @returns {Promise} Resolves to processed TerminatingSipDomainInstance - */ -/* jshint ignore:end */ -TerminatingSipDomainInstance.prototype.remove = function remove(callback) { - return this._proxy.remove(callback); -}; - -/* jshint ignore:start */ -/** - * Provide a user-friendly representation - * - * @function toJSON - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainInstance# - * - * @returns Object - */ -/* jshint ignore:end */ -TerminatingSipDomainInstance.prototype.toJSON = function toJSON() { - let clone = {}; - _.forOwn(this, function(value, key) { - if (!_.startsWith(key, '_') && ! _.isFunction(value)) { - clone[key] = value; - } - }); - return clone; -}; - -TerminatingSipDomainInstance.prototype[util.inspect.custom] = function - inspect(depth, options) { - return util.inspect(this.toJSON(), options); -}; - - -/* jshint ignore:start */ -/** - * Initialize the TerminatingSipDomainContext - * - * @constructor Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainContext - * - * @param {V1} version - Version of the resource - * @param {sid} trunkSid - The SID of the Trunk with the resource to fetch - * @param {sid} sid - The unique string that identifies the resource - */ -/* jshint ignore:end */ -TerminatingSipDomainContext = function TerminatingSipDomainContext(version, - trunkSid, sid) { - this._version = version; - - // Path Solution - this._solution = {trunkSid: trunkSid, sid: sid, }; - this._uri = `/Trunks/${trunkSid}/TerminatingSipDomains/${sid}`; -}; - -/* jshint ignore:start */ -/** - * fetch a TerminatingSipDomainInstance - * - * @function fetch - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainContext# - * - * @param {function} [callback] - Callback to handle processed record - * - * @returns {Promise} Resolves to processed TerminatingSipDomainInstance - */ -/* jshint ignore:end */ -TerminatingSipDomainContext.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 TerminatingSipDomainInstance( - this._version, - payload, - this._solution.trunkSid, - 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 */ -/** - * remove a TerminatingSipDomainInstance - * - * @function remove - * @memberof Twilio.Trunking.V1.TrunkContext.TerminatingSipDomainContext# - * - * @param {function} [callback] - Callback to handle processed record - * - * @returns {Promise} Resolves to processed TerminatingSipDomainInstance - */ -/* jshint ignore:end */ -TerminatingSipDomainContext.prototype.remove = function remove(callback) { - var deferred = Q.defer(); - var promise = this._version.remove({uri: this._uri, method: 'DELETE'}); - - promise = promise.then(function(payload) { - deferred.resolve(payload); - }.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.Trunking.V1.TrunkContext.TerminatingSipDomainContext# - * - * @returns Object - */ -/* jshint ignore:end */ -TerminatingSipDomainContext.prototype.toJSON = function toJSON() { - return this._solution; -}; - -TerminatingSipDomainContext.prototype[util.inspect.custom] = function - inspect(depth, options) { - return util.inspect(this.toJSON(), options); -}; - -module.exports = { - TerminatingSipDomainList: TerminatingSipDomainList, - TerminatingSipDomainPage: TerminatingSipDomainPage, - TerminatingSipDomainInstance: TerminatingSipDomainInstance, - TerminatingSipDomainContext: TerminatingSipDomainContext -}; diff --git a/spec/integration/rest/api/v2010/account/sip/domain.spec.js b/spec/integration/rest/api/v2010/account/sip/domain.spec.js index 3766ff756c..7dcb8af455 100644 --- a/spec/integration/rest/api/v2010/account/sip/domain.spec.js +++ b/spec/integration/rest/api/v2010/account/sip/domain.spec.js @@ -54,7 +54,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'emergency_calling_enabled': true } ], 'start': 0, @@ -97,7 +97,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'emergency_calling_enabled': true } ], 'start': 0, @@ -145,7 +145,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'emergency_calling_enabled': true } ], 'start': 0, @@ -211,7 +211,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'emergency_calling_enabled': true } ], 'start': 0, @@ -313,7 +313,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': null + 'emergency_calling_enabled': true }; holodeck.mock(new Response(201, body)); @@ -377,7 +377,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'emergency_calling_enabled': true }; holodeck.mock(new Response(200, body)); @@ -440,7 +440,7 @@ describe('Domain', function() { 'voice_status_callback_method': 'POST', 'voice_status_callback_url': null, 'voice_url': 'https://dundermifflin.example.com/twilio/app.php', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'emergency_calling_enabled': true }; holodeck.mock(new Response(200, body)); diff --git a/spec/integration/rest/authy/v1/service/entity/factor.spec.js b/spec/integration/rest/authy/v1/service/entity/factor.spec.js index a7897bf596..2ebc45805c 100644 --- a/spec/integration/rest/authy/v1/service/entity/factor.spec.js +++ b/spec/integration/rest/authy/v1/service/entity/factor.spec.js @@ -37,7 +37,9 @@ describe('Factor', function() { binding: 'binding', friendlyName: 'friendly_name', factorType: 'app-push', - twilioAuthySandboxMode: 'twilio_authy_sandbox_mode' + config: 'config', + twilioAuthySandboxMode: 'twilio_authy_sandbox_mode', + authorization: 'authorization' }; var promise = client.authy.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .entities('identity') @@ -53,14 +55,22 @@ describe('Factor', function() { var identity = 'identity'; var url = `https://authy.twilio.com/v1/Services/${serviceSid}/Entities/${identity}/Factors`; - var values = {Binding: 'binding', FriendlyName: 'friendly_name', FactorType: 'app-push', }; + var values = { + Binding: 'binding', + FriendlyName: 'friendly_name', + FactorType: 'app-push', + Config: 'config', + }; holodeck.assertHasRequest(new Request({ method: 'POST', url: url, data: values })); - var headers = {'Twilio-Authy-Sandbox-Mode': 'twilio_authy_sandbox_mode'}; + var headers = { + 'Twilio-Authy-Sandbox-Mode': 'twilio_authy_sandbox_mode', + 'Authorization': 'authorization' + }; holodeck.assertHasRequest(new Request({ method: 'POST', url: url, @@ -80,7 +90,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'unverified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' @@ -89,7 +105,12 @@ describe('Factor', function() { holodeck.mock(new Response(201, body)); - var opts = {binding: 'binding', friendlyName: 'friendly_name', factorType: 'app-push'}; + var opts = { + binding: 'binding', + friendlyName: 'friendly_name', + factorType: 'app-push', + config: 'config' + }; var promise = client.authy.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .entities('identity') .factors.create(opts); @@ -186,7 +207,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'unverified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' @@ -220,7 +247,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'unverified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' @@ -257,7 +290,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'unverified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' @@ -299,7 +338,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'unverified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' @@ -391,7 +436,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'unverified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' @@ -462,7 +513,13 @@ describe('Factor', function() { 'date_updated': '2015-07-30T20:00:00Z', 'friendly_name': 'friendly_name', 'status': 'verified', - 'factor_type': 'sms', + 'factor_type': 'push', + 'config': { + 'sdk_version': '1.0', + 'app_id': 'com.authy.authy', + 'notification_platform': 'fcm', + 'notification_token': 'test_token' + }, 'url': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'challenges': 'https://authy.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Challenges' diff --git a/spec/integration/rest/preview/bulk_exports/export/day.spec.js b/spec/integration/rest/preview/bulk_exports/export/day.spec.js index 897c97f2b5..72c42ef759 100644 --- a/spec/integration/rest/preview/bulk_exports/export/day.spec.js +++ b/spec/integration/rest/preview/bulk_exports/export/day.spec.js @@ -55,7 +55,7 @@ describe('Day', function() { it('should generate valid fetch response', function(done) { var body = { - 'redirect_to': 'https://com.twilio.dev-us1.exports.s3.amazonaws.com/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + 'redirect_to': 'https://api.bulkexports.twilio.s3.amazonaws.com/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' }; holodeck.mock(new Response(200, body)); diff --git a/spec/integration/rest/preview/trusted_comms/business/insights/successRate.spec.js b/spec/integration/rest/preview/trusted_comms/business/insights/impressionsRate.spec.js similarity index 86% rename from spec/integration/rest/preview/trusted_comms/business/insights/successRate.spec.js rename to spec/integration/rest/preview/trusted_comms/business/insights/impressionsRate.spec.js index 67bce277b6..c641abc87d 100644 --- a/spec/integration/rest/preview/trusted_comms/business/insights/successRate.spec.js +++ b/spec/integration/rest/preview/trusted_comms/business/insights/impressionsRate.spec.js @@ -22,7 +22,7 @@ var Twilio = require('../../../../../../../lib'); /* jshint ignore:line */ var client; var holodeck; -describe('SuccessRate', function() { +describe('ImpressionsRate', function() { beforeEach(function() { holodeck = new Holodeck(); client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', { @@ -35,7 +35,7 @@ describe('SuccessRate', function() { var promise = client.preview.trusted_comms.businesses('BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .insights - .successRate().fetch(); + .impressionsRate().fetch(); promise.then(function() { throw new Error('failed'); }, function(error) { @@ -44,7 +44,7 @@ describe('SuccessRate', function() { }).done(); var businessSid = 'BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var url = `https://preview.twilio.com/TrustedComms/Businesses/${businessSid}/Insights/SuccessRate`; + var url = `https://preview.twilio.com/TrustedComms/Businesses/${businessSid}/Insights/ImpressionsRate`; holodeck.assertHasRequest(new Request({ method: 'GET', @@ -61,21 +61,20 @@ describe('SuccessRate', function() { 'end': '2015-07-30T21:00:00Z', 'interval': 'minute', 'reports': { - 'success_rate': { + 'impressions_rate': { 'timestamp': '2015-07-30T20:00:00', 'calls': 1200, - 'branded': 800, - 'value': 66.67 + 'impressions': 800 } }, - 'url': 'https://preview.twilio.com/TrustedComms/Businesses/BXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Insights/SuccessRate' + 'url': 'https://preview.twilio.com/TrustedComms/Businesses/BXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Insights/ImpressionsRate' }; holodeck.mock(new Response(200, body)); var promise = client.preview.trusted_comms.businesses('BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') .insights - .successRate().fetch(); + .impressionsRate().fetch(); promise.then(function(response) { expect(response).toBeDefined(); done(); diff --git a/spec/integration/rest/trunking/v1/trunk.spec.js b/spec/integration/rest/trunking/v1/trunk.spec.js index 12cb34250d..9602a40fa9 100644 --- a/spec/integration/rest/trunking/v1/trunk.spec.js +++ b/spec/integration/rest/trunking/v1/trunk.spec.js @@ -67,7 +67,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -75,8 +74,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } }; @@ -164,7 +162,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -172,8 +169,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } }; @@ -216,7 +212,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -224,8 +219,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } } ] @@ -262,7 +256,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -270,8 +263,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } } ] @@ -313,7 +305,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -321,8 +312,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } } ] @@ -379,7 +369,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -387,8 +376,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } } ] @@ -469,7 +457,6 @@ describe('Trunk', function() { }, 'auth_type': '', 'auth_type_set': [], - 'origination_from_domain_sid': null, 'date_created': '2015-01-02T11:23:45Z', 'date_updated': '2015-01-02T11:23:45Z', 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', @@ -477,90 +464,7 @@ describe('Trunk', function() { 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' - } - }; - - holodeck.mock(new Response(200, body)); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(); - promise.then(function(response) { - expect(response).toBeDefined(); - done(); - }, function() { - throw new Error('failed'); - }).done(); - } - ); - it('should generate valid update_set_from_domain response', - function(done) { - var body = { - 'sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'domain_name': 'test.pstn.twilio.com', - 'disaster_recovery_method': 'GET', - 'disaster_recovery_url': 'http://updated-recovery.com', - 'friendly_name': 'updated_name', - 'secure': true, - 'cnam_lookup_enabled': true, - 'recording': { - 'mode': 'do-not-record', - 'trim': 'do-not-trim' - }, - 'auth_type': '', - 'auth_type_set': [], - 'origination_from_domain_sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'date_created': '2015-01-02T11:23:45Z', - 'date_updated': '2015-01-02T11:23:45Z', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', - 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', - 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' - } - }; - - holodeck.mock(new Response(200, body)); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(); - promise.then(function(response) { - expect(response).toBeDefined(); - done(); - }, function() { - throw new Error('failed'); - }).done(); - } - ); - it('should generate valid update_clear_from_domain response', - function(done) { - var body = { - 'sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'domain_name': 'test.pstn.twilio.com', - 'disaster_recovery_method': 'GET', - 'disaster_recovery_url': 'http://updated-recovery.com', - 'friendly_name': 'updated_name', - 'secure': true, - 'cnam_lookup_enabled': true, - 'recording': { - 'mode': 'do-not-record', - 'trim': 'do-not-trim' - }, - 'auth_type': '', - 'auth_type_set': [], - 'origination_from_domain_sid': null, - 'date_created': '2015-01-02T11:23:45Z', - 'date_updated': '2015-01-02T11:23:45Z', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'origination_urls': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OriginationUrls', - 'credential_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/CredentialLists', - 'ip_access_control_lists': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IpAccessControlLists', - 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers', - 'terminating_sip_domains': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains' + 'phone_numbers': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers' } }; diff --git a/spec/integration/rest/trunking/v1/trunk/terminatingSipDomain.spec.js b/spec/integration/rest/trunking/v1/trunk/terminatingSipDomain.spec.js deleted file mode 100644 index ad808c8a41..0000000000 --- a/spec/integration/rest/trunking/v1/trunk/terminatingSipDomain.spec.js +++ /dev/null @@ -1,424 +0,0 @@ -'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('TerminatingSipDomain', 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.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch(); - promise.then(function() { - throw new Error('failed'); - }, function(error) { - expect(error.constructor).toBe(RestException.prototype.constructor); - done(); - }).done(); - - var trunkSid = 'TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var sid = 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var url = `https://trunking.twilio.com/v1/Trunks/${trunkSid}/TerminatingSipDomains/${sid}`; - - holodeck.assertHasRequest(new Request({ - method: 'GET', - url: url - })); - } - ); - it('should generate valid fetch response', - function(done) { - var body = { - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'api_version': '2010-04-01', - 'auth_type': 'IP_ACL', - 'date_created': '2015-07-20T17:27:10Z', - 'date_updated': '2015-10-09T11:36:32Z', - 'domain_name': 'dunder-mifflin-scranton.sip.twilio.com', - 'friendly_name': 'Scranton Office', - 'sip_registration': true, - 'sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'voice_fallback_method': 'POST', - 'voice_fallback_url': null, - 'voice_method': 'POST', - 'voice_status_callback_method': 'POST', - 'voice_status_callback_url': null, - 'voice_url': 'https://demo.twilio.com/welcome/voice/', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'sip_domain': 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - } - }; - - holodeck.mock(new Response(200, body)); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch(); - 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, {})); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(); - promise.then(function() { - throw new Error('failed'); - }, function(error) { - expect(error.constructor).toBe(RestException.prototype.constructor); - done(); - }).done(); - - var trunkSid = 'TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var sid = 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var url = `https://trunking.twilio.com/v1/Trunks/${trunkSid}/TerminatingSipDomains/${sid}`; - - holodeck.assertHasRequest(new Request({ - method: 'DELETE', - url: url - })); - } - ); - it('should generate valid delete response', - function(done) { - var body = null; - - holodeck.mock(new Response(204, body)); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains('SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(); - promise.then(function(response) { - expect(response).toBe(true); - done(); - }, function() { - throw new Error('failed'); - }).done(); - } - ); - it('should generate valid create request', - function(done) { - holodeck.mock(new Response(500, {})); - - var opts = {sipDomainSid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}; - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.create(opts); - promise.then(function() { - throw new Error('failed'); - }, function(error) { - expect(error.constructor).toBe(RestException.prototype.constructor); - done(); - }).done(); - - var trunkSid = 'TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var url = `https://trunking.twilio.com/v1/Trunks/${trunkSid}/TerminatingSipDomains`; - - var values = {SipDomainSid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', }; - holodeck.assertHasRequest(new Request({ - method: 'POST', - url: url, - data: values - })); - } - ); - it('should generate valid create response', - function(done) { - var body = { - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'api_version': '2010-04-01', - 'auth_type': 'IP_ACL', - 'date_created': '2015-07-20T17:27:10Z', - 'date_updated': '2015-10-09T11:36:32Z', - 'domain_name': 'dunder-mifflin-scranton.sip.twilio.com', - 'friendly_name': 'Scranton Office', - 'sip_registration': true, - 'sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'voice_fallback_method': 'POST', - 'voice_fallback_url': null, - 'voice_method': 'POST', - 'voice_status_callback_method': 'POST', - 'voice_status_callback_url': null, - 'voice_url': 'https://demo.twilio.com/welcome/voice/', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'sip_domain': 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - } - }; - - holodeck.mock(new Response(201, body)); - - var opts = {sipDomainSid: 'SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}; - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.create(opts); - promise.then(function(response) { - expect(response).toBeDefined(); - done(); - }, function() { - throw new Error('failed'); - }).done(); - } - ); - it('should treat the first each arg as a callback', - function(done) { - var body = { - 'meta': { - 'first_page_url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0', - 'key': 'sip_domains', - 'next_page_url': null, - 'page': 0, - 'page_size': 50, - 'previous_page_url': null, - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0' - }, - 'sip_domains': [ - { - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'api_version': '2010-04-01', - 'auth_type': 'IP_ACL', - 'date_created': '2015-07-20T17:27:10Z', - 'date_updated': '2015-10-09T11:36:32Z', - 'domain_name': 'dunder-mifflin-scranton.sip.twilio.com', - 'friendly_name': 'Scranton Office', - 'sip_registration': true, - 'sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'voice_fallback_method': 'POST', - 'voice_fallback_url': null, - 'voice_method': 'POST', - 'voice_status_callback_method': 'POST', - 'voice_status_callback_url': null, - 'voice_url': 'https://demo.twilio.com/welcome/voice/', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'sip_domain': 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - } - } - ] - }; - holodeck.mock(new Response(200, body)); - client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.each(() => done()); - } - ); - it('should treat the second arg as a callback', - function(done) { - var body = { - 'meta': { - 'first_page_url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0', - 'key': 'sip_domains', - 'next_page_url': null, - 'page': 0, - 'page_size': 50, - 'previous_page_url': null, - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0' - }, - 'sip_domains': [ - { - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'api_version': '2010-04-01', - 'auth_type': 'IP_ACL', - 'date_created': '2015-07-20T17:27:10Z', - 'date_updated': '2015-10-09T11:36:32Z', - 'domain_name': 'dunder-mifflin-scranton.sip.twilio.com', - 'friendly_name': 'Scranton Office', - 'sip_registration': true, - 'sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'voice_fallback_method': 'POST', - 'voice_fallback_url': null, - 'voice_method': 'POST', - 'voice_status_callback_method': 'POST', - 'voice_status_callback_url': null, - 'voice_url': 'https://demo.twilio.com/welcome/voice/', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'sip_domain': 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - } - } - ] - }; - holodeck.mock(new Response(200, body)); - client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.each({pageSize: 20}, () => done()); - holodeck.assertHasRequest(new Request({ - method: 'GET', - url: 'https://trunking.twilio.com/v1/Trunks/${trunkSid}/TerminatingSipDomains', - params: {PageSize: 20}, - })); - } - ); - it('should find the callback in the opts object', - function(done) { - var body = { - 'meta': { - 'first_page_url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0', - 'key': 'sip_domains', - 'next_page_url': null, - 'page': 0, - 'page_size': 50, - 'previous_page_url': null, - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0' - }, - 'sip_domains': [ - { - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'api_version': '2010-04-01', - 'auth_type': 'IP_ACL', - 'date_created': '2015-07-20T17:27:10Z', - 'date_updated': '2015-10-09T11:36:32Z', - 'domain_name': 'dunder-mifflin-scranton.sip.twilio.com', - 'friendly_name': 'Scranton Office', - 'sip_registration': true, - 'sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'voice_fallback_method': 'POST', - 'voice_fallback_url': null, - 'voice_method': 'POST', - 'voice_status_callback_method': 'POST', - 'voice_status_callback_url': null, - 'voice_url': 'https://demo.twilio.com/welcome/voice/', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'sip_domain': 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - } - } - ] - }; - holodeck.mock(new Response(200, body)); - client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.each({callback: () => done()}, () => fail('wrong callback!')); - } - ); - it('should generate valid list request', - function(done) { - holodeck.mock(new Response(500, {})); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.list(); - promise.then(function() { - throw new Error('failed'); - }, function(error) { - expect(error.constructor).toBe(RestException.prototype.constructor); - done(); - }).done(); - - var trunkSid = 'TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; - var url = `https://trunking.twilio.com/v1/Trunks/${trunkSid}/TerminatingSipDomains`; - - holodeck.assertHasRequest(new Request({ - method: 'GET', - url: url - })); - } - ); - it('should generate valid read_full response', - function(done) { - var body = { - 'meta': { - 'first_page_url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0', - 'key': 'sip_domains', - 'next_page_url': null, - 'page': 0, - 'page_size': 50, - 'previous_page_url': null, - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0' - }, - 'sip_domains': [ - { - 'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'api_version': '2010-04-01', - 'auth_type': 'IP_ACL', - 'date_created': '2015-07-20T17:27:10Z', - 'date_updated': '2015-10-09T11:36:32Z', - 'domain_name': 'dunder-mifflin-scranton.sip.twilio.com', - 'friendly_name': 'Scranton Office', - 'sip_registration': true, - 'sid': 'SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'voice_fallback_method': 'POST', - 'voice_fallback_url': null, - 'voice_method': 'POST', - 'voice_status_callback_method': 'POST', - 'voice_status_callback_url': null, - 'voice_url': 'https://demo.twilio.com/welcome/voice/', - 'trunk_sid': 'TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', - 'links': { - 'sip_domain': 'https://api.twilio.com/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SIP/Domains/SDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - } - } - ] - }; - - holodeck.mock(new Response(200, body)); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.list(); - promise.then(function(response) { - expect(response).toBeDefined(); - done(); - }, function() { - throw new Error('failed'); - }).done(); - } - ); - it('should generate valid read_empty response', - function(done) { - var body = { - 'meta': { - 'first_page_url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0', - 'key': 'sip_domains', - 'next_page_url': null, - 'page': 0, - 'page_size': 50, - 'previous_page_url': null, - 'url': 'https://trunking.twilio.com/v1/Trunks/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TerminatingSipDomains?PageSize=50&Page=0' - }, - 'sip_domains': [] - }; - - holodeck.mock(new Response(200, body)); - - var promise = client.trunking.v1.trunks('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') - .terminatingSipDomains.list(); - promise.then(function(response) { - expect(response).toBeDefined(); - done(); - }, function() { - throw new Error('failed'); - }).done(); - } - ); -});