This repository was archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserTypes.go
More file actions
51 lines (46 loc) · 1.4 KB
/
userTypes.go
File metadata and controls
51 lines (46 loc) · 1.4 KB
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
package main
// User interface
// All messaging plattforms need to implement this
type User interface {
sendMessage(msg *genericMessage) error
addToAlertGroup(group string) error
delFromAlertGroup(group string) error
getUserinfo() *Userinfo
}
// Userinfo that can be re-used by User implementations
type Userinfo struct {
// Path used inside of the messaging protocols to reach this user
MessagePath string
// username for internal usage
Username string
// username used to speak to the user
FriendlyName string
}
// HangoutsUser implements User for Hangouts Chat
type HangoutsUser struct {
*Userinfo
}
type genericMessage struct {
HeaderText, ContentText, FooterText string
HeaderPictureURL string
// Path to the group chat / DM this message belongs to
MessagePath string
// Thread in the chat
Thread string
Sender User
Buttons []*genericButton
}
type genericButton struct {
// Text that should be displayed "next" to the button
HeaderText, ContentText, FooterText string
// Text that should be displayed on the button
ButtonText string
// Picture that should be shown on the button (instead of text)
PictureURL string
// URL that should be opened on click (instead of callback)
OnClickLink string
// function we want to call when the button is clicked
CallbackFunction string
// Additional infos we want to pass to the callback as key-value
CallbackInfos map[string]string
}