Add menu action support
Mikhail Salosin
6 years ago
9 | 9 | Short bool `json:"short"` |
10 | 10 | } |
11 | 11 | |
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 | |
14 | 14 | // provided per attachment. |
15 | 15 | 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. | |
22 | 40 | } |
23 | 41 | |
24 | 42 | // AttachmentActionCallback is sent from Slack when a user clicks a button in an interactive message (aka AttachmentAction) |