https://github.com/sergioaugrod/go-sptrans
Go client library for the SPTrans Olho Vivo API. :bus:
https://github.com/sergioaugrod/go-sptrans
golang sptrans
Last synced: 11 months ago
JSON representation
Go client library for the SPTrans Olho Vivo API. :bus:
- Host: GitHub
- URL: https://github.com/sergioaugrod/go-sptrans
- Owner: sergioaugrod
- License: mit
- Created: 2017-09-11T01:21:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-16T22:40:59.000Z (over 5 years ago)
- Last Synced: 2025-04-02T04:03:30.641Z (11 months ago)
- Topics: golang, sptrans
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - go-sptrans - | - | - | (Third-party APIs / HTTP Clients)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / Utility/Miscellaneous)
- awesome-go-cn - go-sptrans
- awesome-go-extra - go-sptrans - 09-11T01:21:28Z|2020-09-16T22:40:59Z| (Third-party APIs / Fail injection)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / Utility/Miscellaneous)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. - ★ 5 (Third-party APIs)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / Advanced Console UIs)
- awesome-go-cn - go-sptrans
- go-awesome-with-star-updatetime - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / HTTP Clients)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / HTTP Clients)
- awesome-Char - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / HTTP Clients)
- awesome-go-cn - go-sptrans - sptrans) [![godoc][D]](https://godoc.org/github.com/sergioaugrod/go-sptrans) (第三方api / 实用程序/Miscellaneous)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / Utility/Miscellaneous)
- awesome-go-processed - go-sptrans - Go client library for the SPTrans Olho Vivo API.| (Third-party APIs / Advanced Console UIs)
- awesome-go-zh - go-sptrans
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / HTTP Clients)
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (Third-party APIs / Utility/Miscellaneous)
- awesome-go-info - go-sptrans
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. (<span id="第三方api-third-party-apis">第三方API Third-party APIs</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
README
# go-sptrans [](https://travis-ci.org/sergioaugrod/go-sptrans) [](https://godoc.org/github.com/sergioaugrod/go-sptrans) [](https://goreportcard.com/report/github.com/sergioaugrod/go-sptrans) [](https://codecov.io/gh/sergioaugrod/go-sptrans)
**This project is no longer maintained.**
go-sptrans is a Go client library for the [SPTrans Olho Vivo API](http://www.sptrans.com.br/desenvolvedores/APIOlhoVivo.aspx).
### Features
- [x] Lines
- [x] Stops
- [x] Corridors
- [x] Companies
- [x] Vehicles Position
- [x] Forecast
## Documentation
See the documentation at [godoc](https://godoc.org/github.com/sergioaugrod/go-sptrans).
## Install
go get github.com/sergioaugrod/go-sptrans/sptrans
## Usage
### Import
```go
import "github.com/sergioaugrod/go-sptrans/sptrans"
```
### Authentication
```go
token = "123456"
client = sptrans.NewClient(token)
client.Authenticate()
```
### Endpoints
#### Lines
```go
// Search by line description or number
client.Line.Search("Lapa")
client.Line.Search("8000")
// Search by line direction
client.Line.SearchByDirection("Lapa", 1)
```
#### Stops
```go
// 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
```go
// All corridors
client.Corridor.All()
```
#### Companies
```go
// All companies
client.Company.All()
```
#### Vehicles Position
```go
// All Vehicles Position
client.VehiclePosition.All()
// Search by line id
client.VehiclePosition.SearchByLine(1273)
// Search by company id
client.VehiclePosition.SearchByCompany(99)
```
#### Forecast
```go
// 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](LICENSE)