MM-26056 Add plugin ability to execute slash command. (#14898)
* Add plugin ability to execute slash command. * A test * Add site url to command args for plugin API * Remove unessiary complexity.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b977017ca7
Коммит
bebff8156b
@@ -523,6 +523,36 @@ func (s *apiRPCServer) UnregisterCommand(args *Z_UnregisterCommandArgs, returns
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_ExecuteSlashCommandArgs struct {
|
||||
A *model.CommandArgs
|
||||
}
|
||||
|
||||
type Z_ExecuteSlashCommandReturns struct {
|
||||
A *model.CommandResponse
|
||||
B error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) ExecuteSlashCommand(commandArgs *model.CommandArgs) (*model.CommandResponse, error) {
|
||||
_args := &Z_ExecuteSlashCommandArgs{commandArgs}
|
||||
_returns := &Z_ExecuteSlashCommandReturns{}
|
||||
if err := g.client.Call("Plugin.ExecuteSlashCommand", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to ExecuteSlashCommand API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) ExecuteSlashCommand(args *Z_ExecuteSlashCommandArgs, returns *Z_ExecuteSlashCommandReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
ExecuteSlashCommand(commandArgs *model.CommandArgs) (*model.CommandResponse, error)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.ExecuteSlashCommand(args.A)
|
||||
returns.B = encodableError(returns.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API ExecuteSlashCommand called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetSessionArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user