Notification Model¶
Data models for notification operations.
Notification data models.
Defines the request and response models for the notification system.
MESSAGE_KEY_ALIASES
module-attribute
¶
MESSAGE_KEY_ALIASES = ['content', 'body']
Alternative field names accepted for the message content.
NotificationContent
dataclass
¶
NotificationContent(
subject=custom_field(mm_field=(StringField())),
message=custom_field(mm_field=(StringField())),
content_type=custom_field(
mm_field=(EnumField(NotificationContentType)),
default=(NotificationContentType.PLAIN_TEXT),
),
)
Bases: SchemaModel
Content of a notification message.
Attributes:
| Name | Type | Description |
|---|---|---|
subject |
str
|
The subject line of the notification. |
message |
str
|
The body content of the notification. |
content_type |
NotificationContentType
|
The format of the message content. |
NotificationContentType ¶
Bases: str, Enum
Content types for notification messages.
Attributes:
| Name | Type | Description |
|---|---|---|
PLAIN_TEXT |
Plain text content type. |
|
HTML |
HTML formatted content. |
|
JSON |
JSON structured content. |
NotificationRequest
dataclass
¶
NotificationRequest(
content=custom_field(
mm_field=(NotificationContent.as_mm_field())
),
targets=custom_field(
mm_field=(
ListField(
UnionField(
[
(_, _.as_mm_field())
for _ in [
SESEmailTarget,
SNSTopicTarget,
]
]
)
)
)
),
)
Bases: SchemaModel
Request model for sending notifications.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
NotificationContent
|
The notification content to deliver. |
targets |
List[Union[SESEmailTarget, SNSTopicTarget]]
|
List of delivery targets (SES or SNS). |
NotificationResponse
dataclass
¶
NotificationResponse(
results=custom_field(
mm_field=(ListField(NotifierResult.as_mm_field()))
),
)
Bases: SchemaModel
Response model for notification delivery.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
List[NotifierResult]
|
List of results for each notification target. |