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}, "", " ") }