Skip to content

Commit

Permalink
Merge pull request #272 from plivo/SMS-4914-sdk-for-delete-campaign-b…
Browse files Browse the repository at this point in the history
…rand-api

Delete Campaign - Brand Request - Node SDK
  • Loading branch information
renoldthomas-plivo authored Dec 15, 2022
2 parents 4377404 + e74b7d9 commit 062cebc
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [v4.36.0](https://github.com/plivo/plivo-node/tree/v4.36.0) (2022-12-06)
**Delete Brand and Campaign Request**
- Delete Brand and Campaign Request endpoint added

## [v4.35.0](https://github.com/plivo/plivo-node/tree/v4.35.0) (2022-11-04)
**Brand Usecase Request**
- Brand Usecase Request endpoint added
Expand Down
11 changes: 11 additions & 0 deletions lib/resources/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,16 @@ export class BrandCreationResponse {
return super.customexecuteAction(action+brandId+'/usecases/', 'GET');
}

/**
* delete Brand by given id
* @method
* @param {string} brandID - id of brand
* @promise {object} return {@link PlivoGenericResponse} object
* @fail {Error} return Error
*/
deleteBrand(brandId) {
return super.customexecuteAction(action + brandId + '/', 'DELETE');
}


}
20 changes: 19 additions & 1 deletion lib/resources/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,22 @@ export class LinkUnlinkNumberResponse {
});
});
}
}

/**
* Delete Campaign
* @method
* @param {string} campaignID
* @promise {object} return {@link PlivoGenericResponse} object
* @fail {Error} return Error
*/
deleteCampaign(campaignID) {

return super.customexecuteAction(action + campaignID + '/', 'DELETE');
}






}
19 changes: 19 additions & 0 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,15 @@ export function Request(config) {
}
});
}
else if (action == '10dlc/Brand/BRPXS6E/' && method == 'DELETE') {
resolve({
response: {},
body: {
api_id: "4bac497c-b963-11ec-b7ca-0242ac110002",
brand_id: "BRPXS6E"
}
});
}
else if (action == '10dlc/Brand/BRPXS6E/usecases/' && method == 'GET'){
resolve({
response: {},
Expand Down Expand Up @@ -1473,6 +1482,16 @@ export function Request(config) {
}
});
}
else if (action == '10dlc/Campaign/CMPT4EP/' && method == 'DELETE') {
resolve({
response: {},
body: {
api_id: "12ae5a32-3751-11ec-8e4c-0242ac110002",
campaign_id: "CMPT4EP",
message: "Campaign Deactivated"
}
});
}
else if (action == '10dlc/Brand/' && method == 'GET'){
resolve({
response: {},
Expand Down
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.35.0",
"version": "4.36.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
19 changes: 13 additions & 6 deletions test/brand.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ import {
})
});

it('should get brand usecases', function () {
return client.brand.get_usecases('BRPXS6E')
.then(function (brand) {
assert.equal(brand.brandId, 'BRPXS6E')
})
});
it('should get brand usecases', function () {
return client.brand.get_usecases('BRPXS6E')
.then(function (brand) {
assert.equal(brand.brandId, 'BRPXS6E')
})
});

it('should delete brand', function() {
return client.brand.deleteBrand('BRPXS6E')
.then(function(brand) {
assert.equal(brand.brandId, 'BRPXS6E')
})
});


});
9 changes: 8 additions & 1 deletion test/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ import {
assert.equal(campaign.campaignId, 'CFSOBZQ')
})
});
});

it('should delete campaign', function() {
return client.campaign.deleteCampaign("CMPT4EP")
.then(function(response) {
assert.equal(response.campaignId, "CMPT4EP")
})
});
});

0 comments on commit 062cebc

Please sign in to comment.