notification: payload + Channel interface
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user