GH-9607: Add GetTeamsForUser to plugin API (#9644)

* add GetTeamsForUser to plugin api

* Add version comment, fix comment typo
This commit is contained in:
Daniel Hodan
2018-10-17 16:37:52 +02:00
committed by Jesse Hallam
parent 7226759831
commit e8c9ccaa7e
4 changed files with 63 additions and 0 deletions

View File

@@ -1177,6 +1177,35 @@ func (s *apiRPCServer) UpdateTeam(args *Z_UpdateTeamArgs, returns *Z_UpdateTeamR
return nil
}
type Z_GetTeamsForUserArgs struct {
A string
}
type Z_GetTeamsForUserReturns struct {
A []*model.Team
B *model.AppError
}
func (g *apiRPCClient) GetTeamsForUser(userId string) ([]*model.Team, *model.AppError) {
_args := &Z_GetTeamsForUserArgs{userId}
_returns := &Z_GetTeamsForUserReturns{}
if err := g.client.Call("Plugin.GetTeamsForUser", _args, _returns); err != nil {
log.Printf("RPC call to GetTeamsForUser API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetTeamsForUser(args *Z_GetTeamsForUserArgs, returns *Z_GetTeamsForUserReturns) error {
if hook, ok := s.impl.(interface {
GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetTeamsForUser(args.A)
} else {
return encodableError(fmt.Errorf("API GetTeamsForUser called but not implemented."))
}
return nil
}
type Z_CreateTeamMemberArgs struct {
A string
B string