summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorDaniel Schalla <daniel@schalla.me>2018-04-17 14:20:47 +0200
committerJoram Wilander <jwawilander@gmail.com>2018-04-17 08:20:47 -0400
commit997df03ac1455785b7a39e40edcd67b3b3e86f9e (patch)
treee11a4f7712e0b5379c89cc415e0be1396b6057b9 /model/client4.go
parent3a4c7603b3ce35ab247b4dddaf7a2506375ba2c9 (diff)
downloadchat-997df03ac1455785b7a39e40edcd67b3b3e86f9e.tar.gz
chat-997df03ac1455785b7a39e40edcd67b3b3e86f9e.tar.bz2
chat-997df03ac1455785b7a39e40edcd67b3b3e86f9e.zip
Initial Commit of Ephemeral Message Support for System Admins (#8611)
Fixed Permission Test Fixed and extended ephemeral message tests; Removed Online/Activity Updates Set Create Time to current time gofmt
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 82d380440..f1feb1bfe 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -162,6 +162,10 @@ func (c *Client4) GetPostsRoute() string {
return fmt.Sprintf("/posts")
}
+func (c *Client4) GetPostsEphemeralRoute() string {
+ return fmt.Sprintf("/posts/ephemeral")
+}
+
func (c *Client4) GetConfigRoute() string {
return fmt.Sprintf("/config")
}
@@ -1771,6 +1775,16 @@ func (c *Client4) CreatePost(post *Post) (*Post, *Response) {
}
}
+// CreatePostEphemeral creates a ephemeral post based on the provided post struct which is send to the given user id
+func (c *Client4) CreatePostEphemeral(post *PostEphemeral) (*Post, *Response) {
+ if r, err := c.DoApiPost(c.GetPostsEphemeralRoute(), post.ToUnsanitizedJson()); err != nil {
+ return nil, BuildErrorResponse(r, err)
+ } else {
+ defer closeBody(r)
+ return PostFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// UpdatePost updates a post based on the provided post struct.
func (c *Client4) UpdatePost(postId string, post *Post) (*Post, *Response) {
if r, err := c.DoApiPut(c.GetPostRoute(postId), post.ToUnsanitizedJson()); err != nil {