mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add plugin methods to plugin API (#9744)
This commit is contained in:
committed by
Christopher Speller
parent
93e581d642
commit
e67d89b9a8
@@ -314,6 +314,35 @@ type API interface {
|
||||
// Minimum server version: 5.6
|
||||
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
|
||||
|
||||
// Plugin Section
|
||||
|
||||
// GetPlugins will return a list of plugin manifests for currently active plugins.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
GetPlugins() ([]*model.Manifest, *model.AppError)
|
||||
|
||||
// EnablePlugin will enable an plugin installed.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
EnablePlugin(id string) *model.AppError
|
||||
|
||||
// DisablePlugin will disable an enabled plugin.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
DisablePlugin(id string) *model.AppError
|
||||
|
||||
// RemovePlugin will disable and delete a plugin.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
RemovePlugin(id string) *model.AppError
|
||||
|
||||
// GetPluginStatus will return the status of a plugin.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
||||
|
||||
// KV Store Section
|
||||
|
||||
// KVSet will store a key-value pair, unique per plugin.
|
||||
KVSet(key string, value []byte) *model.AppError
|
||||
|
||||
|
||||
@@ -2728,6 +2728,147 @@ func (s *apiRPCServer) UploadFile(args *Z_UploadFileArgs, returns *Z_UploadFileR
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetPluginsArgs struct {
|
||||
}
|
||||
|
||||
type Z_GetPluginsReturns struct {
|
||||
A []*model.Manifest
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetPlugins() ([]*model.Manifest, *model.AppError) {
|
||||
_args := &Z_GetPluginsArgs{}
|
||||
_returns := &Z_GetPluginsReturns{}
|
||||
if err := g.client.Call("Plugin.GetPlugins", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetPlugins API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetPlugins(args *Z_GetPluginsArgs, returns *Z_GetPluginsReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetPlugins() ([]*model.Manifest, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetPlugins()
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetPlugins called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetPluginStatusArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_GetPluginStatusReturns struct {
|
||||
A *model.PluginStatus
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError) {
|
||||
_args := &Z_GetPluginStatusArgs{id}
|
||||
_returns := &Z_GetPluginStatusReturns{}
|
||||
if err := g.client.Call("Plugin.GetPluginStatus", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetPluginStatus API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetPluginStatus(args *Z_GetPluginStatusArgs, returns *Z_GetPluginStatusReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetPluginStatus(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetPluginStatus called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_EnablePluginArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_EnablePluginReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) EnablePlugin(id string) *model.AppError {
|
||||
_args := &Z_EnablePluginArgs{id}
|
||||
_returns := &Z_EnablePluginReturns{}
|
||||
if err := g.client.Call("Plugin.EnablePlugin", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to EnablePlugin API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) EnablePlugin(args *Z_EnablePluginArgs, returns *Z_EnablePluginReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
EnablePlugin(id string) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.EnablePlugin(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API EnablePlugin called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_DisablePluginArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_DisablePluginReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) DisablePlugin(id string) *model.AppError {
|
||||
_args := &Z_DisablePluginArgs{id}
|
||||
_returns := &Z_DisablePluginReturns{}
|
||||
if err := g.client.Call("Plugin.DisablePlugin", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to DisablePlugin API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) DisablePlugin(args *Z_DisablePluginArgs, returns *Z_DisablePluginReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
DisablePlugin(id string) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.DisablePlugin(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API DisablePlugin called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RemovePluginArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_RemovePluginReturns struct {
|
||||
A *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) RemovePlugin(id string) *model.AppError {
|
||||
_args := &Z_RemovePluginArgs{id}
|
||||
_returns := &Z_RemovePluginReturns{}
|
||||
if err := g.client.Call("Plugin.RemovePlugin", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to RemovePlugin API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) RemovePlugin(args *Z_RemovePluginArgs, returns *Z_RemovePluginReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
RemovePlugin(id string) *model.AppError
|
||||
}); ok {
|
||||
returns.A = hook.RemovePlugin(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API RemovePlugin called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_KVSetArgs struct {
|
||||
A string
|
||||
B []byte
|
||||
|
||||
@@ -333,6 +333,38 @@ func (_m *API) DeleteUser(userId string) *model.AppError {
|
||||
return r0
|
||||
}
|
||||
|
||||
// DisablePlugin provides a mock function with given fields: id
|
||||
func (_m *API) DisablePlugin(id string) *model.AppError {
|
||||
ret := _m.Called(id)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
||||
r0 = rf(id)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// EnablePlugin provides a mock function with given fields: id
|
||||
func (_m *API) EnablePlugin(id string) *model.AppError {
|
||||
ret := _m.Called(id)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
||||
r0 = rf(id)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// GetChannel provides a mock function with given fields: channelId
|
||||
func (_m *API) GetChannel(channelId string) (*model.Channel, *model.AppError) {
|
||||
ret := _m.Called(channelId)
|
||||
@@ -779,6 +811,56 @@ func (_m *API) GetLDAPUserAttributes(userId string, attributes []string) (map[st
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetPluginStatus provides a mock function with given fields: id
|
||||
func (_m *API) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError) {
|
||||
ret := _m.Called(id)
|
||||
|
||||
var r0 *model.PluginStatus
|
||||
if rf, ok := ret.Get(0).(func(string) *model.PluginStatus); ok {
|
||||
r0 = rf(id)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.PluginStatus)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
r1 = rf(id)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetPlugins provides a mock function with given fields:
|
||||
func (_m *API) GetPlugins() ([]*model.Manifest, *model.AppError) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 []*model.Manifest
|
||||
if rf, ok := ret.Get(0).(func() []*model.Manifest); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.Manifest)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetPost provides a mock function with given fields: postId
|
||||
func (_m *API) GetPost(postId string) (*model.Post, *model.AppError) {
|
||||
ret := _m.Called(postId)
|
||||
@@ -1664,6 +1746,22 @@ func (_m *API) RegisterCommand(command *model.Command) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// RemovePlugin provides a mock function with given fields: id
|
||||
func (_m *API) RemovePlugin(id string) *model.AppError {
|
||||
ret := _m.Called(id)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
|
||||
r0 = rf(id)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// RemoveReaction provides a mock function with given fields: reaction
|
||||
func (_m *API) RemoveReaction(reaction *model.Reaction) *model.AppError {
|
||||
ret := _m.Called(reaction)
|
||||
|
||||
Reference in New Issue
Block a user