1
0
Fork 0
forked from forgejo/forgejo

[REFACTOR] webhook msteams endpoint

This commit is contained in:
oliverpool 2024-03-21 14:01:02 +01:00
parent 46b71ec709
commit 97f0ad49ff
4 changed files with 15 additions and 36 deletions

View file

@ -15,6 +15,7 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
webhook_module "code.gitea.io/gitea/modules/webhook"
"code.gitea.io/gitea/services/forms"
)
type msteamsHandler struct{}
@ -23,7 +24,20 @@ func (msteamsHandler) Type() webhook_module.HookType { return webhook_modu
func (msteamsHandler) Metadata(*webhook_model.Webhook) any { return nil }
func (msteamsHandler) FormFields(bind func(any)) FormFields {
panic("TODO")
var form struct {
forms.WebhookForm
PayloadURL string `binding:"Required;ValidUrl"`
}
bind(&form)
return FormFields{
WebhookForm: form.WebhookForm,
URL: form.PayloadURL,
ContentType: webhook_model.ContentTypeJSON,
Secret: "",
HTTPMethod: http.MethodPost,
Metadata: nil,
}
}
type (