Skip to content

Simple Golang lib for VVS API (Verkehrsverbund Stuttgart)

License

Notifications You must be signed in to change notification settings

ownerofglory/govvs

Repository files navigation

Go VVS - VVS (Verkehrsverbund Stuttgart) API library

Simple Go library wrapping VVS API Test Pipeline status

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

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

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

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
    // ...
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy