/
data.go
89 lines (73 loc) 路 2.25 KB
/
data.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
package gui
type MsgOptions struct {
Message string `json:"message,omitempty"`
As string `json:"as,omitempty"`
WithTitle string `json:"withTitle,omitempty"`
Buttons []string `json:"buttons,omitempty"`
CancelButton int `json:"cancelButton,omitempty"`
DefaultButton int `json:"defaultButton,omitempty"`
}
type MsgData struct {
Operation string
Text string
WithIcon string
Opts MsgOptions `json:"opts"`
}
type EntryOpts struct {
MsgOptions
DefaultAnswer string `json:"defaultAnswer"`
HiddenAnswer bool `json:"hiddenAnswer,omitempty"`
}
// Note: Adding member -> Check `NewFromEntry`.
type EntryData struct {
Operation string
Text string
WithIcon string
Opts EntryOpts `json:"opts"`
}
// Create new entry data from message data.
func NewFromEntry(m *MsgData) EntryData {
return EntryData{
Operation: m.Operation,
Text: m.Text,
WithIcon: m.WithIcon,
Opts: EntryOpts{MsgOptions: m.Opts},
}
}
type OptionsOpts struct {
WithTitle string `json:"withTitle,omitempty"`
WithPrompt string `json:"withPrompt,omitempty"`
DefaultItems []string `json:"defaultItems,omitempty"`
OkButtonName string `json:"okButtonName,omitempty"`
CancelButtonName string `json:"cancelButtonName,omitempty"`
MultipleSelectionAllowed bool `json:"multipleSelectionsAllowed,omitempty"`
EmptySelectionAllowed bool `json:"emptySelectionAllowed,omitempty"`
}
type OptionsData struct {
Operation string
Separator string
Items []string
Opts OptionsOpts
}
type FileOpts struct {
WithPrompt string `json:"withPrompt,omitempty"`
OfType []string `json:"ofType,omitempty"`
DefaultName string `json:"defaultName,omitempty"`
DefaultLocation string `json:"defaultLocation,omitempty"`
Invisibles bool `json:"invisibles,omitempty"`
Multiple bool `json:"multipleSelectionsAllowed,omitempty"`
ShowPackages bool `json:"showPackageContents,omitempty"`
}
type FileData struct {
Operation string
Separator string
Opts FileOpts
}
type NotifyOpts struct {
WithTitle string `json:"withTitle"`
Subtitle string `json:"subtitle,omitempty"`
}
type NotifyData struct {
Text string
Opts NotifyOpts
}