Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TimeDeparture is the 'dir' used when the dtime and ddate represents // the departure time. TimeDeparture int = 1 // TimeArrival is the 'dir' used when the dtime and ddate represents // the arrival time. TimeArrival = 2 )
View Source
const DeparturesURL = `https://rp.atb.no/scripts/TravelMagic/TravelMagicWE.dll/svar`
DeparturesURL is the URL for the 'departures' endpoint.
View Source
const SuggestionsURL = "https://rp.atb.no/scripts/TravelMagic/TravelMagicWE.dll/StageJSON"
SuggestionsURL is the URL for the 'suggestions' endpoint.
Variables ¶
This section is empty.
Functions ¶
func GetSuggestions ¶
GetSuggestions queries the SuggestionsURL to get bus-stops matching the given query.
Types ¶
type Departure ¶
type Departure struct { Start time.Time `json:"start"` End time.Time `json:"end"` Changes int `json:"changes"` Fare string `json:"fare"` Duration time.Duration `json:"duration"` Route []Transport `json:"route"` }
Departure ...
func GetDepartures ¶
GetDepartures ...
func GetDeparturesNow ¶
GetDeparturesNow ...
func GetDeparturesReq ¶
func GetDeparturesReq(req DepartureReq) (deps []Departure, err error)
GetDeparturesReq ...
type DepartureReq ¶
type DepartureReq struct { // Dir int From string To string Time string Date string IsArrivalTime bool // Used for non-realtime requests. IsRealtime bool }
DepartureReq holds information used in the departure request.
type RealtimeDeparture ¶
type RealtimeDeparture struct { Transport Transport `json:"transport"` IsRealtime bool `json:"is_realtime"` LocationID int `json:"location_id"` Towards string `json:"towards"` }
RealtimeDeparture contains the data describing a realtime departure response.
func GetRealtimeDepartures ¶
func GetRealtimeDepartures(from string) (rdeps []RealtimeDeparture, err error)
GetRealtimeDepartures ...
type SuggestionRes ¶
SuggestionRes represents the result from the Suggestions endpoint (given by SuggestionsURL).
type Transport ¶
type Transport struct { Type TransportType `json:"type"` WalkText string `json:"walk_text,omitempty"` LineNum int `json:"linenum"` Start time.Time `json:"start_time"` }
Transport ...
type TransportType ¶
type TransportType int
TransportType ...
const ( // TransportBus ... TransportBus TransportType = iota // TransportWalking ... TransportWalking )
Click to show internal directories.
Click to hide internal directories.