SMS and push channels live in serenade-notifier (#230). Email stays in MAILER.md.
| Type | Role |
|---|---|
Channel |
Sms or Push |
SmsMessage / PushMessage |
Channel payloads |
Notification |
Sms(...) or Push(...) enum + constructors |
NotifierError |
Validation / transport failures |
| Transport | Role |
|---|---|
NullTransport |
Validates then discards (default DI notifier) |
MemoryTransport |
Records sends for tests / local |
SmsOnlyTransport |
Accepts SMS; rejects push with UnsupportedChannel |
All implement Transport with supports + sync send. Vendor SDKs are not mandatory deps; apps wrap their SMS/push providers behind Transport.
FrameworkExtension adds RegisterDefaultNotifierPass, which registers service id notifier (DEFAULT_NOTIFIER_SERVICE) tagged notifier.transport with a NullTransport when missing. Resolve NotifierService and call send.
use serenade_notifier::{MemoryTransport, Notification, NullTransport, Transport};
NullTransport::new().send(&Notification::sms("+15551212", "Your code is 1234"))?;
NullTransport::new().send(&Notification::push("device-token", "Hi", "Order shipped"))?;
let memory = MemoryTransport::new();
memory.send(&Notification::sms("+1", "ping"))?;
assert_eq!(memory.sent().len(), 1);