MM-29988 - Update exising Post APIs with collapsed threads (#16503)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2e1b578ccd
Коммит
b0bddeb5e6
@@ -2903,8 +2903,12 @@ func (c *Client4) DeletePost(postId string) (bool, *Response) {
|
||||
}
|
||||
|
||||
// GetPostThread gets a post with all the other posts in the same thread.
|
||||
func (c *Client4) GetPostThread(postId string, etag string) (*PostList, *Response) {
|
||||
r, err := c.DoApiGet(c.GetPostRoute(postId)+"/thread", etag)
|
||||
func (c *Client4) GetPostThread(postId string, etag string, collapsedThreads bool) (*PostList, *Response) {
|
||||
url := c.GetPostRoute(postId) + "/thread"
|
||||
if collapsedThreads {
|
||||
url += "?collapsedThreads=true"
|
||||
}
|
||||
r, err := c.DoApiGet(url, etag)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
@@ -2913,8 +2917,11 @@ func (c *Client4) GetPostThread(postId string, etag string) (*PostList, *Respons
|
||||
}
|
||||
|
||||
// GetPostsForChannel gets a page of posts with an array for ordering for a channel.
|
||||
func (c *Client4) GetPostsForChannel(channelId string, page, perPage int, etag string) (*PostList, *Response) {
|
||||
func (c *Client4) GetPostsForChannel(channelId string, page, perPage int, etag string, collapsedThreads bool) (*PostList, *Response) {
|
||||
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
|
||||
if collapsedThreads {
|
||||
query += "&collapsedThreads=true"
|
||||
}
|
||||
r, err := c.DoApiGet(c.GetChannelRoute(channelId)+"/posts"+query, etag)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
@@ -2965,8 +2972,11 @@ func (c *Client4) GetFlaggedPostsForUserInChannel(userId string, channelId strin
|
||||
}
|
||||
|
||||
// GetPostsSince gets posts created after a specified time as Unix time in milliseconds.
|
||||
func (c *Client4) GetPostsSince(channelId string, time int64) (*PostList, *Response) {
|
||||
func (c *Client4) GetPostsSince(channelId string, time int64, collapsedThreads bool) (*PostList, *Response) {
|
||||
query := fmt.Sprintf("?since=%v", time)
|
||||
if collapsedThreads {
|
||||
query += "&collapsedThreads=true"
|
||||
}
|
||||
r, err := c.DoApiGet(c.GetChannelRoute(channelId)+"/posts"+query, "")
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
@@ -2976,8 +2986,11 @@ func (c *Client4) GetPostsSince(channelId string, time int64) (*PostList, *Respo
|
||||
}
|
||||
|
||||
// GetPostsAfter gets a page of posts that were posted after the post provided.
|
||||
func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, etag string) (*PostList, *Response) {
|
||||
func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, etag string, collapsedThreads bool) (*PostList, *Response) {
|
||||
query := fmt.Sprintf("?page=%v&per_page=%v&after=%v", page, perPage, postId)
|
||||
if collapsedThreads {
|
||||
query += "&collapsedThreads=true"
|
||||
}
|
||||
r, err := c.DoApiGet(c.GetChannelRoute(channelId)+"/posts"+query, etag)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
@@ -2987,8 +3000,11 @@ func (c *Client4) GetPostsAfter(channelId, postId string, page, perPage int, eta
|
||||
}
|
||||
|
||||
// GetPostsBefore gets a page of posts that were posted before the post provided.
|
||||
func (c *Client4) GetPostsBefore(channelId, postId string, page, perPage int, etag string) (*PostList, *Response) {
|
||||
func (c *Client4) GetPostsBefore(channelId, postId string, page, perPage int, etag string, collapsedThreads bool) (*PostList, *Response) {
|
||||
query := fmt.Sprintf("?page=%v&per_page=%v&before=%v", page, perPage, postId)
|
||||
if collapsedThreads {
|
||||
query += "&collapsedThreads=true"
|
||||
}
|
||||
r, err := c.DoApiGet(c.GetChannelRoute(channelId)+"/posts"+query, etag)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
@@ -2998,8 +3014,11 @@ func (c *Client4) GetPostsBefore(channelId, postId string, page, perPage int, et
|
||||
}
|
||||
|
||||
// GetPostsAroundLastUnread gets a list of posts around last unread post by a user in a channel.
|
||||
func (c *Client4) GetPostsAroundLastUnread(userId, channelId string, limitBefore, limitAfter int) (*PostList, *Response) {
|
||||
func (c *Client4) GetPostsAroundLastUnread(userId, channelId string, limitBefore, limitAfter int, collapsedThreads bool) (*PostList, *Response) {
|
||||
query := fmt.Sprintf("?limit_before=%v&limit_after=%v", limitBefore, limitAfter)
|
||||
if collapsedThreads {
|
||||
query += "&collapsedThreads=true"
|
||||
}
|
||||
r, err := c.DoApiGet(c.GetUserRoute(userId)+c.GetChannelRoute(channelId)+"/posts/unread"+query, "")
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
|
||||
Ссылка в новой задаче
Block a user