blob: 1cb0b6f97400842e59120f9cd00db8531fab1274 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package calfeed
import (
"encoding/json"
"github.com/lukaszkasprzak/lectio/internal/config"
)
const Schema = "lectio.calendar/1"
// JSON renders days as the stable lectio.calendar/1 envelope.
//
// "source" and "license" carry the AGPL-3.0 §13 offer to consumers who only
// ever see this endpoint and never load the HTML UI. They are envelope
// metadata, not day data -- adding them does not change the schema version,
// since existing consumers read "days".
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"`
Source string `json:"source"`
License string `json:"license"`
Days []DayView `json:"days"`
}{Schema, form, config.SourceURL, config.License, days}, "", " ")
}
|