mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-30 06:12:08 -06:00
Update base.js
This commit is contained in:
parent
1c18f011a8
commit
35326c8b31
1 changed files with 28 additions and 0 deletions
28
lib/base.js
28
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue