@twilio/flex-plugins-library-utils
Advanced tools
Comparing version
@@ -39,3 +39,3 @@ import { Twilio } from 'twilio'; | ||
* @param {string} parameters.callSid the unique call SID to fetch | ||
* @param {string} parameters.to the phone number to transfer to | ||
* @param {string} parameters.twiml the response of twiml based on to and from arguments of event | ||
* @returns {object} generic response object | ||
@@ -46,3 +46,3 @@ * @description cold transfers the given call SID to the given phone number | ||
callSid: string; | ||
to: string; | ||
twiml: string; | ||
}): Promise<ApiReturnType>; | ||
@@ -49,0 +49,0 @@ /** |
@@ -72,3 +72,3 @@ "use strict"; | ||
* @param {string} parameters.callSid the unique call SID to fetch | ||
* @param {string} parameters.to the phone number to transfer to | ||
* @param {string} parameters.twiml the response of twiml based on to and from arguments of event | ||
* @returns {object} generic response object | ||
@@ -79,7 +79,7 @@ * @description cold transfers the given call SID to the given phone number | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { callSid, to } = parameters; | ||
const { callSid, twiml, attempts } = parameters; | ||
const parameterChecks = { | ||
attempts: 'number', | ||
callSid: 'string', | ||
to: 'string', | ||
twiml: 'string', | ||
}; | ||
@@ -92,3 +92,3 @@ try { | ||
yield this.client.calls(callSid).update({ | ||
twiml: `<Response><Dial>${to}</Dial></Response>`, | ||
twiml | ||
}); | ||
@@ -95,0 +95,0 @@ return { success: true, status: statusCodes_1.HttpErrorCode.OK }; |
{ | ||
"name": "@twilio/flex-plugins-library-utils", | ||
"version": "1.1.2", | ||
"version": "1.1.3-beta.0", | ||
"description": "Flex Plugins Library Utils", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,3 +17,2 @@ import { isArray, isBoolean, isNumber, isObject, isString } from 'lodash'; | ||
const actualValue = parameters[key]; | ||
switch (expectedType) { | ||
@@ -20,0 +19,0 @@ case 'string': |
@@ -87,17 +87,15 @@ import { Twilio } from 'twilio'; | ||
* @param {string} parameters.callSid the unique call SID to fetch | ||
* @param {string} parameters.to the phone number to transfer to | ||
* @param {string} parameters.twiml the response of twiml based on to and from arguments of event | ||
* @returns {object} generic response object | ||
* @description cold transfers the given call SID to the given phone number | ||
*/ | ||
public async coldTransfer(parameters: Parameters & { callSid: string; to: string }): Promise<ApiReturnType> { | ||
const { callSid, to } = parameters; | ||
public async coldTransfer(parameters: Parameters & { callSid: string; twiml: string; }): Promise<ApiReturnType> { | ||
const { callSid, twiml, attempts } = parameters; | ||
const parameterChecks = { | ||
attempts: 'number', | ||
callSid: 'string', | ||
to: 'string', | ||
twiml: 'string', | ||
}; | ||
try { | ||
const inputError = PluginUtilsErrorManager.checkInvalidParameters<Parameters & { callSid: string; to: string }>( | ||
const inputError = PluginUtilsErrorManager.checkInvalidParameters<Parameters & { callSid: string; twiml: string; }>( | ||
parameters, | ||
@@ -110,5 +108,6 @@ parameterChecks, | ||
} | ||
await this.client.calls(callSid).update({ | ||
twiml: `<Response><Dial>${to}</Dial></Response>`, | ||
}); | ||
twiml | ||
}); | ||
@@ -124,3 +123,3 @@ return { success: true, status: HttpErrorCode.OK }; | ||
} | ||
return retryHandler<Parameters & { callSid: string; to: string }>( | ||
return retryHandler<Parameters & { callSid: string; twiml: string;}>( | ||
this.config, | ||
@@ -127,0 +126,0 @@ error, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
301853
0.02%2
100%