Skip to content

Commit 412e40f

Browse files
vinaykumar-plivoThumpala Vinay KumarSajal SinghalSajal Singhal
authored
SDK changes for Import Campaign API (#259)
* 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 <[email protected]> Co-authored-by: Sajal Singhal <[email protected]> Co-authored-by: Sajal Singhal <[email protected]>
1 parent 612e582 commit 412e40f

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [4.49.0](https://github.com/plivo/plivo-python/tree/v4.49.0) (2024-03-13)
4+
**Adding Import Campaign**
5+
-Added Import Campaign API
6+
37
## [4.48.2](https://github.com/plivo/plivo-python/tree/v4.48.2) (2024-02-28)
48
**Feature - Log Redaction Enhancement**
59
- Added log attribute in GET and List MDR response

plivo/resources/campaign.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ def create(self,
123123
return self.client.request('POST', ('10dlc', 'Campaign'),
124124
to_param_dict(self.create, locals()))
125125

126+
@validate_args(
127+
campaign_id=[required(of_type(six.text_type))],
128+
campaign_alias=[required(of_type(six.text_type))],
129+
method=[optional(of_type(six.text_type))],
130+
url=[optional(of_type(six.text_type))],
131+
)
132+
def import_campaign(self,campaign_id, campaign_alias, url=None, method=None):
133+
return self.client.request('POST', ('10dlc', 'Campaign', 'Import'),
134+
to_param_dict(self.import_campaign, locals()))
126135

127136
@validate_args(
128137
campaign_id=[required(of_type(six.text_type))],

plivo/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = '4.48.2'
2+
__version__ = '4.49.0'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='plivo',
13-
version='4.48.2',
13+
version='4.49.0',
1414
description='A Python SDK to make voice calls & send SMS using Plivo and to generate Plivo XML',
1515
long_description=long_description,
1616
url='https://github.com/plivo/plivo-python',
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"api_id": "2c6c5e16-090a-11ed-bb48-0242ac110004",
3+
"campaign_id": "CNTQ0OD",
4+
"message": "Request to import campaign was received and is being processed."
5+
}

tests/resources/test_campaign.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ def test_create(self):
3939
'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/',
4040
self.client.current_request.url)
4141

42+
@with_response(200)
43+
def test_import(self):
44+
response = self.client.campaign.import_campaign(
45+
campaign_id = "CNTQ0OD",
46+
campaign_alias= "New Contact by vinay for ct",
47+
)
48+
self.assertEqual('POST', self.client.current_request.method)
49+
self.assertUrlEqual(
50+
'https://api.plivo.com/v1/Account/MAXXXXXXXXXXXXXXXXXX/10dlc/Campaign/Import/',
51+
self.client.current_request.url)
52+
53+
self.assertEqual('CNTQ0OD', response.campaign_id)
54+
self.assertEqual('Request to import campaign was received and is being processed.', response.message)
55+
56+
4257
@with_response(200)
4358
def test_get(self):
4459
response = self.client.campaign.get(campaign_id='BRPXS6E')

0 commit comments

Comments
 (0)