aboutsummaryrefslogtreecommitdiff
path: root/internal/calfeed/json.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/calfeed/json.go')
-rw-r--r--internal/calfeed/json.go17
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}, "", " ")
+}