okospaceapi/pkg/api/definition.go
Michael 7f5c78a02e
All checks were successful
/ docker-image (push) Successful in 43s
/ deployment (push) Successful in 0s
added "spaceapi@økoyono.de" as mail-handle
2024-01-24 12:33:01 +01:00

82 lines
2.1 KiB
Go

package api
import (
"encoding/json"
"git.okoyono.de/oko-intern/okospaceapi/pkg/location"
"git.okoyono.de/oko-intern/okospaceapi/pkg/spaceapi"
)
func BuildDefinition() []byte {
definition := spaceapi.Root{
ApiCompatibility: []string{"14"},
Space: "økoyono",
Url: "https://okoyono.de/",
Contact: &spaceapi.Contact{
Email: "spaceapi@økoyono.de",
Mastodon: "@f@social.okoyono.de", // TODO: Replace with real handle
Matrix: "#public:matrix.okoyono.de",
},
Location: &spaceapi.Location{
Timezone: "Europe/Berlin",
},
Logo: "https://okoyono.de/images/ant.svg",
Links: []*spaceapi.LinksItems{
{
Description: "Website",
Name: "website",
Url: "https://okoyono.de",
},
{
Description: "Mastodon (Social Media)",
Name: "mastodon",
Url: "https://social.okoyono.de",
},
{
Description: "Forgejo (Git)",
Name: "forgejo",
Url: "https://git.okoyono.de",
},
{
Description: "SearXNG (Search)",
Name: "searxng",
Url: "https://search.okoyono.de",
},
},
Projects: []string{
"https://buchdesmonats.okoyono.de/",
"https://comicdesmonats.okoyono.de/",
"https://git.okoyono.de/okoyono/weatherstation",
},
Sensors: &spaceapi.Sensors{
TotalMemberCount: []*spaceapi.TotalMemberCountItems{
{
Description: "We are a small group of people from south Germany, meeting remote on a regular basis.",
Location: "Remote",
Value: 6,
},
},
//Temperature: []*spaceapi.TemperatureItems{
// {
// Location: "@f",
// Name: "weatherstatiøn",
// Description: "Weatherstatiøn located at @f.",
// Value: sensors.TemperatureF(),
// },
//},
},
}
// Random location
randomLocation := location.SpinThatWheel()
definition.Location.Lat = randomLocation.Latitude
definition.Location.Lon = randomLocation.Longitude
definition.Location.Address = randomLocation.Name + ", Germany"
jsonString, err := json.Marshal(definition)
if err != nil {
panic(err)
}
return jsonString
}