Documentation
¶
Index ¶
- type Handler
- func (h *Handler) Create(c *echo.Context) error
- func (h *Handler) Delete(c *echo.Context) error
- func (h *Handler) List(c *echo.Context) error
- func (h *Handler) SetDispatcher(d TestDispatcher)
- func (h *Handler) Show(c *echo.Context) error
- func (h *Handler) Test(c *echo.Context) error
- func (h *Handler) Update(c *echo.Context) error
- type TestDispatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles i/webhooks/* endpoints.
func NewHandler ¶
func NewHandler(repo repository.WebhookRepository, idGen id.Generator, rolePolicyProvider role.PolicyProvider) *Handler
NewHandler creates a new webhooks handler. rolePolicyProvider is the role policy source Create uses to enforce the `webhookLimit` role policy (#1029).
func (*Handler) SetDispatcher ¶
func (h *Handler) SetDispatcher(d TestDispatcher)
SetDispatcher wires a TestDispatcher so that /api/i/webhooks/test can fire a synthetic test payload through the production pipeline.
func (*Handler) Test ¶
Test handles POST /api/i/webhooks/test. 本家互換: req.type で指定されたイベント種別のテストペイロードを dispatcher に渡し、通常の配信パイプラインを通して登録済み webhook に送信する。
upstream Misskey TS の paramDef は webhookId + type を required + type に webhookEventTypes enum check を強制している (packages/backend/src/.../i/ webhooks/test.ts、#937)。
type TestDispatcher ¶
type TestDispatcher interface {
DispatchUserTest(webhookID, userID, eventType string, body any, overrideURL, overrideSecret string)
}
TestDispatcher is the minimal interface the Test endpoint uses to enqueue a synthetic webhook payload. 循環依存を避けるため interface で受ける (実装は core/webhook.Service 経由)。DispatchUserTest は指定 webhook 1 件だけに 送り、overrideURL/Secret 非空時は保存済 webhook でなくそちらへ送る (#1546)。