Documentation ¶
Index ¶
- func Loop(client *http.Client, gtfsResource util.Resource, sleepTime time.Duration, ...) (err error)
- func Make(client *http.Client, routeMap map[string]sort.StringSlice, opts Options) (err error)
- type Alert
- type AlertContainer
- func (ac *AlertContainer) AsProto() *gtfsrt.FeedMessage
- func (ac *AlertContainer) Filter()
- func (ac *AlertContainer) LoadExternal(client exclusiveHTTPClient, routeMap map[string]sort.StringSlice, ...) error
- func (ac *AlertContainer) SaveJSON(target string) (err error)
- func (ac *AlertContainer) SavePB(target string, humanReadable bool) (err error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Alert ¶
type Alert struct { ID string `json:"id"` Routes []string `json:"routes"` Effect string `json:"effect"` Link string `json:"link"` Title string `json:"title"` Body string `json:"body"` HTMLBody string `json:"htmlbody"` }
Alert contains an internal representation of an alert, which is also marshallable to JSON
func (*Alert) AsProto ¶
func (a *Alert) AsProto() *gtfsrt.FeedEntity
AsProto returns the Alert marshalled to a GTFS-RT FeedEntity
func (*Alert) LoadExternal ¶
func (a *Alert) LoadExternal(client exclusiveHTTPClient, routeMap map[string]sort.StringSlice) (err error)
LoadExternal processes data located on the website saved in a.Link
type AlertContainer ¶
type AlertContainer struct { Timestamp time.Time `json:"-"` Time string `json:"time"` Alerts []*Alert `json:"alerts"` }
AlertContainer is a container for multiple alerts, marshallable to JSON
func (*AlertContainer) AsProto ¶
func (ac *AlertContainer) AsProto() *gtfsrt.FeedMessage
AsProto returns this list of alerts marshalled into a GTFS-RT FeedMessage
func (*AlertContainer) Filter ¶
func (ac *AlertContainer) Filter()
Filter removes all alerts without associated routes
func (*AlertContainer) LoadExternal ¶
func (ac *AlertContainer) LoadExternal(client exclusiveHTTPClient, routeMap map[string]sort.StringSlice, throwErrors bool) error
LoadExternal asynchronously calls LoadExternal on all its alerts
func (*AlertContainer) SaveJSON ¶
func (ac *AlertContainer) SaveJSON(target string) (err error)
SaveJSON marshalls the container into a json file at the given location
Click to show internal directories.
Click to hide internal directories.