This project is no longer maintained.
go-sptrans is a Go client library for the SPTrans Olho Vivo API.
- Lines
- Stops
- Corridors
- Companies
- Vehicles Position
- Forecast
See the documentation at godoc.
go get github.com/sergioaugrod/go-sptrans/sptrans
import "github.com/sergioaugrod/go-sptrans/sptrans"
token = "123456"
client = sptrans.NewClient(token)
client.Authenticate()
// Search by line description or number
client.Line.Search("Lapa")
client.Line.Search("8000")
// Search by line direction
client.Line.SearchByDirection("Lapa", 1)
// Search by stop name or address
client.Stop.Search("Afonso")
client.Stop.Search("Rua Baltharzar da Veiga")
// Search by line id
client.Stop.SearchByLine(1273)
// Search by corridor id
client.Stop.SearchByCorridor(8)
// All corridors
client.Corridor.All()
// All companies
client.Company.All()
// All Vehicles Position
client.VehiclePosition.All()
// Search by line id
client.VehiclePosition.SearchByLine(1273)
// Search by company id
client.VehiclePosition.SearchByCompany(99)
// Search by stop id and line id
client.Forecast.Search(4200953, 2004)
// Search by line id
client.Forecast.SearchByLine(1273)
// Search by stop id
client.Forecast.SearchByStop(8)
- Clone it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D