1
0

feat(webhooks): add route to get all available webhook events

This commit is contained in:
kolaente
2023-09-14 12:21:20 +02:00
parent eb1b9247ad
commit 96ccf6b923
3 changed files with 40 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import (
"code.vikunja.io/api/pkg/events"
"code.vikunja.io/api/pkg/user"
"code.vikunja.io/web"
"sort"
"sync"
"time"
"xorm.io/xorm"
@ -71,6 +72,17 @@ func RegisterEventForWebhook(event WebhookEvent) {
})
}
func GetAvailableWebhookEvents() []string {
evts := []string{}
for e := range availableWebhookEvents {
evts = append(evts, e)
}
sort.Strings(evts)
return evts
}
func (w *Webhook) Create(s *xorm.Session, a web.Auth) (err error) {
// TODO: check valid webhook events
w.CreatedByID = a.GetID()