You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
795 B

package events
import "fmt"
type ButtonPressed struct {
ID string `json:"id"`
SwipedID string `json:"swipedId,omitempty"`
Name string `json:"name"`
}
func (e ButtonPressed) EventDescription() string {
if e.SwipedID != "" {
return fmt.Sprintf("ButtonPressed(name:%s, swipe:%s->%s)", e.Name, e.SwipedID, e.ID)
} else {
return fmt.Sprintf("ButtonPressed(name:%s, id:%s)", e.Name, e.ID)
}
}
func (e ButtonPressed) TriggerKind() string {
return "ButtonPressed:" + e.Name
}
func (e ButtonPressed) TriggerValue(key string) (string, bool) {
switch key {
case "name":
return e.Name, true
case "id":
return e.ID, true
case "swipedFromId", "swipedId":
if e.SwipedID != "" {
return e.SwipedID, true
} else {
return "", false
}
default:
return "", false
}
}