gohafas

module
v0.0.0-...-70a2b83 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2023 License: MIT

README

Go API client for HAFAS

Currently, only stop search and stationboard endpoints are implemented. The only API which has been tested is the ZVV one.

It has the base URL https://zvv.hafas.cloud/bin and a nice web interface at https://online.fahrplan.zvv.ch/bin/stboard.exe.

HAFAS

Read more about it here:

Usage and example binary

See the example CLI utility in cmd/stationboard for example usage.

$ go run ./cmd/stationboard/ --help
List next departures for a public transport stop.

Usage: stationboard [--timeout T] [--max-results N] [STOP]

Positional arguments:
  STOP                   stop name, use cmd/findStops to find stops

Options:
  --timeout T, -t T      API timeout [default: 5s]
  --max-results N, -n N
                         max number of results [default: 5]
  --help, -h             display this help and exit

$ go run ./cmd/stationboard/ 'Zürich HB'
Next departures for Zürich HB
🚊 Tram 13 to Zürich, Hardturm
   In 0 minute(s) (27.11.22 15:38)
🚆 InterCity 3 to Chur
   In 0 minute(s) (27.11.22 15:38)
   Platform: 8
🚆 RegioExpress  to Aarau
   In 0 minute(s) (27.11.22 15:38)
   Platform: 15
🚆 S-Bahn S4 to Langnau-Gattikon
   In 0 minute(s) (27.11.22 15:38)
   Platform: 21
🚊 Tram 4 to Zürich, Bahnhof Tiefenbrunnen
   In 0 minute(s) (27.11.22 15:38)
   Real time: 1 (0+1) platform

Directories

Path Synopsis
cmd
pkg
zvv

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL