summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hodan <daniel.hodan@czertbytes.de>2018-10-15 18:27:45 +0200
committerChristopher Speller <crspeller@gmail.com>2018-10-15 09:27:45 -0700
commita35a9b9b2d9720a3753c96a4a3a36d437e518140 (patch)
treeaf227ccb050f73335a901b16f85084ff1b15286b
parent3087f0bc4c81a11ab3ecc08d3a37ea3d0dfda390 (diff)
downloadchat-a35a9b9b2d9720a3753c96a4a3a36d437e518140.tar.gz
chat-a35a9b9b2d9720a3753c96a4a3a36d437e518140.tar.bz2
chat-a35a9b9b2d9720a3753c96a4a3a36d437e518140.zip
add GetChannelsForTeamForUser to plugin api (#9646)
-rw-r--r--app/plugin_api.go4
-rw-r--r--plugin/api.go3
-rw-r--r--plugin/client_rpc_generated.go31
-rw-r--r--plugin/plugintest/api.go25
4 files changed, 63 insertions, 0 deletions
diff --git a/app/plugin_api.go b/app/plugin_api.go
index 1deb45802..c57ca9eb5 100644
--- a/app/plugin_api.go
+++ b/app/plugin_api.go
@@ -237,6 +237,10 @@ func (api *PluginAPI) GetChannelByNameForTeamName(teamName, channelName string,
return api.app.GetChannelByNameForTeamName(channelName, teamName, includeDeleted)
}
+func (api *PluginAPI) GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
+ return api.app.GetChannelsForUser(teamId, userId, includeDeleted)
+}
+
func (api *PluginAPI) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError) {
return api.app.GetDirectChannel(userId1, userId2)
}
diff --git a/plugin/api.go b/plugin/api.go
index 004d4c1ff..e0b3dde3c 100644
--- a/plugin/api.go
+++ b/plugin/api.go
@@ -128,6 +128,9 @@ type API interface {
// GetChannelByNameForTeamName gets a channel by its name, given a team name.
GetChannelByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)
+ // GetChannelsForTeamForUser gets a list of channels for given user ID in given team ID.
+ GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError)
+
// GetDirectChannel gets a direct message channel.
GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)
diff --git a/plugin/client_rpc_generated.go b/plugin/client_rpc_generated.go
index 8522f7be4..cf865f78c 100644
--- a/plugin/client_rpc_generated.go
+++ b/plugin/client_rpc_generated.go
@@ -1539,6 +1539,37 @@ func (s *apiRPCServer) GetChannelByNameForTeamName(args *Z_GetChannelByNameForTe
return nil
}
+type Z_GetChannelsForTeamForUserArgs struct {
+ A string
+ B string
+ C bool
+}
+
+type Z_GetChannelsForTeamForUserReturns struct {
+ A *model.ChannelList
+ B *model.AppError
+}
+
+func (g *apiRPCClient) GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
+ _args := &Z_GetChannelsForTeamForUserArgs{teamId, userId, includeDeleted}
+ _returns := &Z_GetChannelsForTeamForUserReturns{}
+ if err := g.client.Call("Plugin.GetChannelsForTeamForUser", _args, _returns); err != nil {
+ log.Printf("RPC call to GetChannelsForTeamForUser API failed: %s", err.Error())
+ }
+ return _returns.A, _returns.B
+}
+
+func (s *apiRPCServer) GetChannelsForTeamForUser(args *Z_GetChannelsForTeamForUserArgs, returns *Z_GetChannelsForTeamForUserReturns) error {
+ if hook, ok := s.impl.(interface {
+ GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError)
+ }); ok {
+ returns.A, returns.B = hook.GetChannelsForTeamForUser(args.A, args.B, args.C)
+ } else {
+ return encodableError(fmt.Errorf("API GetChannelsForTeamForUser called but not implemented."))
+ }
+ return nil
+}
+
type Z_GetDirectChannelArgs struct {
A string
B string
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go
index b915a6105..a65b3a5d7 100644
--- a/plugin/plugintest/api.go
+++ b/plugin/plugintest/api.go
@@ -458,6 +458,31 @@ func (_m *API) GetChannelMembers(channelId string, page int, perPage int) (*mode
return r0, r1
}
+// GetChannelsForTeamForUser provides a mock function with given fields: teamId, userId, includeDeleted
+func (_m *API) GetChannelsForTeamForUser(teamId string, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
+ ret := _m.Called(teamId, userId, includeDeleted)
+
+ var r0 *model.ChannelList
+ if rf, ok := ret.Get(0).(func(string, string, bool) *model.ChannelList); ok {
+ r0 = rf(teamId, userId, includeDeleted)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*model.ChannelList)
+ }
+ }
+
+ var r1 *model.AppError
+ if rf, ok := ret.Get(1).(func(string, string, bool) *model.AppError); ok {
+ r1 = rf(teamId, userId, includeDeleted)
+ } else {
+ if ret.Get(1) != nil {
+ r1 = ret.Get(1).(*model.AppError)
+ }
+ }
+
+ return r0, r1
+}
+
// GetConfig provides a mock function with given fields:
func (_m *API) GetConfig() *model.Config {
ret := _m.Called()