Skip to content

Commit

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

* changelog and updated version

* date change

* Removing url and method from func args

* Retaining url and method in func args

* review comments changes

* assigning None to url and method in import_campaign method

* updating change log date

---------

Co-authored-by: Thumpala Vinay Kumar <vinay.kumar@Thumpala-Vinay-Kumars-MacBook-Air.local>
Co-authored-by: Sajal Singhal <sajal.singhal@ip-192-168-1-6.ap-south-1.compute.internal>
Co-authored-by: Sajal Singhal <sajal.singhal@sajalsinghals-MacBook-Air.local>
  • Loading branch information
4 people authored Mar 13, 2024
1 parent 612e582 commit 412e40f
Show file tree
Hide file tree
Showing 6 changed files with 35 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.49.0](https://github.com/plivo/plivo-python/tree/v4.49.0) (2024-03-13)
**Adding Import Campaign**
-Added Import Campaign API

## [4.48.2](https://github.com/plivo/plivo-python/tree/v4.48.2) (2024-02-28)
**Feature - Log Redaction Enhancement**
- Added log attribute in GET and List MDR response
Expand Down
9 changes: 9 additions & 0 deletions plivo/resources/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ def create(self,
return self.client.request('POST', ('10dlc', 'Campaign'),
to_param_dict(self.create, locals()))

@validate_args(
campaign_id=[required(of_type(six.text_type))],
campaign_alias=[required(of_type(six.text_type))],
method=[optional(of_type(six.text_type))],
url=[optional(of_type(six.text_type))],
)
def import_campaign(self,campaign_id, campaign_alias, url=None, method=None):
return self.client.request('POST', ('10dlc', 'Campaign', 'Import'),
to_param_dict(self.import_campaign, locals()))

@validate_args(
campaign_id=[required(of_type(six.text_type))],
Expand Down
2 changes: 1 addition & 1 deletion plivo/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '4.48.2'
__version__ = '4.49.0'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='plivo',
version='4.48.2',
version='4.49.0',
description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML',
long_description=long_description,
url='https://github.com/plivo/plivo-python',
Expand Down
5 changes: 5 additions & 0 deletions tests/resources/fixtures/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."
}
15 changes: 15 additions & 0 deletions tests/resources/test_campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ def test_create(self):
'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/',
self.client.current_request.url)

@with_response(200)
def test_import(self):
response = self.client.campaign.import_campaign(
campaign_id = "CNTQ0OD",
campaign_alias= "New Contact by vinay for ct",
)
self.assertEqual('POST', self.client.current_request.method)
self.assertUrlEqual(
'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/Import/',
self.client.current_request.url)

self.assertEqual('CNTQ0OD', response.campaign_id)
self.assertEqual('Request to import campaign was received and is being processed.', response.message)


@with_response(200)
def test_get(self):
response = self.client.campaign.get(campaign_id='BRPXS6E')
Expand Down

0 comments on commit 412e40f

Please sign in to comment.