MM-32421: Extend channel sidebar category APIs for Plugins (#17821)

* extend plugin api with sidebar functionalities

* include generated mocks for tests

* bump up version requirements for plugin api

* update tag to 'ChannelSidebar'

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Madhav Hugar
2021-06-25 18:52:09 +02:00
коммит произвёл GitHub
родитель a9b3e423e6
Коммит b4f6cb8cb7
5 изменённых файлов: 218 добавлений и 0 удалений

Просмотреть файл

@@ -2491,6 +2491,98 @@ func (s *apiRPCServer) SearchChannels(args *Z_SearchChannelsArgs, returns *Z_Sea
return nil
}
type Z_CreateChannelSidebarCategoryArgs struct {
A string
B string
C *model.SidebarCategoryWithChannels
}
type Z_CreateChannelSidebarCategoryReturns struct {
A *model.SidebarCategoryWithChannels
B *model.AppError
}
func (g *apiRPCClient) CreateChannelSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError) {
_args := &Z_CreateChannelSidebarCategoryArgs{userID, teamID, newCategory}
_returns := &Z_CreateChannelSidebarCategoryReturns{}
if err := g.client.Call("Plugin.CreateChannelSidebarCategory", _args, _returns); err != nil {
log.Printf("RPC call to CreateChannelSidebarCategory API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) CreateChannelSidebarCategory(args *Z_CreateChannelSidebarCategoryArgs, returns *Z_CreateChannelSidebarCategoryReturns) error {
if hook, ok := s.impl.(interface {
CreateChannelSidebarCategory(userID, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)
}); ok {
returns.A, returns.B = hook.CreateChannelSidebarCategory(args.A, args.B, args.C)
} else {
return encodableError(fmt.Errorf("API CreateChannelSidebarCategory called but not implemented."))
}
return nil
}
type Z_GetChannelSidebarCategoriesArgs struct {
A string
B string
}
type Z_GetChannelSidebarCategoriesReturns struct {
A *model.OrderedSidebarCategories
B *model.AppError
}
func (g *apiRPCClient) GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError) {
_args := &Z_GetChannelSidebarCategoriesArgs{userID, teamID}
_returns := &Z_GetChannelSidebarCategoriesReturns{}
if err := g.client.Call("Plugin.GetChannelSidebarCategories", _args, _returns); err != nil {
log.Printf("RPC call to GetChannelSidebarCategories API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetChannelSidebarCategories(args *Z_GetChannelSidebarCategoriesArgs, returns *Z_GetChannelSidebarCategoriesReturns) error {
if hook, ok := s.impl.(interface {
GetChannelSidebarCategories(userID, teamID string) (*model.OrderedSidebarCategories, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetChannelSidebarCategories(args.A, args.B)
} else {
return encodableError(fmt.Errorf("API GetChannelSidebarCategories called but not implemented."))
}
return nil
}
type Z_UpdateChannelSidebarCategoriesArgs struct {
A string
B string
C []*model.SidebarCategoryWithChannels
}
type Z_UpdateChannelSidebarCategoriesReturns struct {
A []*model.SidebarCategoryWithChannels
B *model.AppError
}
func (g *apiRPCClient) UpdateChannelSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError) {
_args := &Z_UpdateChannelSidebarCategoriesArgs{userID, teamID, categories}
_returns := &Z_UpdateChannelSidebarCategoriesReturns{}
if err := g.client.Call("Plugin.UpdateChannelSidebarCategories", _args, _returns); err != nil {
log.Printf("RPC call to UpdateChannelSidebarCategories API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) UpdateChannelSidebarCategories(args *Z_UpdateChannelSidebarCategoriesArgs, returns *Z_UpdateChannelSidebarCategoriesReturns) error {
if hook, ok := s.impl.(interface {
UpdateChannelSidebarCategories(userID, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)
}); ok {
returns.A, returns.B = hook.UpdateChannelSidebarCategories(args.A, args.B, args.C)
} else {
return encodableError(fmt.Errorf("API UpdateChannelSidebarCategories called but not implemented."))
}
return nil
}
type Z_SearchUsersArgs struct {
A *model.UserSearch
}