1package store23import (4 "context"56 "github.com/charmbracelet/soft-serve/pkg/db"7 "github.com/charmbracelet/soft-serve/pkg/db/models"8 "github.com/google/uuid"9)1011// WebhookStore is an interface for managing webhooks.12type WebhookStore interface {13 // GetWebhookByID returns a webhook by its ID.14 GetWebhookByID(ctx context.Context, h db.Handler, repoID int64, id int64) (models.Webhook, error)15 // GetWebhooksByRepoID returns all webhooks for a repository.16 GetWebhooksByRepoID(ctx context.Context, h db.Handler, repoID int64) ([]models.Webhook, error)17 // GetWebhooksByRepoIDWhereEvent returns all webhooks for a repository where event is in the events.18 GetWebhooksByRepoIDWhereEvent(ctx context.Context, h db.Handler, repoID int64, events []int) ([]models.Webhook, error)19 // CreateWebhook creates a webhook.20 CreateWebhook(ctx context.Context, h db.Handler, repoID int64, url string, secret string, contentType int, active bool) (int64, error)21 // UpdateWebhookByID updates a webhook by its ID.22 UpdateWebhookByID(ctx context.Context, h db.Handler, repoID int64, id int64, url string, secret string, contentType int, active bool) error23 // DeleteWebhookByID deletes a webhook by its ID.24 DeleteWebhookByID(ctx context.Context, h db.Handler, id int64) error25 // DeleteWebhookForRepoByID deletes a webhook for a repository by its ID.26 DeleteWebhookForRepoByID(ctx context.Context, h db.Handler, repoID int64, id int64) error2728 // GetWebhookEventByID returns a webhook event by its ID.29 GetWebhookEventByID(ctx context.Context, h db.Handler, id int64) (models.WebhookEvent, error)30 // GetWebhookEventsByWebhookID returns all webhook events for a webhook.31 GetWebhookEventsByWebhookID(ctx context.Context, h db.Handler, webhookID int64) ([]models.WebhookEvent, error)32 // CreateWebhookEvents creates webhook events for a webhook.33 CreateWebhookEvents(ctx context.Context, h db.Handler, webhookID int64, events []int) error34 // DeleteWebhookEventsByWebhookID deletes all webhook events for a webhook.35 DeleteWebhookEventsByID(ctx context.Context, h db.Handler, ids []int64) error3637 // GetWebhookDeliveryByID returns a webhook delivery by its ID.38 GetWebhookDeliveryByID(ctx context.Context, h db.Handler, webhookID int64, id uuid.UUID) (models.WebhookDelivery, error)39 // GetWebhookDeliveriesByWebhookID returns all webhook deliveries for a webhook.40 GetWebhookDeliveriesByWebhookID(ctx context.Context, h db.Handler, webhookID int64) ([]models.WebhookDelivery, error)41 // ListWebhookDeliveriesByWebhookID returns all webhook deliveries for a webhook.42 // This only returns the delivery ID, response status, and event.43 ListWebhookDeliveriesByWebhookID(ctx context.Context, h db.Handler, webhookID int64) ([]models.WebhookDelivery, error)44 // CreateWebhookDelivery creates a webhook delivery.45 CreateWebhookDelivery(ctx context.Context, h db.Handler, id uuid.UUID, webhookID int64, event int, url string, method string, requestError error, requestHeaders string, requestBody string, responseStatus int, responseHeaders string, responseBody string) error46 // DeleteWebhookDeliveryByID deletes a webhook delivery by its ID.47 DeleteWebhookDeliveryByID(ctx context.Context, h db.Handler, webhookID int64, id uuid.UUID) error48}