Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Arrivals(stopID string, when time.Time, duration time.Duration, ...) ([]Departure, error)
- func (c *Client) Departures(stopID string, when time.Time, duration time.Duration, ...) ([]Departure, error)
- func (c *Client) Locations(query string, locType LocationType, resultsNum int) ([]Location, error)
- func (c *Client) StopsNearby(lat, lng float64, distance, resultsNum int) ([]Location, error)
- type Departure
- type Line
- type Location
- type LocationType
- type TransportationType
Constants ¶
View Source
const BaseURL = "https://v6.vbb.transport.rest"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a VBB API client
func (*Client) Arrivals ¶
func (c *Client) Arrivals(stopID string, when time.Time, duration time.Duration, transportTypes TransportationType) ([]Departure, error)
Arrivals returns a list of arrivals for the stop at given time
func (*Client) Departures ¶
func (c *Client) Departures(stopID string, when time.Time, duration time.Duration, transportTypes TransportationType) ([]Departure, error)
Departures returns a list of departures for the stop at given time
type Departure ¶
type Departure struct {
Direction string
When time.Time
PlannedWhen time.Time
Delay int
Platform string
PlannedPlatform string
Line Line
}
Departure represents departure information
type Location ¶
type Location struct {
Type string
ID string
Name string
Address string
Latitude, Longitude float64
Distance int
}
Location is a station, stop, POI or an address
func (Location) MarshalJSON ¶
MarshalJSON marshals Location into HAFAS@v6 JSON representation
func (*Location) UnmarshalJSON ¶
UnmarshalJSON unmarshals HAFAS@v6 JSON representation into Location
type LocationType ¶
type LocationType uint8
LocationType represents location type
const ( LocationTypeUnknown LocationType = 0 LocationTypeStop LocationType = 1 << iota LocationTypeAddress LocationTypePOI LocationTypeAny = LocationTypeStop | LocationTypeAddress | LocationTypePOI )
type TransportationType ¶
type TransportationType uint8
TransportationType represents the type transport type
const ( SuburbanTrain TransportationType = 1<<iota + 1 Subway Tram Bus Ferry ExpressTrain RegionalTrain UrbanTransport = SuburbanTrain | Subway | Tram | Bus | Ferry | RegionalTrain AllTransport = UrbanTransport | ExpressTrain )
Click to show internal directories.
Click to hide internal directories.