No description
Find a file
2025-01-16 13:37:54 +01:00
.devcontainer add devcontainer 2025-01-16 12:54:12 +01:00
.editorconfig add .editorconfig 2024-10-05 01:28:59 +02:00
.gitattributes update .gitattributes 2025-01-16 12:54:23 +01:00
alert.go documentation 2024-10-06 14:53:49 +02:00
client.go cleanup 2025-01-16 13:15:29 +01:00
go.mod use pure net/http 2024-10-05 17:06:15 +02:00
LICENSE add LICENSE 2024-10-05 00:16:46 +02:00
README.md update README.md 2024-10-12 10:36:45 +02:00
regions.go fix region names 2025-01-16 13:37:54 +01:00
search.go cleanup 2025-01-16 13:15:29 +01:00

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.