Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-16T22:40:59.000Z (over 4 years ago)
- Last Synced: 2024-08-03T15:06:06.260Z (5 months ago)
- Topics: golang, sptrans
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - go-sptrans - Go client library for the SPTrans Olho Vivo API. - ★ 5 (Third-party APIs)
- awesome-go-extra - go-sptrans - 09-11T01:21:28Z|2020-09-16T22:40:59Z| (Third-party APIs / Fail injection)
README
# go-sptrans [![Build Status](https://travis-ci.org/sergioaugrod/go-sptrans.svg?branch=master)](https://travis-ci.org/sergioaugrod/go-sptrans) [![GoDoc](https://godoc.org/github.com/sergioaugrod/go-sptrans?status.png)](https://godoc.org/github.com/sergioaugrod/go-sptrans) [![Go Report Card](https://goreportcard.com/badge/github.com/sergioaugrod/go-sptrans)](https://goreportcard.com/report/github.com/sergioaugrod/go-sptrans) [![codecov](https://codecov.io/gh/sergioaugrod/go-sptrans/branch/master/graph/badge.svg)](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)