Compare commits

..

No commits in common. "9d9727008aaedd8e60e356c6321ff4a1f874c7a2" and "9f8b723f64550cef5f43649f06d7fdf189644382" have entirely different histories.

View file

@ -54,12 +54,11 @@ class _PushBody:
these fields are sent (mirrors the advertising service's client).
"""
def __init__(self, title: str, message: str, priority: int, extras, click_url=None):
def __init__(self, title: str, message: str, priority: int, extras):
self._title = title
self._message = message
self._priority = priority
self._extras = extras
self._click_url = click_url
def to_dict(self) -> dict:
return {
@ -67,20 +66,16 @@ class _PushBody:
"message": self._message,
"priority": self._priority,
"extras": self._extras,
"click_url": self._click_url,
}
def push_user(user_uuid, title: str, message: str, priority: int = 5, extras=None, click_url=None):
def push_user(user_uuid, title: str, message: str, priority: int = 5, extras=None):
"""
Send a push notification to a single user via the gooyal notifications
service. Requires the `notifications.application.push:send` scope on
this app's OAuth2 client credentials. Raises on failure — callers
decide whether a down notifications service should be swallowed.
`click_url` is optional — most notifications aren't clickable. When set,
the notifications service embeds it as the tap destination.
"""
client = get_client()
body = _PushBody(title=title, message=message, priority=priority, extras=extras, click_url=click_url)
body = _PushBody(title=title, message=message, priority=priority, extras=extras)
return push_application_application_create.sync(user_uuid=str(user_uuid), client=client, body=body)