Skip to content

Commit

Permalink
SDK changes for Import Campaign API
Browse files Browse the repository at this point in the history
  • Loading branch information
Thumpala Vinay Kumar authored and Thumpala Vinay Kumar committed Feb 27, 2024
1 parent 5790175 commit 00d78d2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/resources/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ export class LinkUnlinkNumberResponse {
});
}

/**
* import Campaign
* @method
* @param {string} campaign_id
* @param {string} campaign_alias
* @promise {object} return {@link PlivoGenericResponse} object
* @fail {Error} return Error
*/
importcamp(campaign_id, campaign_alias, params = {}) {
params.campaign_id=campaign_id;
params.campaign_alias=campaign_alias;
return super.customexecuteAction(action + 'Import/', 'POST', params);
}

/**
* update Campaign
* @method
Expand Down
10 changes: 10 additions & 0 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,16 @@ export function Request(config) {
}
});
}
else if (action == '10dlc/Campaign/Import/' && method == 'POST'){
resolve({
response: {},
body: {
apiId: "2c6c5e16-090a-11ed-bb48-0242ac110004",
campaignId: "CNTQ0OD",
message: "Request to import campaign was received and is being processed."
}
});
}
else if (action == 'Powerpack/5ec4c8c9-cd74-42b5-9e41-0d7670d6bb46/' && method == 'GET'){
resolve({
response: {},
Expand Down
6 changes: 6 additions & 0 deletions test/campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ import {
assert.equal(campaign.campaignId, 'CFSOBZQ')
})
});
if('import campaign', function (){
return client.campaign.importcamp('CNTQ0OD','New Contact by vinay for ct')
.then(function(campaign){
assert.equal(campaign.campaignId, 'CNTQ0OD')
})
})

it('should delete campaign', function() {
return client.campaign.deleteCampaign("CMPT4EP")
Expand Down

0 comments on commit 00d78d2

Please sign in to comment.