summaryrefslogtreecommitdiffstats
path: root/model/status.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-30 17:09:39 +0200
committerCorey Hulen <corey@hulen.com>2017-03-30 08:09:39 -0700
commit29e6db5713c57d7bb46d7aea38b1001b9e8a1212 (patch)
tree66d0a06a35068ce26024b0b9c030de0b1c8bab5c /model/status.go
parentee3b983a6344d78bafa553607133020e8e1fb0ed (diff)
downloadchat-29e6db5713c57d7bb46d7aea38b1001b9e8a1212.tar.gz
chat-29e6db5713c57d7bb46d7aea38b1001b9e8a1212.tar.bz2
chat-29e6db5713c57d7bb46d7aea38b1001b9e8a1212.zip
Implement POST /users/status/ids for apiv4 (#5894)
Diffstat (limited to 'model/status.go')
-rw-r--r--model/status.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/model/status.go b/model/status.go
index e38f43fe4..59115b42d 100644
--- a/model/status.go
+++ b/model/status.go
@@ -45,6 +45,26 @@ func StatusFromJson(data io.Reader) *Status {
}
}
+func StatusListToJson(u []*Status) string {
+ b, err := json.Marshal(u)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
+func StatusListFromJson(data io.Reader) []*Status {
+ decoder := json.NewDecoder(data)
+ var statuses []*Status
+ err := decoder.Decode(&statuses)
+ if err == nil {
+ return statuses
+ } else {
+ return nil
+ }
+}
+
func StatusMapToInterfaceMap(statusMap map[string]*Status) map[string]interface{} {
interfaceMap := map[string]interface{}{}
for _, s := range statusMap {