This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
card.go
102 lines (87 loc) · 2.66 KB
/
card.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
package hangouts
// Card struct
type Card struct {
Header *Header `json:"header,omitempty"`
Sections []*Section `json:"sections"`
Actions []*Action `json:"cardActions,omitempty"`
}
// Header struct
type Header struct {
Title string `json:"title"`
Subtitle string `json:"subtitle,omitempty"`
ImageURL string `json:"imageUrl,omitempty"`
ImageStyle string `json:"imageStyle,omitempty"`
}
// Section struct
type Section struct {
Header string `json:"header,omitempty"`
Widgets []*Widget `json:"widgets,omitempty"`
}
// Widget struct
type Widget struct {
TextParagraph *TextParagraph `json:"textParagraph,omitempty"`
KeyValue *KeyValue `json:"keyValue,omitempty"`
Buttons []*Button `json:"buttons,omitempty"`
Image *Image `json:"image,omitempty"`
}
// TextParagraph struct
type TextParagraph struct {
Text string `json:"text"`
}
// KeyValue struct
type KeyValue struct {
TopLabel string `json:"topLabel,omitempty"`
Content string `json:"content,omitempty"`
ContentMultiline bool `json:"contentMultiline,omitempty"`
BottomLabel string `json:"bottomLabel,omitempty"`
OnClick *OnClick `json:"onClick,omitempty"`
Icon string `json:"icon,omitempty"`
IconURL string `json:"iconUrl,omitempty"`
Button *Button `json:"button,omitempty"`
}
// Button struct
type Button struct {
TextButton *TextButton `json:"textButton,omitempty"`
ImageButton *ImageButton `json:"imageButton,omitempty"`
}
// TextButton struct
type TextButton struct {
Text string `json:"text,omitempty"`
OnClick *OnClick `json:"onClick,omitempty"`
}
// ImageButton struct
type ImageButton struct {
IconURL string `json:"iconUrl,omitempty"`
Icon string `json:"icon,omitempty"`
OnClick *OnClick `json:"onClick,omitempty"`
}
// Action struct
type Action struct {
Label string `json:"actionLabel,omitempty"`
OnClick *OnClick `json:"onClick,omitempty"`
}
// OnClick struct
type OnClick struct {
Action *FormAction `json:"action,omitempty"`
OpenLink *OpenLink `json:"openLink,omitempty"`
}
// OpenLink struct
type OpenLink struct {
URL string `json:"url,omitempty"`
}
// FormAction struct
type FormAction struct {
MethodName string `json:"actionMethodName,omitempty"`
Parameters []*ActionParameter `json:"parameters,omitempty"`
}
// ActionParameter struct
type ActionParameter struct {
Key string `json:"key,omitempty"`
Value string `json:"value,omitempty"`
}
// Image struct
type Image struct {
ImageURL string `json:"imageUrl,omitempty"`
OnClick *OnClick `json:"onClick,omitempty"`
AspectRatio int `json:"aspectRatio,omitempty"`
}