go-sptrans

module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: MIT

README

go-sptrans Build Status GoDoc Go Report Card codecov

go-sptrans is a Go client library for the SPTrans Olho Vivo API.

Features
  • Lines
  • Stops
  • Corridors
  • Companies
  • Vehicles Position
  • Forecast

Documentation

See the documentation at godoc.

Install

go get github.com/sergioaugrod/go-sptrans/sptrans

Usage

Import
import "github.com/sergioaugrod/go-sptrans/sptrans"
Authentication
token = "123456"
client = sptrans.NewClient(token)
client.Authenticate()
Endpoints
Lines
// Search by line description or number
client.Line.Search("Lapa")
client.Line.Search("8000")

// Search by line direction
client.Line.SearchByDirection("Lapa", 1)
Stops
// 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)
Corridors
// All corridors
client.Corridor.All()
Companies
// All companies
client.Company.All()
Vehicles Position
// All Vehicles Position
client.VehiclePosition.All()

// Search by line id
client.VehiclePosition.SearchByLine(1273)

// Search by company id
client.VehiclePosition.SearchByCompany(99)
Forecast
// 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)

Contributing

  1. Clone it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License

Directories

Path Synopsis
Package sptrans is a Go client library for the SPTrans Olho Vivo API.
Package sptrans is a Go client library for the SPTrans Olho Vivo API.

Jump to

Keyboard shortcuts

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