Documentation
¶
Overview ¶
Package routes mounts Hanzo Notify's /v1/notify/* HTTP surface on top of hanzoai/base's router.
The platform plugin handles auth (IAM JWT validation) and org-header injection (X-Org-Id from JWT owner claim). This package adds the notify-specific endpoints: send, message lookup, providers, templates, events, metering.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MountBrandPlivo ¶ added in v1.6.6
func MountBrandPlivo(r *router.Router[*core.RequestEvent], app *base.Base, kms *kmsbridge.Client, resolver *tenant.PlivoResolver)
MountBrandPlivo installs the /v1/notify/brand/plivo* routes. Bound when the binary has both a KMS facade and a PlivoResolver. In local dev (no KMS) the routes return 503 — the override surface is production-only.
func MustRegister ¶
MustRegister installs the notify API on app's OnServe hook. The hook fires once, when the HTTP server starts.
Types ¶
type Config ¶
type Config struct {
// Resolver constructs per-tenant Notifier instances on demand —
// the single-provider, pin-an-id path. Kept alive for ?provider=
// requests and as the local-dev fallback when KMS is unwired.
Resolver *tenant.Resolver
// ChainResolver constructs the per-channel multi-provider chain
// (primary → fallback1 → fallback2). When non-nil and the caller
// did NOT pin a provider, the sync handler runs through the chain
// and records the per-attempt trace on the message row.
ChainResolver *tenant.ChainResolver
// Dispatcher enqueues async sends. Nil means async dispatch is not
// available; POST /v1/notify/send without ?sync=true then returns
// 503. The binary owns the worker's Start/Stop lifecycle; this
// package only reads the dispatch surface.
Dispatcher tasks.Dispatcher
// KMSClient is the KMS facade. Required by the brand override
// endpoints (/v1/notify/brand/plivo*). Nil → those endpoints return
// 503 (local-dev path).
KMSClient *kmsbridge.Client
// PlivoResolver handles per-brand Plivo credential resolution with
// fallback to the Hanzo default. Nil → /v1/notify/brand/plivo*
// returns 503.
PlivoResolver *tenant.PlivoResolver
// UnsubscribeSigner mints + verifies HMAC tokens for the one-click
// email unsubscribe surface (§5.1 of the notification-preferences
// paper). Nil → /v1/notify/unsubscribe and /resubscribe return 503.
UnsubscribeSigner *unsubscribe.Signer
}
Config wires the routes module to its collaborators.