From 35326c8b316331a1f66dd3e4a71c84520218bdfa Mon Sep 17 00:00:00 2001 From: Narayana Shanubhogh <40889842+narayana-plivo@users.noreply.github.com> Date: Thu, 14 Nov 2019 01:15:59 +0530 Subject: [PATCH] Update base.js --- lib/base.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/base.js b/lib/base.js index aa7701b..7d613f9 100644 --- a/lib/base.js +++ b/lib/base.js @@ -75,6 +75,34 @@ export class PlivoResource { }); }); } + customexecuteAction(url, method = 'GET', params = {}) { + let client = this[clientKey]; + let idField = this[idKey]; + return new Promise((resolve, reject) => { + client(method, url, params) + .then(response => { + resolve(new PlivoGenericResponse(response.body, idField)); + }) + .catch(error => { + reject(error); + }); + }); + } + getMetaResponse(url, method = 'GET', params = {}) { + let client = this[clientKey]; + let idField = this[idKey]; + let count = 0; + return new Promise((resolve, reject) => { + client(method, url, params) + .then(response => { + count = response.body.meta.totalCount; + resolve(count); + }) + .catch(error => { + reject(error); + }); + }); + } } export class PlivoResourceInterface {