Documentation
¶
Index ¶
- func RegisterHTTPHandlers(db *pgxpool.Pool, validate *validation.Validator, tkn *jwt.Service, ...) http.Handler
- type Handler
- func (h *Handler) CreateWebhook(res http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteWebhook(res http.ResponseWriter, r *http.Request)
- func (h *Handler) GetWebhook(res http.ResponseWriter, r *http.Request)
- func (h *Handler) GetWebhooks(res http.ResponseWriter, r *http.Request)
- func (h *Handler) TestWebhook(res http.ResponseWriter, r *http.Request)
- func (h *Handler) UpdateWebhook(res http.ResponseWriter, r *http.Request)
- type Repository
- type WebhookRequest
- type WebhookUpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
type Repository interface { GetWebhooks(ctx context.Context, userID uuid.UUID) ([]repository.WebhookSubscription, error) GetWebhook(ctx context.Context, id uuid.UUID) (repository.WebhookSubscription, error) CreateWebhook(ctx context.Context, params repository.CreateWebhookSubscriptionParams) (repository.WebhookSubscription, error) UpdateWebhook(ctx context.Context, params repository.UpdateWebhookSubscriptionParams) (repository.WebhookSubscription, error) DeleteWebhook(ctx context.Context, params repository.DeleteWebhookSubscriptionParams) error }
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"` }
Click to show internal directories.
Click to hide internal directories.