Codebase list golang-github-nlopes-slack / 1570b1d
Add menu action support Mikhail Salosin 6 years ago
1 changed file(s) with 26 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
99 Short bool `json:"short"`
1010 }
1111
12 // AttachmentAction is a button to be included in the attachment. Required when
13 // using message buttons and otherwise not useful. A maximum of 5 actions may be
12 // AttachmentAction is a button or menu to be included in the attachment. Required when
13 // using message buttons or menus and otherwise not useful. A maximum of 5 actions may be
1414 // provided per attachment.
1515 type AttachmentAction struct {
16 Name string `json:"name"` // Required.
17 Text string `json:"text"` // Required.
18 Style string `json:"style,omitempty"` // Optional. Allowed values: "default", "primary", "danger"
19 Type string `json:"type"` // Required. Must be set to "button"
20 Value string `json:"value,omitempty"` // Optional.
21 Confirm *ConfirmationField `json:"confirm,omitempty"` // Optional.
16 Name string `json:"name"` // Required.
17 Text string `json:"text"` // Required.
18 Style string `json:"style,omitempty"` // Optional. Allowed values: "default", "primary", "danger".
19 Type string `json:"type"` // Required. Must be set to "button" or "select".
20 Value string `json:"value,omitempty"` // Optional.
21 DataSource string `json:"data_source,omitempty"` // Optional.
22 MinQueryLength int `json:"min_query_length,omitempty"` // Optional. Default value is 1.
23 Options []AttachmentActionOption `json:"options,omitempty"` // Optional. Maximum of 100 options can be provided in each menu.
24 SelectedOptions []AttachmentActionOption `json:"selected_options,omitempty"` // Optional. The first element of this array will be set as the pre-selected option for this menu.
25 OptionGroups []AttachmentActionOptionGroup `json:"option_groups,omitempty"` // Optional.
26 Confirm *ConfirmationField `json:"confirm,omitempty"` // Optional.
27 }
28
29 // AttachmentActionOption the individual option to appear in action menu.
30 type AttachmentActionOption struct {
31 Text string `json:"text"` // Required.
32 Value string `json:"value"` // Required.
33 Description string `json:"description,omitempty"` // Optional. Up to 30 characters.
34 }
35
36 // AttachmentActionOptionGroup is a semi-hierarchal way to list available options to appear in action menu.
37 type AttachmentActionOptionGroup struct {
38 Text string `json:"text"` // Required.
39 Options []AttachmentActionOption `json:"options"` // Required.
2240 }
2341
2442 // AttachmentActionCallback is sent from Slack when a user clicks a button in an interactive message (aka AttachmentAction)