Plugin framework: add ability to install other plugins to the… (#12232)
* add ability to upload other plugins to the plugin API * generated client rpc glue code * fix UploadPlugin API signature * generated plugin mocks * added upload plugin test * removed unused comment * using single line to call InstallPlugin with file Reader * fix minimum server version * added successful plugin upload test * renamed UploadPlugin to InstallPlugin
Этот коммит содержится в:
коммит произвёл
Ali Farooq
родитель
db97b49e7a
Коммит
d7ee3553fa
@@ -8,6 +8,7 @@ package plugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
|
||||
"github.com/mattermost/mattermost-server/mlog"
|
||||
@@ -3488,6 +3489,36 @@ func (s *apiRPCServer) GetPluginStatus(args *Z_GetPluginStatusArgs, returns *Z_G
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_InstallPluginArgs struct {
|
||||
A io.Reader
|
||||
B bool
|
||||
}
|
||||
|
||||
type Z_InstallPluginReturns struct {
|
||||
A *model.Manifest
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError) {
|
||||
_args := &Z_InstallPluginArgs{file, replace}
|
||||
_returns := &Z_InstallPluginReturns{}
|
||||
if err := g.client.Call("Plugin.InstallPlugin", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to InstallPlugin API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) InstallPlugin(args *Z_InstallPluginArgs, returns *Z_InstallPluginReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.InstallPlugin(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API InstallPlugin called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_KVSetArgs struct {
|
||||
A string
|
||||
B []byte
|
||||
|
||||
Ссылка в новой задаче
Block a user