improve SpaceData struct

This commit is contained in:
genofire 2019-12-28 17:39:26 +01:00 committed by Timm
commit dc7db298bd

View file

@ -1,16 +1,38 @@
package main package main
type Feed struct { // non standard should start with ext_
Type string `json:"type"`
Url string `json:"url"`
}
type Location struct { type Location struct {
Address string `json:"address"` Address string `json:"address"`
// non standard
ExtFloor int `json:"ext_floor"`
Lon float32 `json:"lon"` Lon float32 `json:"lon"`
Lat float32 `json:"lat"` Lat float32 `json:"lat"`
} }
type SpaceFed struct {
SpaceNet bool `json:"spacenet"`
Spacesaml bool `json:"spacesaml"`
SpacePhone bool `json:"spacephone"`
}
type Stream struct {
M4 bool `json:"m4,omitempty"`
MJPEG bool `json:"mjpeg,omitempty"`
UStream bool `json:"ustream,omitempty"`
}
type State struct {
Open bool `json:"open"`
Lastchange float64 `json:"lastchange,omitempty"`
TriggerPerson string `json:"trigger_person,omitempty"`
Message string `json:"message,omitempty"`
Icon struct {
Open string `json:"open"`
Closed string `json:"closed"`
} `json:"icon,omitempty"`
}
type Contact struct { type Contact struct {
Twitter string `json:"twitter"` Twitter string `json:"twitter"`
Phone string `json:"phone"` Phone string `json:"phone"`
@ -20,25 +42,32 @@ type Contact struct {
IssueMail string `json:"issue_mail"` IssueMail string `json:"issue_mail"`
} }
type State struct {
Open bool `json:"open"`
}
type Feeds struct { type Feeds struct {
Blog Feed `json:"blog"` Blog Feed `json:"blog"`
Wiki Feed `json:"wiki"` Wiki Feed `json:"wiki"`
Calendar Feed `json:"calendar"` Calendar Feed `json:"calendar"`
} }
// main struct
type SpaceData struct { type SpaceData struct {
Api string `json:"api"` Api string `json:"api"`
Space string `json:"space"` Space string `json:"space"`
Logo string `json:"logo"` Logo string `json:"logo"`
Url string `json:"url"` Url string `json:"url"`
Location Location `json:"location"` Location Location `json:"location"`
Contact Contact `json:"contact"` SpaceFed SpaceFed `json:"spacefed,omitempty"`
IssueReportChannels []string `json:"issue_report_channels"` Cam []string `json:"cam,omitempty"`
Stream *Stream `json:"stream,omitempty"`
State State `json:"state"` State State `json:"state"`
Feeds Feeds `json:"feeds"` // missing: `json:"events,omitempty"`
Contact *Contact `json:"contact,omitempty"`
IssueReportChannels []string `json:"issue_report_channels"`
// missing: `json:"sensors,omitempty"`
Feeds Feeds `json:"feeds,omitempty"`
// missing: `json:"cache,omitempty"`
Projects []string `json:"projects,omitempty"`
// missing: `json:"radio_show,omitempty"`
// not in spaceapi.io/docs
Ext_ccc string `json:"ext_ccc"` Ext_ccc string `json:"ext_ccc"`
} }