Skip to content

Commit 693d568

Browse files
committed
allow sending params in transmission list endpoint
1 parent 8808080 commit 693d568

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

sparkpost/transmissions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,17 @@ def get(self, transmission_id):
265265
results = self._fetch_get(transmission_id)
266266
return results['transmission']
267267

268-
def list(self):
268+
def list(self, **kwargs):
269269
"""
270270
Get a list of your transmissions
271271
272+
:param campaign_id: ID of the campaign used by the transmissions
273+
:param template_id: ID of the template used by the transmissions
274+
272275
:returns: list of transmissions
273276
:raises: :exc:`SparkPostAPIException` if API call fails
274277
"""
275-
results = self.request('GET', self.uri)
276-
return results
278+
return self.request('GET', self.uri, params=kwargs)
277279

278280
def delete(self, transmission_id):
279281
"""

test/test_transmissions.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,22 @@ def test_success_list():
310310
assert response == []
311311

312312

313+
@responses.activate
314+
def test_success_list_with_params():
315+
responses.add(
316+
responses.GET,
317+
'https://api.sparkpost.com/api/v1/transmissions?template_id=abcd',
318+
status=200,
319+
content_type='application/json',
320+
body='{"results": []}',
321+
match_querystring=True
322+
323+
)
324+
sp = SparkPost('fake-key')
325+
response = sp.transmission.list(template_id='abcd')
326+
assert response == []
327+
328+
313329
@responses.activate
314330
def test_success_delete():
315331
responses.add(

0 commit comments

Comments
 (0)