Add the bones of an Email Notification service
This commit is contained in:
parent
a7fdd6cbd0
commit
24bb9dae30
8 changed files with 138 additions and 8 deletions
38
src/notifications/data.py
Normal file
38
src/notifications/data.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
from dataclasses import dataclass, field
|
||||
|
||||
URL = str
|
||||
|
||||
|
||||
@dataclass
|
||||
class NotificationAction:
|
||||
# A unique identifier for the action
|
||||
action: str
|
||||
# The title to show with the action
|
||||
title: str
|
||||
# Where to navigate to when clicked.
|
||||
navigate: URL | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class Notification:
|
||||
"""
|
||||
Details to show in a notification
|
||||
|
||||
Much of the data here is intended to match the arguments to the [showNotification](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification)
|
||||
Web API, but this content is ideally displayable in other contexts (for example in Email or RSS)
|
||||
"""
|
||||
|
||||
# The main title content to show
|
||||
title: str
|
||||
# The content of the notification
|
||||
content: str
|
||||
|
||||
# The UNIX timestamp in milliseconds since the epoch associated with this notification
|
||||
timestamp: int
|
||||
# A list of actions included with this notification
|
||||
actions: list[NotificationAction] = field(default_factory=list)
|
||||
# The location of an icon to show as the icon for this notification
|
||||
icon: URL | None = None
|
||||
|
||||
# The location of an image associated with this notification
|
||||
image: URL | None = None
|
||||
Loading…
Add table
Add a link
Reference in a new issue