notification: payload + Channel interface

This commit is contained in:
2026-05-04 19:31:27 +01:00
parent 8a92fedba1
commit d0baabc745
2 changed files with 56 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
package notification
import (
"context"
"time"
)
// Channel is the per-kind transport. Implementations live in
// webhook.go / ntfy.go / smtp.go. Send must respect ctx (5s for HTTP,
// 10s for SMTP) and never panic.
type Channel interface {
// Kind returns the kind string ("webhook", "ntfy", "smtp"). Used
// for log enrichment and dispatcher routing.
Kind() string
// Send delivers one payload. Returns (statusCode, latency, err).
// statusCode is HTTP for HTTP channels, the SMTP final-line code
// (e.g. 250) for SMTP, 0 if the call didn't reach a wire response.
Send(ctx context.Context, p Payload) (statusCode int, latency time.Duration, err error)
}