summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-08-24 06:16:17 -0400
committerGeorge Goldberg <george@gberg.me>2018-08-24 11:16:17 +0100
commit4de2e5206e23ee268b38f071ecd8fcbea0bbc80a (patch)
treebe3d191545afdfa91a861be69a04dd1f646a1e16 /model
parent9599f1a52fd4b2d029113b3ec56bd75453ae4d7b (diff)
downloadchat-4de2e5206e23ee268b38f071ecd8fcbea0bbc80a.tar.gz
chat-4de2e5206e23ee268b38f071ecd8fcbea0bbc80a.tar.bz2
chat-4de2e5206e23ee268b38f071ecd8fcbea0bbc80a.zip
Support for interactive menus in message attachments (#9285)
Diffstat (limited to 'model')
-rw-r--r--model/post.go28
1 files changed, 25 insertions, 3 deletions
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.