Go client library for accessing the Healthchecks API.
go get github.com/crazy-max/gohealthchecks
package main
import (
"context"
"log"
"net/url"
"github.com/crazy-max/gohealthchecks"
)
func main() {
var err error
// Default client uses https://hc-ping.com/
// client := gohealthchecks.NewClient(nil)
hcBaseURL, err := url.Parse("https://hc.foo.com")
if err != nil {
log.Fatal(err)
}
client := gohealthchecks.NewClient(&gohealthchecks.ClientOptions{
BaseURL: hcBaseURL,
})
err = client.Start(context.Background(), gohealthchecks.PingingOptions{
UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
Logs: "Job started!",
})
if err != nil {
log.Fatal(err)
}
err = client.Success(context.Background(), gohealthchecks.PingingOptions{
UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
Logs: "Job completed!",
})
if err != nil {
log.Fatal(err)
}
err = client.Fail(context.Background(), gohealthchecks.PingingOptions{
UUID: "5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278",
Logs: "Job failed...",
})
if err != nil {
log.Fatal(err)
}
}
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a Paypal donation to ensure this journey continues indefinitely!
Thanks again for your support, it is much appreciated! 🙏
MIT. See LICENSE
for more details.