From 997df03ac1455785b7a39e40edcd67b3b3e86f9e Mon Sep 17 00:00:00 2001 From: Daniel Schalla Date: Tue, 17 Apr 2018 14:20:47 +0200 Subject: 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 --- model/client4.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'model/client4.go') 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 { -- cgit v1.2.3-1-g7c22