1
0
Fork 0
forked from forgejo/forgejo

[REFACTOR] webhook forgejo/gitea endpoints

This commit is contained in:
oliverpool 2024-03-21 13:42:40 +01:00
parent 8dfbbfef07
commit 7e0965b02c
4 changed files with 22 additions and 76 deletions

View file

@ -279,21 +279,6 @@ func (f WebhookForm) ChooseEvents() bool {
return f.Events == "choose_events"
}
// NewWebhookForm form for creating web hook
type NewWebhookForm struct {
PayloadURL string `binding:"Required;ValidUrl"`
HTTPMethod string `binding:"Required;In(POST,GET)"`
ContentType int `binding:"Required"`
Secret string
WebhookForm
}
// Validate validates the fields
func (f *NewWebhookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetValidateContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}
// NewGogshookForm form for creating gogs hook
type NewGogshookForm struct {
PayloadURL string `binding:"Required;ValidUrl"`