https://github.com/ownerofglory/govvs
Simple Golang lib for VVS API (Verkehrsverbund Stuttgart)
https://github.com/ownerofglory/govvs
go golang ssb transport transportation vvs vvs-api
Last synced: 3 months ago
JSON representation
Simple Golang lib for VVS API (Verkehrsverbund Stuttgart)
- Host: GitHub
- URL: https://github.com/ownerofglory/govvs
- Owner: ownerofglory
- License: mit
- Created: 2024-02-01T22:11:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-21T20:25:11.000Z (over 1 year ago)
- Last Synced: 2024-11-21T21:25:32.199Z (over 1 year ago)
- Topics: go, golang, ssb, transport, transportation, vvs, vvs-api
- Language: Go
- Homepage:
- Size: 563 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go VVS - VVS (Verkehrsverbund Stuttgart) API library
Simple Go library wrapping VVS API

## Features
- Journey search
- Station finder
- Departure information
- Arrival information
- Serving lines search
- Geo information for lines
## Prerequisites
- Go version >= 1.19
## Usage
### Example: station finder
```go
package main
import (
"github.com/ownerofglory/govvs"
"github.com/ownerofglory/govvs/station"
)
func main() {
req := govvs.StopFinderRequest{
Name: "Augustinum",
Type: "any",
}
res, err := govvs.GetStopFinder(req)
if err != nil {
// handle error ...
}
// process response
// ...
}
```
### Example: departure monitor
```go
package main
import (
"github.com/ownerofglory/govvs"
"github.com/ownerofglory/govvs/station"
)
func main() {
stationName := station.HAUPTBAHNHOF_TIEF_STUTTGART
// convert station name to station id (de:XXXXX:YYYY)
stationId, _ := station.StationNameToGlobalId(stationName)
req := govvs.DepartureRequest{
StationId: stationId,
}
resp, err := govvs.GetDepartures(req)
if err != nil {
// handle error ...
}
// process response
// ...
}
```
### Example: journey search
```go
package main
import (
"github.com/ownerofglory/govvs"
"github.com/ownerofglory/govvs/station"
)
func main() {
// convert station name to station id (de:XXXXX:YYYY)
origId, _ := station.StationNameToGlobalId(station.HAUPTBAHNHOF_TIEF_STUTTGART)
destId, _ := station.StationNameToGlobalId(station.FLUGHAFENMESSE_ECHTERDINGEN)
req := govvs.JourneyRequest{
OrigId: origId,
DstId: destId,
}
resp, err := govvs.GetJourney(req)
if err != nil {
// handle error ...
}
// process response
// ...
}
```