Documentation
¶
Index ¶
Constants ¶
View Source
const StatusAPI = "https://prtstatus.wvu.edu/api/%s?format=json"
StatusAPI is the endpoint for the PRT status
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Status ¶
type Status struct {
// Status can be an integer from 1 through 7 meaning the following:
// 1 - normal, 2 - down between A and B, 3 - down for maintenance, 4 - down, 5 - special event, 6 - down at A, 7 - closed
// However, PRT operators seem to play favorites with just 1, 5, and 7 even though others are more applicable
Status int `json:"status"`
// Message will contain the message text as entered by the PRT operators
Message string `json:"message"`
// Timestamp is a 64-bit integer of a Unix timestamp of the status event
Timestamp int64 `json:"timestamp"`
// Stations is a string array of the stations the event occurred at
Stations []string `json:"stations"`
// BussesDispatched is a boolean true if the event required busses to be dispatched
BussesDispatched bool `json:"bussesDispatched"`
// Duration is a so far unused string variable
Duration string `json:"duration"`
}
Status is a PRT status update
func (*Status) CompareTo ¶
CompareTo compares a Status update A with B, useful for sorting chronologically
func (*Status) GetStatusText ¶
GetStatusText returns a simple English representation of the PRT's status
type StatusClient ¶
type StatusClient struct {
// contains filtered or unexported fields
}
StatusClient is the client used in go to intermediate status request
func NewClient ¶
func NewClient(c ...*http.Client) *StatusClient
NewClient returns a new StatusClient to use to query for PRT status updates
func (*StatusClient) GetCurrentStatus ¶
func (c *StatusClient) GetCurrentStatus() (*Status, string, error)
GetCurrentStatus retuns the current status from the live status API
Click to show internal directories.
Click to hide internal directories.