Go client for the Ambientweather service.
-
Generate an app and API key from your account
-
Use the API:
package main
import (
"fmt"
"log"
"net/http"
ambient "github.com/transcelestial/ambientweather"
)
func main() {
key := ambient.NewKey("appkey", "apikey")
devices, err := ambient.GetDevice(key)
if err != nil {
log.Fatal(err)
}
if devices.HTTPResponseCode == http.StatusOK {
for _, dev := range devices.DeviceRecords {
fmt.Println(dev)
}
}
}
To run tests run:
go test .
To avoid caching during tests use:
go test -count=1 .
To get coverage reports use the -cover
flag:
go test -coverprofile=coverage.out .
And to view the profile run:
go tool cover -html=coverage.out
To run static analysis on the code run:
go vet .
If you wish to contribute, please use the following guidelines:
- Use conventional commits
- Use effective Go