diff options
author | Asaad Mahmood <Unknowngi@live.com> | 2015-10-27 20:15:33 +0500 |
---|---|---|
committer | Asaad Mahmood <Unknowngi@live.com> | 2015-10-27 20:15:33 +0500 |
commit | 179c4ea684af8d2a021cc6f0042bc4408f39b0bb (patch) | |
tree | 7789805249e5c962f1175f301beb74272dee30c0 /model/incoming_webhook.go | |
parent | 68b02ffb9eeb7a414feae8ed89b4011ccecf96bc (diff) | |
parent | 50eb3d9fe46d6364b6f12201edfe0a401be3ccdd (diff) | |
download | chat-179c4ea684af8d2a021cc6f0042bc4408f39b0bb.tar.gz chat-179c4ea684af8d2a021cc6f0042bc4408f39b0bb.tar.bz2 chat-179c4ea684af8d2a021cc6f0042bc4408f39b0bb.zip |
Merge branch 'master' of https://github.com/mattermost/platform into ui-improvements
Diffstat (limited to 'model/incoming_webhook.go')
-rw-r--r-- | model/incoming_webhook.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/model/incoming_webhook.go b/model/incoming_webhook.go index 9b9969b96..be1984244 100644 --- a/model/incoming_webhook.go +++ b/model/incoming_webhook.go @@ -23,6 +23,13 @@ type IncomingWebhook struct { TeamId string `json:"team_id"` } +type IncomingWebhookRequest struct { + Text string `json:"text"` + Username string `json:"username"` + IconURL string `json:"icon_url"` + ChannelName string `json:"channel"` +} + func (o *IncomingWebhook) ToJson() string { b, err := json.Marshal(o) if err != nil { @@ -104,3 +111,14 @@ func (o *IncomingWebhook) PreSave() { func (o *IncomingWebhook) PreUpdate() { o.UpdateAt = GetMillis() } + +func IncomingWebhookRequestFromJson(data io.Reader) *IncomingWebhookRequest { + decoder := json.NewDecoder(data) + var o IncomingWebhookRequest + err := decoder.Decode(&o) + if err == nil { + return &o + } else { + return nil + } +} |