Skip to content

Commit

Permalink
SDK changes for Import Campaign API (#338)
Browse files Browse the repository at this point in the history
* SDK changes for Import Campaign API

* changelog, minor fix and updated version

* patch version

* review comments changes

* making import_campaign method name standard

* updating change log date

---------

Co-authored-by: Thumpala Vinay Kumar <[email protected]>
Co-authored-by: Sajal Singhal <[email protected]>
Co-authored-by: Sajal Singhal <[email protected]>
  • Loading branch information
4 people authored Mar 13, 2024
1 parent c6dd455 commit c41af1d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 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

## [4.60.0](https://github.com/plivo/plivo-php/tree/v4.60.0) (2024-03-13)
**Feature - Import Campaign API**
- Added import campaign API

## [4.59.2](https://github.com/plivo/plivo-php/tree/v4.59.2) (2024-01-29)
**Feature - Log Redaction Enhancement**
- Added log attribute in GET and List MDR response
Expand Down
24 changes: 24 additions & 0 deletions src/Plivo/Resources/Campaign/CampaignInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,30 @@ public function create($brand_id,$campaign_alias,$vertical,$usecase,array $sub_u
return $response->getContent();
}

/**
* Import Campaign
*
* @param {string} campaignId
* @param {string} campaign_alias
* @param array $optionalArgs
* @return CampaignImport
*/
public function import_campaign($campaignId, $campaign_alias, $optionalArgs = [])
{
$mandatoryArgs = [
'campaign_id' => $campaignId,
'campaign_alias' => $campaign_alias
];

$response = $this->client->update(
$this->uri . '10dlc/Campaign/Import/',
$mandatoryArgs,
$optionalArgs
);

return $response->getContent();
}


/**
* Update Campaign
Expand Down
4 changes: 2 additions & 2 deletions src/Plivo/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class Version
/**
* @const int PHP helper library minor version number
*/
const MINOR = 59;
const MINOR = 60;

/**
* @const int PHP helper library patch number
*/
const PATCH = 2;
const PATCH = 0;
/**
* @return string
*/
Expand Down
5 changes: 5 additions & 0 deletions tests/Mocks/campaignImportResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"api_id": "2c6c5e16-090a-11ed-bb48-0242ac110004",
"campaign_id": "CNTQ0OD",
"message": "Request to import campaign was received and is being processed."
}
21 changes: 21 additions & 0 deletions tests/Resources/CampaignTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ public function testGetCampaign()

}

public function testCampaignImport()
{
$request = new PlivoRequest(
'POST',
'Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/Import/',
[
'campaign_id' => "CNTQ0OD",
'campaign_alias' => "New Contact by vinay for ct",

]);
$body = file_get_contents(__DIR__ . '/../Mocks/campaignImportResponse.json');

$this->mock(new PlivoResponse($request,200, $body));

$actual = $this->client->campaign->import_campaign("CNTQ0OD","New Contact by vinay for ct");

$this->assertRequest($request);

self::assertNotNull($actual);
}

public function testCampaignUpdate()
{
$campaignID = "CMPT4EP";
Expand Down

0 comments on commit c41af1d

Please sign in to comment.