[MM-2307] Move plugin helpers from mattermost-server repository into mattermost-plugin-api (#17870)

Этот коммит содержится в:
Ben Schumacher
2021-08-06 11:54:56 +02:00
коммит произвёл GitHub
родитель 28137b3048
Коммит bf1f60d309
19 изменённых файлов: 67 добавлений и 2801 удалений

Просмотреть файл

@@ -18,13 +18,11 @@ const (
func ClientMain(pluginImplementation interface{}) {
if impl, ok := pluginImplementation.(interface {
SetAPI(api API)
SetHelpers(helpers Helpers)
SetDriver(driver Driver)
}); !ok {
panic("Plugin implementation given must embed plugin.MattermostPlugin")
} else {
impl.SetAPI(nil)
impl.SetHelpers(nil)
impl.SetDriver(nil)
}
@@ -40,9 +38,8 @@ func ClientMain(pluginImplementation interface{}) {
type MattermostPlugin struct {
// API exposes the plugin api, and becomes available just prior to the OnActive hook.
API API
Helpers Helpers
Driver Driver
API API
Driver Driver
}
// SetAPI persists the given API interface to the plugin. It is invoked just prior to the
@@ -51,11 +48,6 @@ func (p *MattermostPlugin) SetAPI(api API) {
p.API = api
}
// SetHelpers does the same thing as SetAPI except for the plugin helpers.
func (p *MattermostPlugin) SetHelpers(helpers Helpers) {
p.Helpers = helpers
}
// SetDriver sets the RPC client implementation to talk with the server.
func (p *MattermostPlugin) SetDriver(driver Driver) {
p.Driver = driver