mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-04 08:01:34 -04:00
add new send_notification api call
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user