https://github.com/mdp/go-statx
Simple CLI and library for StatX API
https://github.com/mdp/go-statx
Last synced: 6 months ago
JSON representation
Simple CLI and library for StatX API
- Host: GitHub
- URL: https://github.com/mdp/go-statx
- Owner: mdp
- License: mit
- Created: 2016-09-29T13:55:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-08T00:34:00.000Z (over 9 years ago)
- Last Synced: 2025-01-23T12:14:52.265Z (over 1 year ago)
- Language: Go
- Size: 23.4 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-statx
## Installation
### The CLI
`go get -u github.com/mdp/go-statx/...`
### Just the library
`go get -u github.com/mdp/go-statx`
## Usage
### CLI
`statx login +14158675309`
Enter verification code from StatX and if successful you will receive API keys
Get a list of groups
`statx --apikey 12345abcdef --authtoken yourauthtoken list`
Get a list of Stats in a group
`statx --apikey 12345abcdef --authtoken yourauthtoken list --group groupid`
Update the value of a Stat
`statx --apikey 12345abcdef --authtoken yourauthtoken update --group groupid --stat statid --value 47`
### Library
```go
client := statx.NewAuthenticatedClient(nil, "apikey", "authtoken")
statList, _, err := client.Stats.List("GroupID")
# Update a stat
stat := &statx.Stat{Value: "47"}
updatedStat, _, err := client.Stats.Update("GroupID", statList[0].ID, stat)
```