Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // GitHash is the sha hash of the current commit used to build this code. GitHash string // Version is the semantic version according to the release. Version string )
var Routes = map[string]string{}/* 310 elements not displayed */
Routes is a map of the common name to the Route used in the API.
var Stations = []string{}/* 155 elements not displayed */
Stations is the list of valid station names for next to arrive
Functions ¶
func IsValidStation ¶
IsValidStation returns whether the station is a valid station.
Types ¶
type APIBool ¶ added in v1.1.0
type APIBool bool
APIBool is a type of bool that can deal with the range of data that the Septa API returns for a bool which is any of "N", "Yes", "0", 0, etc.
func (*APIBool) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON takes the values in JSON and maps them to the golang types. This is where N, No, etc are mapped to the bool type.
type AlertResult ¶ added in v1.1.0
type AlertResult struct { // Name3 is the three letter designation for the route. Name3 string `json:"route"` RouteID string `json:"route_id"` RouteName string `json:"route_name"` Sequence string `json:"sequence"` Mode string `json:"mode"` IsAdvisory APIBool `json:"isadvisory"` IsDetour APIBool `json:"isdetour"` IsAlert APIBool `json:"isalert"` IsSuspend APIBool `json:"issuppend"` IsElevator APIBool `json:"iselevator"` IsSuspended APIBool `json:"issuspended"` IsStrike APIBool `json:"isstrike"` IsModifiedService APIBool `json:"ismodifiedservice"` IsDelays APIBool `json:"isdelays"` CurrentMessage string `json:"current_message"` }
AlertResult is a line returned from the alert API.
func (AlertResult) String ¶ added in v1.1.0
func (r AlertResult) String() string
String prints a formatted version of the AlertResult
type Client ¶
type Client struct { // Domain is the api domain. Domain string // Timeout is the number of seconds before the call times out. Timeout time.Duration }
Client is used to make calls to the septa website.
func (*Client) Alerts ¶ added in v1.1.0
func (c *Client) Alerts(route string) ([]AlertResult, error)
Alerts makes a call to the alerts api and returns the results. If no matching route is found, alerts for all routes will be displayed.
func (*Client) NextToArrive ¶
NextToArrive makes a call to the next to arrive api and returns the results
type NextToArriveResult ¶
type NextToArriveResult struct { Train string `json:"orig_train"` Line string `json:"orig_line"` DepartureString string `json:"orig_departure_time"` ArrivalString string `json:"orig_arrival_time"` Delay string `json:"orig_delay"` IsDirect string `json:"isdirect"` }
NextToArriveResult is a line in the NTA response.
func (NextToArriveResult) String ¶
func (r NextToArriveResult) String() string
String returns a formatted string suitable for printing.
type Route ¶ added in v1.1.0
type Route struct { // ThreeID is a three letter designation for the route ThreeID string // ID is the API route_id used. ID string // Name is the route_name used in the API Name string // Mode is the type of rail, one of Regional Rail, Bus, or there are some other modes. Mode string }
Route is a rail route.