From 3a84a6bcbedd3dcf7671077ad9ac51e89993bd5b Mon Sep 17 00:00:00 2001 From: digvijay-plivo Date: Mon, 9 Sep 2019 14:29:18 +0530 Subject: [PATCH] Add logic to handle all params in one object --- lib/resources/messages.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/resources/messages.js b/lib/resources/messages.js index 1b9665e..51e4f82 100644 --- a/lib/resources/messages.js +++ b/lib/resources/messages.js @@ -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'] },