A Go client library for the Honeybadger API.
go get github.com/honeybadger-io/api-gopackage main
import (
"context"
"fmt"
"log"
hbapi "github.com/honeybadger-io/api-go"
)
func main() {
// Create a new client
client := hbapi.NewClient().
WithAuthToken("your-api-token")
// List all projects
projects, err := client.Projects.ListAll(context.Background())
if err != nil {
log.Fatal(err)
}
for _, project := range projects.Results {
fmt.Printf("Project: %s (ID: %d)\n", project.Name, project.ID)
}
// List faults for a project
faults, err := client.Faults.List(context.Background(), projectID, hbapi.FaultListOptions{
Order: "recent",
Limit: 10,
})
if err != nil {
log.Fatal(err)
}
for _, fault := range faults.Results {
fmt.Printf("Fault: %s - %s\n", fault.Klass, fault.Message)
}
}- Automatic pagination support
- Type-safe API responses
- Context support for cancellation and timeouts
For more information about the Honeybadger API, see the official documentation.
Run the tests:
go test ./...- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add my amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.