No description
| .devcontainer | ||
| .editorconfig | ||
| .gitattributes | ||
| alert.go | ||
| client.go | ||
| go.mod | ||
| LICENSE | ||
| README.md | ||
| regions.go | ||
| search.go | ||
go-atalert
go-atalert is a Go client library for accessing the (unofficial) AT-Alert API.
Install
go get git.ntwrk.space/mmaths/go-atalert
Usage
func main() {
ctx := context.Background()
client := atalert.NewClient()
// show all currently active alerts
activeAlerts, err := client.Active(ctx)
if err != nil {
log.Fatal(err)
}
for _, v := range activeAlerts {
fmt.Printf("%+#v\n")
}
// show alerts with a specific level from the last month
search := atalert.NewSearch().
WithLevels(atalert.AlertLevel1, atalert.AlertLevelAmber).
WithDateFrom(time.Now().AddDate(0, -1, 0))
historicAlerts, err := client.Find(ctx, search)
if err != nil {
log.Fatal(err)
}
for _, v := range historicAlerts {
fmt.Printf("%+#v\n")
}
}
License
This library is distributed under the MIT license found in the LICENSE file.