/
wsmessage.go
54 lines (43 loc) · 1.16 KB
/
wsmessage.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
package ws
import (
"time"
"github.com/spf13/cobra"
"github.com/iotexproject/iotex-core/ioctl/config"
)
var (
// wsMessage represents the w3bstream message command
wsMessage = &cobra.Command{
Use: "message",
Short: config.TranslateInLang(wsMessageShorts, config.UILanguage),
}
// wsMessageShorts w3bstream message shorts multi-lang support
wsMessageShorts = map[config.Language]string{
config.English: "w3bstream message operations",
config.Chinese: "w3bstream消息操作",
}
_flagDIDVCTokenUsages = map[config.Language]string{
config.English: "DID VC token",
config.Chinese: "DID VC 令牌",
}
)
func init() {
wsMessage.AddCommand(wsMessageSend)
wsMessage.AddCommand(wsMessageQuery)
}
type sendMessageReq struct {
ProjectID uint64 `json:"projectID"`
ProjectVersion string `json:"projectVersion"`
Data string `json:"data"`
}
type sendMessageRsp struct {
MessageID string `json:"messageID"`
}
type stateLog struct {
State string `json:"state"`
Time time.Time `json:"time"`
Comment string `json:"comment"`
}
type queryMessageRsp struct {
MessageID string `json:"messageID"`
States []*stateLog `json:"states"`
}