summaryrefslogtreecommitdiff
path: root/internal/calfeed/json.go
blob: c1a50ca0aaa387ecce8db248ea6809d713b18b81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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}, "", "  ")
}