forked from livechat/go-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
typedef.go
44 lines (35 loc) · 849 Bytes
/
typedef.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
package main
import "encoding/json"
type request struct {
Action string `json:"action"`
Payload interface{}
RawPayload json.RawMessage `json:"payload"`
}
type response struct {
Action string `json:"action"`
Success bool `json:"success"`
Payload interface{} `json:"payload,omitempty"`
Error string `json:"error,omitempty"`
}
type push struct {
Action string `json:"action"`
Payload interface{} `json:"payload"`
}
type requestLogin struct {
Name string `json:"name"`
Avatar string `json:"avatar"`
}
type requestBroadcast struct {
Text string `json:"text"`
}
type pushMessage struct {
Author string `json:"author"`
Text string `json:"text"`
}
type pushUsers struct {
List []*userDetails `json:"list"`
}
type userDetails struct {
Name string `json:"name"`
Avatar string `json:"avatar"`
}