-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
38 lines (33 loc) · 1.02 KB
/
models.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
package main
// Message represents the top-level structure of the JSON input.
type Message struct {
Event string `json:"event"`
Data string `json:"data"`
Channel string `json:"channel"`
}
// Data represents the structure of the `data` JSON string.
type Data struct {
//ID string `json:"id"` //rarely received number
ChatroomID int `json:"chatroom_id"`
Content string `json:"content"`
Type string `json:"type"`
CreatedAt string `json:"created_at"`
Sender Sender `json:"sender"`
}
// Sender represents the nested `sender` structure in `Data`.
type Sender struct {
ID int `json:"id"`
Username string `json:"username"`
Slug string `json:"slug"`
//Identity Identity `json:"identity"`
}
// Identity represents the nested `identity` structure in `Sender`.
type Identity struct {
Color string `json:"color"`
Badges []Badge `json:"badges"`
}
// Badge represents the elements in the `badges` array in `Identity`.
type Badge struct {
Type string `json:"type"`
Text string `json:"text"`
}