The Go-Tapd-SDK is a Go client library for accessing the Tapd API.
If you encounter any issues, you are welcome to submit an issue.
go get github.com/go-tapd/tapd
see features.md
package main
import (
"context"
"log"
"github.com/go-tapd/tapd"
)
func main() {
client, err := tapd.NewClient("username", "password")
if err != nil {
log.Fatal(err)
}
// example: get labels
labels, _, err := client.LabelService.GetLabels(context.Background(), &tapd.GetLabelsRequest{
WorkspaceID: tapd.Ptr(123456),
})
if err != nil {
log.Fatal(err)
}
log.Printf("labels: %+v", labels)
}
package main
import (
"context"
"log"
"net/http"
"github.com/go-tapd/tapd/webhook"
)
type StoreUpdateListener struct{}
func (l *StoreUpdateListener) OnStoryUpdate(ctx context.Context, event *webhook.StoryUpdateEvent) error {
log.Printf("StoreUpdateListener: %+v", event)
return nil
}
func main() {
dispatcher := webhook.NewDispatcher(
webhook.WithRegisters(&StoreUpdateListener{}),
)
dispatcher.Registers(&StoreUpdateListener{})
srv := http.NewServeMux()
srv.HandleFunc("/webhook", func(w http.ResponseWriter, r *http.Request) {
log.Println("Received webhook request")
if err := dispatcher.DispatchRequest(r); err != nil {
log.Println(err)
}
w.Write([]byte("ok"))
})
http.ListenAndServe(":8080", srv)
}
The MIT License (MIT). Please see License File for more information.