summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/push_response.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-03-25 21:04:10 +0100
committerWim <wim@42.be>2017-03-25 21:04:10 +0100
commiteacb1c1771cec126593f99f50aca4584236475fa (patch)
tree5ae7d8271c28e378d1d5ca2d0e1e243717a9bdbe /vendor/github.com/mattermost/platform/model/push_response.go
parent07fd825349e8b7e86f8afb3843cb8e2c2afc7c74 (diff)
downloadmatterbridge-msglm-eacb1c1771cec126593f99f50aca4584236475fa.tar.gz
matterbridge-msglm-eacb1c1771cec126593f99f50aca4584236475fa.tar.bz2
matterbridge-msglm-eacb1c1771cec126593f99f50aca4584236475fa.zip
Update vendor (mattermost)
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/push_response.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/push_response.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/github.com/mattermost/platform/model/push_response.go b/vendor/github.com/mattermost/platform/model/push_response.go
new file mode 100644
index 00000000..0271bc94
--- /dev/null
+++ b/vendor/github.com/mattermost/platform/model/push_response.go
@@ -0,0 +1,57 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package model
+
+import (
+ "encoding/json"
+ "io"
+)
+
+const (
+ PUSH_STATUS = "status"
+ PUSH_STATUS_OK = "OK"
+ PUSH_STATUS_FAIL = "FAIL"
+ PUSH_STATUS_REMOVE = "REMOVE"
+ PUSH_STATUS_ERROR_MSG = "error"
+)
+
+type PushResponse map[string]string
+
+func NewOkPushResponse() PushResponse {
+ m := make(map[string]string)
+ m[PUSH_STATUS] = PUSH_STATUS_OK
+ return m
+}
+
+func NewRemovePushResponse() PushResponse {
+ m := make(map[string]string)
+ m[PUSH_STATUS] = PUSH_STATUS_REMOVE
+ return m
+}
+
+func NewErrorPushResponse(message string) PushResponse {
+ m := make(map[string]string)
+ m[PUSH_STATUS] = PUSH_STATUS_FAIL
+ m[PUSH_STATUS_ERROR_MSG] = message
+ return m
+}
+
+func (me *PushResponse) ToJson() string {
+ if b, err := json.Marshal(me); err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
+func PushResponseFromJson(data io.Reader) PushResponse {
+ decoder := json.NewDecoder(data)
+
+ var objmap PushResponse
+ if err := decoder.Decode(&objmap); err != nil {
+ return make(map[string]string)
+ } else {
+ return objmap
+ }
+}