Add GetTeamsUnreadForUser to plugin api (#9659)
* Add GetTeamsUnreadForUser to plugin api * Remove teamIdToExclude from plugin method GetTeamsUnreadForUser * Add minimum server version to plugin API doc of GetTeamsUnreadForUser
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
ecade2f1ec
Коммит
6d4421d18a
@@ -107,6 +107,10 @@ func (api *PluginAPI) GetTeamByName(name string) (*model.Team, *model.AppError)
|
||||
return api.app.GetTeamByName(name)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError) {
|
||||
return api.app.GetTeamsUnreadForUser("", userId)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) {
|
||||
return api.app.UpdateTeam(team)
|
||||
}
|
||||
|
||||
@@ -106,6 +106,11 @@ type API interface {
|
||||
// GetTeamByName gets a team by its name.
|
||||
GetTeamByName(name string) (*model.Team, *model.AppError)
|
||||
|
||||
// GetTeamsUnreadForUser gets the unread message and mention counts for each team to which the given user belongs.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError)
|
||||
|
||||
// UpdateTeam updates a team.
|
||||
UpdateTeam(team *model.Team) (*model.Team, *model.AppError)
|
||||
|
||||
|
||||
@@ -1209,6 +1209,35 @@ func (s *apiRPCServer) GetTeamByName(args *Z_GetTeamByNameArgs, returns *Z_GetTe
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetTeamsUnreadForUserArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_GetTeamsUnreadForUserReturns struct {
|
||||
A []*model.TeamUnread
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError) {
|
||||
_args := &Z_GetTeamsUnreadForUserArgs{userId}
|
||||
_returns := &Z_GetTeamsUnreadForUserReturns{}
|
||||
if err := g.client.Call("Plugin.GetTeamsUnreadForUser", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetTeamsUnreadForUser API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetTeamsUnreadForUser(args *Z_GetTeamsUnreadForUserArgs, returns *Z_GetTeamsUnreadForUserReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetTeamsUnreadForUser(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetTeamsUnreadForUser called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateTeamArgs struct {
|
||||
A *model.Team
|
||||
}
|
||||
|
||||
@@ -1193,6 +1193,31 @@ func (_m *API) GetTeamsForUser(userId string) ([]*model.Team, *model.AppError) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetTeamsUnreadForUser provides a mock function with given fields: userId
|
||||
func (_m *API) GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError) {
|
||||
ret := _m.Called(userId)
|
||||
|
||||
var r0 []*model.TeamUnread
|
||||
if rf, ok := ret.Get(0).(func(string) []*model.TeamUnread); ok {
|
||||
r0 = rf(userId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.TeamUnread)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
r1 = rf(userId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetUser provides a mock function with given fields: userId
|
||||
func (_m *API) GetUser(userId string) (*model.User, *model.AppError) {
|
||||
ret := _m.Called(userId)
|
||||
|
||||
Ссылка в новой задаче
Block a user