-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
112 lines (92 loc) · 2.62 KB
/
types.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package main
import "encoding/json"
const (
NewChatMessageAction uint8 = 1
ChangeUsernameAction uint8 = 2
RequestUserInfoAction uint8 = 3
GetChatMessagesAction uint8 = 4
UpdateMyUserInfoAction uint8 = 5
GetAllUsersAction uint8 = 6
JoinCallAction uint8 = 7
GetMySettingsAction uint8 = 8
UpdateMySettingsAction uint8 = 9
EditChatMessageAction uint8 = 10
)
const (
OfflinePresence uint8 = 1
OnlinePresence uint8 = 2
AwayPresence uint8 = 3
InCallPresence uint8 = 3
)
type IncomingMessage struct {
SessionToken string `json:"sessionToken"`
}
type Message struct {
UserId string `json:"userId"`
Action uint8 `json:"action"`
Data json.RawMessage `json:"data"`
}
type User struct {
// Can be changed by UpdateMyUserInfoAction
Presence uint8 `json:"presence"`
Status string `json:"status"`
Icon string `json:"icon"`
BannerUrl string `json:"bannerUrl"`
UsernameColor string `json:"usernameColor"`
// Can be changed by ChangeUsernameAction
Username string `json:"username"`
// Controlled by server
ChangedUsername bool `json:"changedUsername"`
IsDeveloper bool `json:"isDeveloper"`
}
type ChatMessage struct {
Content string `json:"content"`
Timestamp int64 `json:"timestamp"`
EditForTimestamp int64 `json:"editForTimestamp"`
ReplyToUserId *string `json:"replyToUserId"`
ReplyTo json.RawMessage `json:"replyTo"`
}
type NewChatMessage struct {
ChatId string `json:"chatId"`
Data ChatMessage `json:"data"`
}
type EditChatMessage struct {
ChatId string `json:"chatId"`
Start int64 `json:"start"`
Total int `json:"total"`
Data ChatMessage `json:"data"`
}
type ChangeUsername struct {
Username string `json:"username"`
}
type RequestUserInfo struct {
UserId string `json:"userId"`
User json.RawMessage `json:"user"`
}
type GetChatMessages struct {
ChatId string `json:"chatId"`
Start *int64 `json:"start"`
Total *int `json:"total"`
Messages json.RawMessage `json:"messages"`
}
type GetAllUsers struct {
Users map[string]json.RawMessage `json:"users"`
}
type JoinCall struct {
PeerId string `json:"peerId"`
}
type MyAudioSettings struct {
EchoCancellation bool `json:"echoCancellation"`
NoiseSuppression bool `json:"noiseSuppression"`
AutoGainControl bool `json:"autoGainControl"`
}
type MySettings struct {
AudioSettings MyAudioSettings `json:"audioSettings"`
}
type Peer struct {
UserId string `json:"userId"`
PeerId string `json:"peerId"`
}
type AllPeers struct {
Peers []Peer `json:"peer"`
}