Documentation ¶
Overview ¶
Package sptrans is a Go client library for the SPTrans Olho Vivo API.
Authentication:
token = "123456" client = sptrans.NewClient(token) client.Authenticate()
Search Route by description or number:
client.Route.Search("Lapa") client.Route.Search("8000")
Search Route by direction:
client.Route.SearchByDirection("Lapa", 1) client.Route.SearchByDirection("Lapa", 2)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a SPTrans client for making Olho Vivo API requests
func (*Client) Authenticate ¶
Authenticate authenticates according to client token
type Route ¶
type Route struct { Cl int64 `json:"cl"` Lc bool `json:"lc"` Lt string `json:"lt"` Sl int64 `json:"sl"` Tl int64 `json:"tl"` Tp string `json:"tp"` Ts string `json:"ts"` }
Route structure, see documentation on http://www.sptrans.com.br/desenvolvedores/APIOlhoVivo/Documentacao.aspx?1#docApi-linhas
type RouteService ¶
type RouteService service
RouteService provide functions to request routes endpoints
func (*RouteService) Search ¶
func (r *RouteService) Search(filter string) ([]*Route, error)
Search performs a search of the bus lines based on the parameter informed (description or line number)
func (*RouteService) SearchByDirection ¶
func (r *RouteService) SearchByDirection(filter string, direction int) ([]*Route, error)
SearchByDirection performs a search of the bus lines based on the parameter informed (description or direction)