add new send_notification api call

This commit is contained in:
Leo Hemsted
2017-06-22 15:56:05 +01:00
parent 1e979394bb
commit 3966d024d8
2 changed files with 24 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
from app.notify_client import NotifyAdminAPIClient
from app.notify_client import _attach_current_user, NotifyAdminAPIClient
class NotificationApiClient(NotifyAdminAPIClient):
@@ -55,5 +55,14 @@ class NotificationApiClient(NotifyAdminAPIClient):
params=params
)
def send_notification(self, service_id, *, template_id, recipient, personalisation=None):
data = {
'template_id': template_id,
'to': recipient,
'personalisation': personalisation,
}
data = _attach_current_user(data)
return self.post(url='/service/{}/send-notification'.format(service_id), data=data)
def get_notification(self, service_id, notification_id):
return self.get(url='/service/{}/notifications/{}'.format(service_id, notification_id))