Skip to content
/ tapd Public

The Go-Tapd-SDK is a Go client library for accessing the Tapd API.

License

Notifications You must be signed in to change notification settings

go-tapd/tapd

Folders and files

NameName
Last commit message
Last commit date
Feb 12, 2025
Jan 2, 2025
Feb 17, 2025
Aug 27, 2024
Dec 3, 2024
Aug 27, 2024
Aug 27, 2024
Dec 31, 2024
Nov 18, 2024
Jan 2, 2025
Mar 15, 2025
Mar 15, 2025
Mar 16, 2025
Mar 16, 2025
Mar 16, 2025
Mar 16, 2025
Nov 18, 2024
Jan 2, 2025
Nov 18, 2024
Jan 2, 2025
Nov 18, 2024
Jan 2, 2025
Nov 18, 2024
Mar 15, 2025
Mar 15, 2025
Mar 15, 2025
Jan 2, 2025
Nov 18, 2024
Jan 2, 2025
Dec 31, 2024
Dec 31, 2024
Nov 18, 2024
Jan 2, 2025
Dec 30, 2024
Jan 2, 2025
Nov 18, 2024
Dec 30, 2024
Aug 29, 2024
Dec 15, 2024
Aug 30, 2024
Aug 27, 2024
Mar 15, 2025
Feb 5, 2025
Feb 5, 2025
Aug 27, 2024
Aug 27, 2024
Dec 15, 2024
Aug 30, 2024
Aug 28, 2024
Aug 28, 2024

Repository files navigation

πŸš€ Go-Tapd-SDK

Supported Go Versions Package Version GoDoc codecov Go Report Card lint tests MIT license

The Go-Tapd-SDK is a Go client library for accessing the Tapd API.

Warning

This is currently still a non-stable version, is not recommended for production use.

If you encounter any issues, you are welcome to submit an issue.

πŸ“₯ Installation

go get github.com/go-tapd/tapd

✨ Features

see features.md

πŸ”§ Usage

API Service

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)
}

Webhook Server Example

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)
}

πŸ“œ License

The MIT License (MIT). Please see License File for more information.