mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Added the SearchPostsInTeam method to the plugin API (#10106)
This commit is contained in:
committed by
Hanzei
parent
87e36a3ecf
commit
c08fda1337
@@ -226,6 +226,11 @@ type API interface {
|
||||
// Minimum server version: 5.6
|
||||
SearchUsers(search *model.UserSearch) ([]*model.User, *model.AppError)
|
||||
|
||||
// SearchPostsInTeam returns a list of posts in a specific team that match the given params.
|
||||
//
|
||||
// Minimum server version: 5.10
|
||||
SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)
|
||||
|
||||
// AddChannelMember creates a channel membership for a user.
|
||||
AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)
|
||||
|
||||
|
||||
@@ -2053,6 +2053,36 @@ func (s *apiRPCServer) SearchUsers(args *Z_SearchUsersArgs, returns *Z_SearchUse
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_SearchPostsInTeamArgs struct {
|
||||
A string
|
||||
B []*model.SearchParams
|
||||
}
|
||||
|
||||
type Z_SearchPostsInTeamReturns struct {
|
||||
A []*model.Post
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError) {
|
||||
_args := &Z_SearchPostsInTeamArgs{teamId, paramsList}
|
||||
_returns := &Z_SearchPostsInTeamReturns{}
|
||||
if err := g.client.Call("Plugin.SearchPostsInTeam", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to SearchPostsInTeam API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) SearchPostsInTeam(args *Z_SearchPostsInTeamArgs, returns *Z_SearchPostsInTeamReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.SearchPostsInTeam(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API SearchPostsInTeam called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_AddChannelMemberArgs struct {
|
||||
A string
|
||||
B string
|
||||
|
||||
@@ -1983,6 +1983,31 @@ func (_m *API) SearchChannels(teamId string, term string) ([]*model.Channel, *mo
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchPostsInTeam provides a mock function with given fields: teamId, paramsList
|
||||
func (_m *API) SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError) {
|
||||
ret := _m.Called(teamId, paramsList)
|
||||
|
||||
var r0 []*model.Post
|
||||
if rf, ok := ret.Get(0).(func(string, []*model.SearchParams) []*model.Post); ok {
|
||||
r0 = rf(teamId, paramsList)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.Post)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, []*model.SearchParams) *model.AppError); ok {
|
||||
r1 = rf(teamId, paramsList)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchTeams provides a mock function with given fields: term
|
||||
func (_m *API) SearchTeams(term string) ([]*model.Team, *model.AppError) {
|
||||
ret := _m.Called(term)
|
||||
|
||||
Reference in New Issue
Block a user