Skip to content

Commit

Permalink
Merge pull request #34 from orsonwang/master
Browse files Browse the repository at this point in the history
Add default_action support to generic template
  • Loading branch information
maciekmm committed Dec 26, 2017
2 parents 167c1f5 + 6cae9c5 commit c0b254e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion template/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ type GenericTemplate struct {
Title string `json:"title"`
ItemURL string `json:"item_url,omitempty"`
ImageURL string `json:"image_url,omitempty"`
DefaultActionGeneric *DefaultActionGeneric `json:"default_action,omitempty"`
// Subtitle is limited to 80 characters
Subtitle string `json:"subtitle,omitempty"`
Buttons []Button `json:"buttons,omitempty"`
}

type DefaultActionGeneric struct {
Type ButtonType `json:"type,omitempty"` // Must be "web_url"
URL string `json:"url,omitempty"`
}

func (GenericTemplate) Type() TemplateType {
return TemplateTypeGeneric
}

func (GenericTemplate) SupportsButtons() bool {
return true
}
}

0 comments on commit c0b254e

Please sign in to comment.