[REFACTOR] webhook.Handler interface

This commit is contained in:
oliverpool 2024-03-20 15:44:01 +01:00
parent 142459bbe0
commit 702152bfde
35 changed files with 378 additions and 210 deletions

View file

@ -17,6 +17,11 @@ import (
webhook_module "code.gitea.io/gitea/modules/webhook"
)
type msteamsHandler struct{}
func (msteamsHandler) Type() webhook_module.HookType { return webhook_module.MSTEAMS }
func (msteamsHandler) Metadata(*webhook_model.Webhook) any { return nil }
type (
// MSTeamsFact for Fact Structure
MSTeamsFact struct {
@ -347,6 +352,6 @@ type msteamsConvertor struct{}
var _ payloadConvertor[MSTeamsPayload] = msteamsConvertor{}
func newMSTeamsRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) {
func (msteamsHandler) NewRequest(ctx context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) {
return newJSONRequest(msteamsConvertor{}, w, t, true)
}