-
Notifications
You must be signed in to change notification settings - Fork 5
/
webhookstypes.go
69 lines (58 loc) · 1.8 KB
/
webhookstypes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import (
"time"
)
type EventType = string
const (
MessageSent EventType = "CHAT"
UserJoined EventType = "USER_JOINED"
UserNameChanged EventType = "NAME_CHANGE"
StreamStarted EventType = "STREAM_STARTED"
StreamStopped EventType = "STREAM_STOPPED"
)
type User struct {
Id string `json:"id"`
AccessToken string `json:"-"`
DisplayName string `json:"displayName"`
DisplayColor int `json:"displayColor"`
CreatedAt time.Time `json:"createdAt"`
DisabledAt time.Time `json:"disabledAt,omitempty"`
PreviousNames []string `json:"previousNames"`
NameChangedAt time.Time `json:"nameChangedAt,omitempty"`
}
type ChatMessage struct {
User User `json:"user,omitempty"`
Body string `json:"body,omitempty"`
ClientId uint `json:"clientId"`
RawBody string `json:"rawBody,omitempty"`
ID string `json:"id,omitempty"`
Visible bool `json:"visible"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
type StreamEvent struct {
Summary string `json:"summary"`
Name string `json:"name"`
StreamTitle string `json:"streamTitle"`
}
type WebhookEvent struct {
Type EventType `json:"type"`
EventData interface{} `json:"eventData,omitempty"`
}
type WebhookChatEvent struct {
Type EventType `json:"type"`
EventData ChatMessage `json:"eventData,omitempty"`
}
type WebhookStreamStartStopEvent struct {
Type EventType `json:"type"`
EventData StreamEvent `json:"eventData,omitempty"`
}
type NameChangeEvent struct {
Id string `json:"id"`
Timestamp time.Time `json:"timestamp"`
User User `json:"user"`
ClientId uint `json:"clientId"`
}
type NameChangeWebhookEvent struct {
Type EventType `json:"type"`
EventData NameChangeEvent `json:"eventData,omitempty"`
}