Add logic to handle all params in one object

This commit is contained in:
digvijay-plivo 2019-09-09 14:29:18 +05:30
parent 53c6bd3002
commit 3a84a6bcbe

View file

@ -51,8 +51,8 @@ export class MessageInterface extends PlivoResourceInterface {
* @promise {object} return {@link PlivoGenericMessage} object if success
* @fail {Error} return Error
*/
send(src, dst, text, optionalParams) {
return this.create(src, dst, text, optionalParams);
send(optionalParams) {
return this.create(optionalParams);
}
/**
@ -69,7 +69,13 @@ export class MessageInterface extends PlivoResourceInterface {
* @promise {object} return {@link PlivoGenericMessage} object if success
* @fail {Error} return Error
*/
create(src, dst, text, optionalParams, powerpackUUID) {
create(optionalParams) {
var src = optionalParams.src;
var dst = optionalParams.dst;
var text = optionalParams.text;
var powerpackUUID = optionalParams.powerpackUUID;
let errors = validate([
{ field: 'dst', value: dst, validators: ['isRequired'] },
{ field: 'text', value: text, validators: ['isRequired'] },