From 4de2e5206e23ee268b38f071ecd8fcbea0bbc80a Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 24 Aug 2018 06:16:17 -0400 Subject: Support for interactive menus in message attachments (#9285) --- model/post.go | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'model/post.go') diff --git a/model/post.go b/model/post.go index 635493c9d..82cc0a0e9 100644 --- a/model/post.go +++ b/model/post.go @@ -50,6 +50,8 @@ const ( PROPS_ADD_CHANNEL_MEMBER = "add_channel_member" POST_PROPS_ADDED_USER_ID = "addedUserId" POST_PROPS_DELETE_BY = "deleteBy" + POST_ACTION_TYPE_BUTTON = "button" + POST_ACTION_TYPE_SELECT = "select" ) type Post struct { @@ -108,21 +110,35 @@ type PostForIndexing struct { ParentCreateAt *int64 `json:"parent_create_at"` } +type DoPostActionRequest struct { + SelectedOption string `json:"selected_option"` +} + type PostAction struct { Id string `json:"id"` Name string `json:"name"` + Type string `json:"type"` + DataSource string `json:"data_source"` + Options []*PostActionOptions `json:"options"` Integration *PostActionIntegration `json:"integration,omitempty"` } +type PostActionOptions struct { + Text string `json:"text"` + Value string `json:"value"` +} + type PostActionIntegration struct { URL string `json:"url,omitempty"` Context StringInterface `json:"context,omitempty"` } type PostActionIntegrationRequest struct { - UserId string `json:"user_id"` - PostId string `json:"post_id"` - Context StringInterface `json:"context,omitempty"` + UserId string `json:"user_id"` + PostId string `json:"post_id"` + Type string `json:"type"` + DataSource string `json:"data_source"` + Context StringInterface `json:"context,omitempty"` } type PostActionIntegrationResponse struct { @@ -455,6 +471,12 @@ func (o *PostEphemeral) ToUnsanitizedJson() string { return string(b) } +func DoPostActionRequestFromJson(data io.Reader) *DoPostActionRequest { + var o *DoPostActionRequest + json.NewDecoder(data).Decode(&o) + return o +} + // RewriteImageURLs takes a message and returns a copy that has all of the image URLs replaced // according to the function f. For each image URL, f will be invoked, and the resulting markdown // will contain the URL returned by that invocation instead. -- cgit v1.2.3-1-g7c22