summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorHanzei <16541325+hanzei@users.noreply.github.com>2018-10-15 16:04:22 +0200
committerJoram Wilander <jwawilander@gmail.com>2018-10-15 10:04:22 -0400
commitc1e5fff56534387864565d7c910d49e11a3add4a (patch)
tree6c6cddc3f747a95f186a2e1cbb3a745eb750271f /plugin
parent0267a1f76e48ae833a4f951c82e69db59d39b314 (diff)
downloadchat-c1e5fff56534387864565d7c910d49e11a3add4a.tar.gz
chat-c1e5fff56534387864565d7c910d49e11a3add4a.tar.bz2
chat-c1e5fff56534387864565d7c910d49e11a3add4a.zip
Add GetPostsSince() to plugin API (#9649)
Diffstat (limited to 'plugin')
-rw-r--r--plugin/api.go3
-rw-r--r--plugin/client_rpc_generated.go30
-rw-r--r--plugin/plugintest/api.go25
3 files changed, 58 insertions, 0 deletions
diff --git a/plugin/api.go b/plugin/api.go
index 36012c23e..d64946f93 100644
--- a/plugin/api.go
+++ b/plugin/api.go
@@ -176,6 +176,9 @@ type API interface {
// GetPost gets a post.
GetPost(postId string) (*model.Post, *model.AppError)
+ // GetPostsSince gets posts created after a specified time as Unix time in milliseconds.
+ GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)
+
// GetPostsForChannel gets a list of posts for a channel.
GetPostsForChannel(channelId string, page, perPage int) (*model.PostList, *model.AppError)
diff --git a/plugin/client_rpc_generated.go b/plugin/client_rpc_generated.go
index 9da133449..171bf6b07 100644
--- a/plugin/client_rpc_generated.go
+++ b/plugin/client_rpc_generated.go
@@ -2008,6 +2008,36 @@ func (s *apiRPCServer) GetPost(args *Z_GetPostArgs, returns *Z_GetPostReturns) e
return nil
}
+type Z_GetPostsSinceArgs struct {
+ A string
+ B int64
+}
+
+type Z_GetPostsSinceReturns struct {
+ A *model.PostList
+ B *model.AppError
+}
+
+func (g *apiRPCClient) GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError) {
+ _args := &Z_GetPostsSinceArgs{channelId, time}
+ _returns := &Z_GetPostsSinceReturns{}
+ if err := g.client.Call("Plugin.GetPostsSince", _args, _returns); err != nil {
+ log.Printf("RPC call to GetPostsSince API failed: %s", err.Error())
+ }
+ return _returns.A, _returns.B
+}
+
+func (s *apiRPCServer) GetPostsSince(args *Z_GetPostsSinceArgs, returns *Z_GetPostsSinceReturns) error {
+ if hook, ok := s.impl.(interface {
+ GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)
+ }); ok {
+ returns.A, returns.B = hook.GetPostsSince(args.A, args.B)
+ } else {
+ return encodableError(fmt.Errorf("API GetPostsSince called but not implemented."))
+ }
+ return nil
+}
+
type Z_GetPostsForChannelArgs struct {
A string
B int
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go
index c0302c1cf..2f2b8bc8c 100644
--- a/plugin/plugintest/api.go
+++ b/plugin/plugintest/api.go
@@ -649,6 +649,31 @@ func (_m *API) GetPostsForChannel(channelId string, page int, perPage int) (*mod
return r0, r1
}
+// GetPostsSince provides a mock function with given fields: channelId, time
+func (_m *API) GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError) {
+ ret := _m.Called(channelId, time)
+
+ var r0 *model.PostList
+ if rf, ok := ret.Get(0).(func(string, int64) *model.PostList); ok {
+ r0 = rf(channelId, time)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*model.PostList)
+ }
+ }
+
+ var r1 *model.AppError
+ if rf, ok := ret.Get(1).(func(string, int64) *model.AppError); ok {
+ r1 = rf(channelId, time)
+ } else {
+ if ret.Get(1) != nil {
+ r1 = ret.Get(1).(*model.AppError)
+ }
+ }
+
+ return r0, r1
+}
+
// GetPublicChannelsForTeam provides a mock function with given fields: teamId, offset, limit
func (_m *API) GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError) {
ret := _m.Called(teamId, offset, limit)