Add GetPostsAfter() to plugin API (#9650)
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
0d87486e99
Коммит
d346027691
@@ -339,6 +339,10 @@ func (api *PluginAPI) GetPostsSince(channelId string, time int64) (*model.PostLi
|
|||||||
return api.app.GetPostsSince(channelId, time)
|
return api.app.GetPostsSince(channelId, time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PluginAPI) GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) {
|
||||||
|
return api.app.GetPostsAfterPost(channelId, postId, page, perPage)
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PluginAPI) GetPostsBefore(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) {
|
func (api *PluginAPI) GetPostsBefore(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) {
|
||||||
return api.app.GetPostsBeforePost(channelId, postId, page, perPage)
|
return api.app.GetPostsBeforePost(channelId, postId, page, perPage)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,6 +225,11 @@ type API interface {
|
|||||||
// Minimum server version: 5.6
|
// Minimum server version: 5.6
|
||||||
GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)
|
GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)
|
||||||
|
|
||||||
|
// GetPostsAfter gets a page of posts that were posted after the post provided.
|
||||||
|
//
|
||||||
|
// Minimum server version: 5.6
|
||||||
|
GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)
|
||||||
|
|
||||||
// GetPostsBefore gets a page of posts that were posted before the post provided.
|
// GetPostsBefore gets a page of posts that were posted before the post provided.
|
||||||
//
|
//
|
||||||
// Minimum server version: 5.6
|
// Minimum server version: 5.6
|
||||||
|
|||||||
@@ -2219,6 +2219,38 @@ func (s *apiRPCServer) GetPostsSince(args *Z_GetPostsSinceArgs, returns *Z_GetPo
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Z_GetPostsAfterArgs struct {
|
||||||
|
A string
|
||||||
|
B string
|
||||||
|
C int
|
||||||
|
D int
|
||||||
|
}
|
||||||
|
|
||||||
|
type Z_GetPostsAfterReturns struct {
|
||||||
|
A *model.PostList
|
||||||
|
B *model.AppError
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *apiRPCClient) GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) {
|
||||||
|
_args := &Z_GetPostsAfterArgs{channelId, postId, page, perPage}
|
||||||
|
_returns := &Z_GetPostsAfterReturns{}
|
||||||
|
if err := g.client.Call("Plugin.GetPostsAfter", _args, _returns); err != nil {
|
||||||
|
log.Printf("RPC call to GetPostsAfter API failed: %s", err.Error())
|
||||||
|
}
|
||||||
|
return _returns.A, _returns.B
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *apiRPCServer) GetPostsAfter(args *Z_GetPostsAfterArgs, returns *Z_GetPostsAfterReturns) error {
|
||||||
|
if hook, ok := s.impl.(interface {
|
||||||
|
GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)
|
||||||
|
}); ok {
|
||||||
|
returns.A, returns.B = hook.GetPostsAfter(args.A, args.B, args.C, args.D)
|
||||||
|
} else {
|
||||||
|
return encodableError(fmt.Errorf("API GetPostsAfter called but not implemented."))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Z_GetPostsBeforeArgs struct {
|
type Z_GetPostsBeforeArgs struct {
|
||||||
A string
|
A string
|
||||||
B string
|
B string
|
||||||
|
|||||||
@@ -697,6 +697,31 @@ func (_m *API) GetPostThread(postId string) (*model.PostList, *model.AppError) {
|
|||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPostsAfter provides a mock function with given fields: channelId, postId, page, perPage
|
||||||
|
func (_m *API) GetPostsAfter(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError) {
|
||||||
|
ret := _m.Called(channelId, postId, page, perPage)
|
||||||
|
|
||||||
|
var r0 *model.PostList
|
||||||
|
if rf, ok := ret.Get(0).(func(string, string, int, int) *model.PostList); ok {
|
||||||
|
r0 = rf(channelId, postId, page, perPage)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*model.PostList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var r1 *model.AppError
|
||||||
|
if rf, ok := ret.Get(1).(func(string, string, int, int) *model.AppError); ok {
|
||||||
|
r1 = rf(channelId, postId, page, perPage)
|
||||||
|
} else {
|
||||||
|
if ret.Get(1) != nil {
|
||||||
|
r1 = ret.Get(1).(*model.AppError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
// GetPostsBefore provides a mock function with given fields: channelId, postId, page, perPage
|
// GetPostsBefore provides a mock function with given fields: channelId, postId, page, perPage
|
||||||
func (_m *API) GetPostsBefore(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError) {
|
func (_m *API) GetPostsBefore(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError) {
|
||||||
ret := _m.Called(channelId, postId, page, perPage)
|
ret := _m.Called(channelId, postId, page, perPage)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user