Skip to content

Commit

Permalink
Merge pull request #206 from plivo/powerpack-fix
Browse files Browse the repository at this point in the history
Fix: add number to powerpack
  • Loading branch information
huzaif-plivo authored Aug 17, 2021
2 parents f3e6d9e + 9b22f77 commit a8df96e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [v4.22.0](https://github.com/plivo/plivo-node/tree/v4.22.0) (2021-08-17)
- Fix [add numbers to a powerpack](https://www.plivo.com/docs/sms/api/numberpool/#add-a-number) API by reverting retrievable object responses support for [Retrieve a Power pack API](https://www.plivo.com/docs/sms/api/powerpack#retrieve-a-powerpack).

## [v4.21.0](https://github.com/plivo/plivo-node/tree/v4.21.0) (2021-08-05)
- Fixed a Typescript warning about base interpretation.
- Add retrievable object responses support for [Retrieve a Power pack API](https://www.plivo.com/docs/sms/api/powerpack#retrieve-a-powerpack).
Expand Down
44 changes: 2 additions & 42 deletions lib/resources/powerpacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,6 @@ export class CreatePowerpackResponse {
}
}

export class RetrievePowerpack {
constructor(params) {
params = params || {};
this.apiId = params.apiId;
this.applicationId = params.applicationId;
this.applicationType = params.applicationType;
this.createdOn = params.createdOn;
this.localConnect = params.localConnect;
this.name = params.name;
this.numberPool = params.numberPool;
this.numberPriority = params.numberPriority;
this.stickySender = params.stickySender;
this.uuid = params.uuid;
}
}

export class UpdatePowerpackResponse {
constructor(params) {
params = params || {};
Expand Down Expand Up @@ -473,7 +457,6 @@ export class Powerpack extends PlivoResource {
* @param {string} [params.sticky_sender]
* @param {string} [params.local_connect]
* @param {object} [params.number_priority]
* @promise {object} return {@link Powerpack} object
* @fail {Error} return Error
*/
Expand Down Expand Up @@ -713,31 +696,8 @@ export class PowerpackInterface extends PlivoResourceInterface {
* @fail {Error} return Error
*/
get(uuid) {
let errors = validate([{
field: 'uuid',
value: uuid,
validators: ['isRequired']
}]);

if (errors) {
return errors;
}

let client = this[clientKey];
return new Promise((resolve, reject) => {
if (action !== '' && !uuid) {
reject(new Error(this[idKey] + ' must be set'));
}
client('GET', action + (uuid ? uuid + '/' : ''))
.then(response => {
resolve(new RetrievePowerpack(response.body, client));
})
.catch(error => {
reject(error);
});
});
return super.get(uuid);
}

/**
* create Powerpack
* @method
Expand Down Expand Up @@ -816,4 +776,4 @@ export class PowerpackInterface extends PlivoResourceInterface {
list(params) {
return super.list(params);
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plivo",
"version": "4.21.0",
"version": "4.22.0",
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
"homepage": "https://github.com/plivo/plivo-node",
"files": [
Expand Down

0 comments on commit a8df96e

Please sign in to comment.