From 3fba8e42b140c1189bf3c06882cce5e2231e63da Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Fri, 8 Jan 2016 12:41:26 -0600 Subject: partial fix for UI --- model/command_response.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 model/command_response.go (limited to 'model/command_response.go') diff --git a/model/command_response.go b/model/command_response.go new file mode 100644 index 000000000..001384864 --- /dev/null +++ b/model/command_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package model + +import ( + "encoding/json" + "io" +) + +const ( + COMMAND_RESPONSE_TYPE_IN_CHANNEL = "in_channel" + COMMAND_RESPONSE_TYPE_EPHEMERAL = "ephemeral" +) + +type CommandResponse struct { + ResponseType string `json:"response_type"` + Text string `json:"text"` + Attachments interface{} `json:"attachments"` +} + +func (o *CommandResponse) ToJson() string { + b, err := json.Marshal(o) + if err != nil { + return "" + } else { + return string(b) + } +} + +func CommandResponseFromJson(data io.Reader) *CommandResponse { + decoder := json.NewDecoder(data) + var o CommandResponse + err := decoder.Decode(&o) + if err == nil { + return &o + } else { + return nil + } +} -- cgit v1.2.3-1-g7c22 From b1a7c1acf139efbb5312b4aa939bd94155e6a9e6 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sat, 9 Jan 2016 08:54:07 -0600 Subject: adding different commands --- model/command_response.go | 1 + 1 file changed, 1 insertion(+) (limited to 'model/command_response.go') diff --git a/model/command_response.go b/model/command_response.go index 001384864..9314f38ef 100644 --- a/model/command_response.go +++ b/model/command_response.go @@ -16,6 +16,7 @@ const ( type CommandResponse struct { ResponseType string `json:"response_type"` Text string `json:"text"` + GotoLocation string `json:"goto_location"` Attachments interface{} `json:"attachments"` } -- cgit v1.2.3-1-g7c22