Documentation
¶
Index ¶
- Constants
- Variables
- func AllowedLocales(siteLocales []string) map[string]struct{}
- func BuildNotifications(root string, only map[string]struct{}, allowedLocales map[string]struct{}) ([]api.Notification, error)
- func ResolveProjectRoot() (string, error)
- func RootPath(projectRoot string) string
- func ToNotification(tpl Template) api.Notification
- func ToNotificationPayload(tpl Template) map[string]any
- func WriteNotifications(root string, notifications []api.Notification, only map[string]struct{}) ([]string, error)
- type PullResult
- type PushAction
- type PushResult
- type Template
- type Translation
Constants ¶
const RelativeRoot = "content/notifications"
Variables ¶
var FallbackLocales = []string{
"ar", "bg", "ca", "cs", "da", "de", "el", "en", "es", "et", "eu",
"fa", "fi", "fr", "ga", "gl", "hi", "hr", "hu", "is", "it", "ja",
"ko", "lb", "lt", "lv", "nl", "no", "pl", "pt", "ro", "ru", "sl",
"sr", "sv", "th", "tr", "zh",
}
FallbackLocales mirrors the legacy locale allowlist.
Functions ¶
func AllowedLocales ¶
AllowedLocales builds the accepted locale set.
func BuildNotifications ¶
func BuildNotifications(root string, only map[string]struct{}, allowedLocales map[string]struct{}) ([]api.Notification, error)
BuildNotifications reads disk templates and converts them to API notifications.
func ResolveProjectRoot ¶
ResolveProjectRoot returns the nearest nimbu.yml directory or cwd.
func ToNotification ¶
func ToNotification(tpl Template) api.Notification
ToNotification converts a local template into api.Notification for output.
func ToNotificationPayload ¶
ToNotificationPayload converts one local template into API payload form.
func WriteNotifications ¶
func WriteNotifications(root string, notifications []api.Notification, only map[string]struct{}) ([]string, error)
WriteNotifications writes remote notifications to the local disk contract.
Types ¶
type PullResult ¶
type PullResult struct {
Root string `json:"root"`
Slugs []string `json:"slugs"`
Written []string `json:"written"`
}
PullResult reports files written during pull.
type PushAction ¶
PushAction reports one uploaded notification.
type PushResult ¶
type PushResult struct {
Root string `json:"root"`
Actions []PushAction `json:"actions"`
}
PushResult reports notifications uploaded during push.
type Template ¶
type Template struct {
Slug string
Name string
Description string
Subject string
Text string
HTML string
HTMLEnabled bool
Translations map[string]Translation
}
Template models one notification template on disk.
func ReadTemplates ¶
func ReadTemplates(root string, only map[string]struct{}, allowedLocales map[string]struct{}) ([]Template, error)
ReadTemplates reads local notifications from disk.
func (Template) ToNotification ¶
func (t Template) ToNotification() api.Notification
ToNotification converts a disk template into the API contract.
type Translation ¶
Translation models one localized override on disk.