https://github.com/pnelson/moves
Moves API client in Go.
https://github.com/pnelson/moves
Last synced: 6 months ago
JSON representation
Moves API client in Go.
- Host: GitHub
- URL: https://github.com/pnelson/moves
- Owner: pnelson
- License: other
- Created: 2014-07-20T01:51:42.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-03T02:09:27.000Z (over 10 years ago)
- Last Synced: 2025-10-13T05:13:03.338Z (9 months ago)
- Language: Go
- Homepage: https://godoc.org/github.com/pnelson/moves
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
moves
=====
Package moves implements a [Moves][1] API client in Go.
Usage
-----
Already have an access token?
```go
api := moves.New(token)
summary, err := api.Storyline("2014-07-20")
```
Need a token or just want more control?
```go
t := &moves.Transport{
Key: os.Getenv("MOVES_CLIENT_ID"),
Secret: os.Getenv("MOVES_CLIENT_SECRET"),
TokenCache: moves.CacheFile("token_cache"),
}
fmt.Println("Enter the following URL in your browser.")
fmt.Println(t.AuthCodeURL("foo"))
var code string
fmt.Println("Follow the instructions in the browser.")
fmt.Println("When your browser redirects, grab the code from the query string.")
fmt.Printf("Paste the code here: ")
fmt.Scanf("%s", &code)
token, err := t.Exchange(code)
if err != nil {
log.Fatal(err)
}
api := t.Client()
storyline, err := api.Storyline("2014-07-20")
if err != nil {
log.Fatal(err)
}
fmt.Println(token)
fmt.Println(storyline)
```
For usage information, see the [package documentation][2] or
the [API documentation][3].
You can generate a new client id and secret through the Moves developer
dashboard by creating a new app. Additionally, the app must be configured
with at least the first *Redirect URI* field filled out. For development
purposes, I usually use `http://localhost:3000`.
Disclaimer
----------
This package uses data from Moves but is not endorsed or certified by Moves.
Moves is a trademark of ProtoGeo Oy.
License
-------
Copyright (c) 2016 by Philip Nelson. See [LICENSE][4] for details.
[1]: https://moves-app.com
[2]: https://godoc.org/github.com/pnelson/moves
[3]: https://dev.moves-app.com/
[4]: https://github.com/pnelson/moves/blob/master/LICENSE