add tests for webhook events (#2180)

* add tests for webhook events

* atomic.Uint32 is not in Go 1.18
This commit is contained in:
Matthew Donoughe
2022-10-09 22:55:54 -07:00
committed by GitHub
parent 155d671df0
commit 10055664bb
10 changed files with 596 additions and 12 deletions
+6 -2
View File
@@ -10,14 +10,18 @@ import (
// SendStreamStatusEvent will send all webhook destinations the current stream status.
func SendStreamStatusEvent(eventType models.EventType) {
sendStreamStatusEvent(eventType, shortid.MustGenerate(), time.Now())
}
func sendStreamStatusEvent(eventType models.EventType, id string, timestamp time.Time) {
SendEventToWebhooks(WebhookEvent{
Type: eventType,
EventData: map[string]interface{}{
"id": shortid.MustGenerate(),
"id": id,
"name": data.GetServerName(),
"summary": data.GetServerSummary(),
"streamTitle": data.GetStreamTitle(),
"timestamp": time.Now(),
"timestamp": timestamp,
},
})
}