Skip to content

Commit

Permalink
Add doc to README
Browse files Browse the repository at this point in the history
  • Loading branch information
ownerofglory committed Feb 15, 2024
1 parent 3d1642a commit d7e5e28
Showing 1 changed file with 65 additions and 2 deletions.
67 changes: 65 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,68 @@
# Go VVS - VVS (Verkehr Verbund Stuttgart) API library

Go library wrapping VVS API
![Test Pipeline status](https://github.com/ownerofglory/govvs/actions/workflows/test-pipeline.yml/badge.svg)

in development
## Features
- Journey search
- Departure information
- Arrival information

## Prerequisites
- Go version >= 1.19

## Usage
### 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.NameToGlobalId(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.NameToGlobalId(station.HAUPTBAHNHOF_TIEF_STUTTGART)
destId, _ := station.NameToGlobalId(station.FLUGHAFENMESSE_ECHTERDINGEN)

req := govvs.JourneyRequest{
OrigId: origId,
DstId: destId,
}

resp, err := govvs.GetJourney(req)
if err != nil {
// handle error ...
}
// process response
// ...
}
```

0 comments on commit d7e5e28

Please sign in to comment.