From 0dcf63091efc13116e36bfe2416c2b3352a4451d Mon Sep 17 00:00:00 2001 From: NirmitiJain Date: Mon, 14 Nov 2022 11:18:15 +0530 Subject: [PATCH 1/2] Delete Campaogn - Brand --- lib/resources/brand.js | 11 +++++++++++ lib/resources/campaign.js | 20 +++++++++++++++++++- lib/rest/request-test.js | 19 +++++++++++++++++++ test/brand.js | 19 +++++++++++++------ test/campaign.js | 9 ++++++++- 5 files changed, 70 insertions(+), 8 deletions(-) diff --git a/lib/resources/brand.js b/lib/resources/brand.js index 1f5baf7c..f814af2a 100644 --- a/lib/resources/brand.js +++ b/lib/resources/brand.js @@ -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'); + } + } diff --git a/lib/resources/campaign.js b/lib/resources/campaign.js index 2caccefe..96935a6e 100644 --- a/lib/resources/campaign.js +++ b/lib/resources/campaign.js @@ -223,4 +223,22 @@ export class LinkUnlinkNumberResponse { }); }); } -} \ No newline at end of file + + /** + * Delete Campaign + * @method + * @param {string} campaignID + * @promise {object} return {@link PlivoGenericResponse} object + * @fail {Error} return Error + */ + deleteCampaign(campaignID) { + + return super.customexecuteAction(action + campaignID + '/', 'DELETE'); + } + + + + + + +} diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index 46f1781c..bd360f8d 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -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: {}, @@ -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: {}, diff --git a/test/brand.js b/test/brand.js index 816bb675..7664bf6a 100644 --- a/test/brand.js +++ b/test/brand.js @@ -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') + }) + }); }); diff --git a/test/campaign.js b/test/campaign.js index 29017745..9f8736f5 100644 --- a/test/campaign.js +++ b/test/campaign.js @@ -33,4 +33,11 @@ import { assert.equal(campaign.campaignId, 'CFSOBZQ') }) }); - }); \ No newline at end of file + + it('should delete campaign', function() { + return client.campaign.deleteCampaign("CMPT4EP") + .then(function(response) { + assert.equal(response.campaignId, "CMPT4EP") + }) + }); + }); From e74b7d9e4c605f4585c9587f40bebef042cb368c Mon Sep 17 00:00:00 2001 From: NirmitiJain Date: Tue, 6 Dec 2022 12:52:36 +0530 Subject: [PATCH 2/2] version update --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d57e926..027fe387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package.json b/package.json index 620a55c5..8be944fa 100644 --- a/package.json +++ b/package.json @@ -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": [