Documentation ¶
Index ¶
- func GetConnections(stationFrom string, stationTo string) ([]byte, error)
- func GetDurationInMinutes(c Connection) string
- func GetSNCBStationTimeTable(stationName string) ([]byte, error)
- func GetSNCBStationsJSON() ([]byte, error)
- type Connection
- type ConnectionArrival
- type ConnectionDeparture
- type ConnectionResult
- type Departures
- type Occupancy
- type PlatformInfo
- type Station
- type StationInfo
- type StationTimetableResponse
- type Stop
- type TimetableDeparture
- type VehicleInfo
- type ViaInfo
- type Vias
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConnections ¶
GetConnections fetches the connection data from the API and returns the response body as a byte slice.
func GetDurationInMinutes ¶
func GetDurationInMinutes(c Connection) string
func GetSNCBStationTimeTable ¶
GetSNCBStationTimeTable fetches the timetable for a specific station
func GetSNCBStationsJSON ¶
GetSNCBStationsJSON fetches the list of SNCB stations
Types ¶
type Connection ¶
type Connection struct { ID string `json:"id"` Departure ConnectionDeparture `json:"departure"` Arrival ConnectionArrival `json:"arrival"` Duration string `json:"duration"` Number string `json:"number"` Vias Vias `json:"vias,omitempty"` // waarom de * ? }
func ParseConnections ¶
func ParseConnections(body []byte) ([]Connection, error)
ParseConnections takes the response body as a byte slice and returns an array of Connection structs.
func (Connection) GetDelayInSeconds ¶
func (c Connection) GetDelayInSeconds() int
func (Connection) GetUnixDepartureTime ¶
func (c Connection) GetUnixDepartureTime() int
type ConnectionArrival ¶
type ConnectionArrival struct { Station string `json:"station"` StationInfo StationInfo `json:"stationinfo"` Time string `json:"time"` // Unix Delay string `json:"delay"` // seconds Canceled string `json:"canceled"` Left string `json:"left"` Platform string `json:"platform"` PlatformInfo PlatformInfo `json:"platforminfo"` }
type ConnectionDeparture ¶
type ConnectionDeparture struct { Station string `json:"station"` Time string `json:"time"` // Unix Delay string `json:"delay"` // seconds Canceled string `json:"canceled"` Left string `json:"left"` IsExtra string `json:"isExtra"` Vehicle string `json:"vehicle"` Platform string `json:"platform"` //Stops []Stop `json:"stops"` VehicleInfo VehicleInfo `json:"vehicleinfo"` }
TODO:
type ConnectionResult ¶
type ConnectionResult struct {
Connection []Connection `json:"connection"`
}
type Departures ¶
type Departures struct { Number string `json:"number"` Departure []TimetableDeparture `json:"departure"` }
type PlatformInfo ¶
type Station ¶
type Station struct { ID string `json:"id"` Name string `json:"name"` StandardName string `json:"standardname"` }
func ParseStations ¶
ParseStations parses the JSON data of stations
type StationInfo ¶
type StationTimetableResponse ¶
type StationTimetableResponse struct { Version string `json:"version"` Timestamp string `json:"timestamp"` Station string `json:"station"` StationInfo StationInfo `json:"stationinfo"` Departures Departures `json:"departures"` }
type TimetableDeparture ¶
type TimetableDeparture struct { ID string `json:"id"` Station string `json:"station"` StationInfo StationInfo `json:"stationinfo"` Time string `json:"time"` Delay string `json:"delay"` // seconds Canceled string `json:"canceled"` Left string `json:"left"` IsExtra string `json:"isExtra"` Vehicle string `json:"vehicle"` VehicleInfo VehicleInfo `json:"vehicleinfo"` Platform string `json:"platform"` PlatformInfo PlatformInfo `json:"platforminfo"` Occupancy Occupancy `json:"occupancy"` DepartureConnection string `json:"departureConnection"` }
func ParseiRailDepartures ¶
func ParseiRailDepartures(jsonData []byte) ([]TimetableDeparture, error)
ParseiRailDepartures handles fetching of timetable departures
func (TimetableDeparture) GetDelayInSeconds ¶
func (d TimetableDeparture) GetDelayInSeconds() int
func (TimetableDeparture) GetUnixDepartureTime ¶
func (d TimetableDeparture) GetUnixDepartureTime() int
type VehicleInfo ¶
type ViaInfo ¶
type ViaInfo struct { ID string `json:"id"` Arrival ConnectionArrival `json:"arrival"` Departure ConnectionDeparture `json:"departure"` // Station string `json:"station"` TimeBetween string `json:"timeBetween"` }
Click to show internal directories.
Click to hide internal directories.