endpoints

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWorkspaceLimit = 10
	MaxURLLength          = 2048
)

Variables

View Source
var (
	ErrWorkspaceRequired = workspace.ErrRequired
	ErrInvalidURL        = errors.New("goncho: invalid webhook url")
	ErrLimitReached      = errors.New("goncho: maximum webhook endpoints reached for workspace")
	ErrNotFound          = errors.New("goncho: webhook endpoint not found")
)

Functions

func Delete

func Delete(ctx context.Context, db *sql.DB, defaultWorkspaceID, workspaceID, endpointID string) error

func EnsureTable

func EnsureTable(ctx context.Context, db *sql.DB) error

func NormalizeURL

func NormalizeURL(raw string) (string, error)

Types

type CreateParams

type CreateParams struct {
	WorkspaceID string
	URL         string
	Limit       int
	Now         time.Time
}

CreateParams carries endpoint creation inputs at the storage boundary.

type CreateResult

type CreateResult struct {
	Endpoint Endpoint `json:"endpoint"`
	Created  bool     `json:"created"`
}

CreateResult reports whether endpoint creation inserted a new row or reused an existing row.

func GetOrCreate

func GetOrCreate(ctx context.Context, db *sql.DB, defaultWorkspaceID string, params CreateParams) (CreateResult, error)

type Endpoint

type Endpoint struct {
	ID          string    `json:"id"`
	WorkspaceID string    `json:"workspace_id"`
	URL         string    `json:"url"`
	CreatedAt   time.Time `json:"created_at"`
}

Endpoint is a registered webhook destination.

func List

func List(ctx context.Context, db *sql.DB, defaultWorkspaceID, workspaceID string) ([]Endpoint, error)

func Scan

func Scan(row Scanner) (Endpoint, error)

type Scanner

type Scanner interface {
	Scan(...any) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL