diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 21:25:43 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 21:25:43 +0200 |
| commit | 45e0b7652552867f7f99ffe22c968641510d5143 (patch) | |
| tree | b9a5d9aaabfd8b0932dbd012f7053e13b0df83ab /internal/calfeed/json.go | |
| parent | 5ab5ff23417a80eb1b878329fd57828158bd4a31 (diff) | |
| download | lectio-45e0b7652552867f7f99ffe22c968641510d5143.tar.gz lectio-45e0b7652552867f7f99ffe22c968641510d5143.zip | |
feat(calfeed): day wire model + JSON renderer
Diffstat (limited to 'internal/calfeed/json.go')
| -rw-r--r-- | internal/calfeed/json.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/calfeed/json.go b/internal/calfeed/json.go new file mode 100644 index 0000000..c1a50ca --- /dev/null +++ b/internal/calfeed/json.go @@ -0,0 +1,17 @@ +package calfeed + +import "encoding/json" + +const Schema = "lectio.calendar/1" + +// JSON renders days as the stable lectio.calendar/1 envelope. +func JSON(form string, days []DayView) ([]byte, error) { + if days == nil { + days = []DayView{} + } + return json.MarshalIndent(struct { + Schema string `json:"schema"` + Form string `json:"form"` + Days []DayView `json:"days"` + }{Schema, form, days}, "", " ") +} |
