webhooks

package
v0.0.1-0...-104a2d1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHTTPHandlers

func RegisterHTTPHandlers(db *pgxpool.Pool, validate *validation.Validator, tkn *jwt.Service, logger *zerolog.Logger) http.Handler

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(validator *validation.Validator, repo Repository, logger *zerolog.Logger) *Handler

func (*Handler) CreateWebhook

func (h *Handler) CreateWebhook(res http.ResponseWriter, r *http.Request)

func (*Handler) DeleteWebhook

func (h *Handler) DeleteWebhook(res http.ResponseWriter, r *http.Request)

DeleteWebhook deletes a webhook by ID

func (*Handler) GetWebhook

func (h *Handler) GetWebhook(res http.ResponseWriter, r *http.Request)

func (*Handler) GetWebhooks

func (h *Handler) GetWebhooks(res http.ResponseWriter, r *http.Request)

func (*Handler) TestWebhook

func (h *Handler) TestWebhook(res http.ResponseWriter, r *http.Request)

TestWebhook triggers a test event for a webhook

func (*Handler) UpdateWebhook

func (h *Handler) UpdateWebhook(res http.ResponseWriter, r *http.Request)

UpdateWebhook updates an existing webhook

type Repository

Repository defines the interface for webhook data operations

func NewRepository

func NewRepository(queries *repository.Queries) Repository

NewRepository creates a new webhook repository

type WebhookRequest

type WebhookRequest struct {
	Name        string   `json:"name" validate:"required,min=1,max=100"`
	URL         string   `json:"url" validate:"required,url"`
	Description string   `json:"description" validate:"max=500"`
	Events      []string `json:"events" validate:"required,min=1,dive,oneof=create update delete"`
	Secret      string   `json:"secret" validate:"required,min=8"`
}

type WebhookUpdateRequest

type WebhookUpdateRequest struct {
	Name        *string  `json:"name" validate:"required,min=1,max=100"`
	URL         *string  `json:"url" validate:"required,url"`
	Description *string  `json:"description" validate:"max=500"`
	Events      []string `json:"events" validate:"required,min=1,dive,oneof=create update delete"`
	Active      *bool    `json:"active"`
}

Jump to

Keyboard shortcuts

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