summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorHanzei <16541325+hanzei@users.noreply.github.com>2018-09-27 18:56:47 +0200
committerJesse Hallam <jesse.hallam@gmail.com>2018-09-27 12:56:47 -0400
commit15d9f10f431d6091202c262df0aec30923ade5b7 (patch)
tree5b069cd344dffff06f5f08b089d7a393baddc0a2 /plugin
parentd937f41233f735b8d4f3b73a0fe87668d66ea7f9 (diff)
downloadchat-15d9f10f431d6091202c262df0aec30923ade5b7.tar.gz
chat-15d9f10f431d6091202c262df0aec30923ade5b7.tar.bz2
chat-15d9f10f431d6091202c262df0aec30923ade5b7.zip
Add plugin API methode to return the current server version (#9429)
Diffstat (limited to 'plugin')
-rw-r--r--plugin/api.go3
-rw-r--r--plugin/client_rpc_generated.go27
-rw-r--r--plugin/plugintest/api.go14
3 files changed, 44 insertions, 0 deletions
diff --git a/plugin/api.go b/plugin/api.go
index 2f8c6dcc5..c4230860f 100644
--- a/plugin/api.go
+++ b/plugin/api.go
@@ -34,6 +34,9 @@ type API interface {
// SaveConfig sets the given config and persists the changes
SaveConfig(config *model.Config) *model.AppError
+ // GetServerVersion return the current Mattermost server version
+ GetServerVersion() string
+
// CreateUser creates a user.
CreateUser(user *model.User) (*model.User, *model.AppError)
diff --git a/plugin/client_rpc_generated.go b/plugin/client_rpc_generated.go
index 1403e3ff2..6780eedf6 100644
--- a/plugin/client_rpc_generated.go
+++ b/plugin/client_rpc_generated.go
@@ -656,6 +656,33 @@ func (s *apiRPCServer) SaveConfig(args *Z_SaveConfigArgs, returns *Z_SaveConfigR
return nil
}
+type Z_GetServerVersionArgs struct {
+}
+
+type Z_GetServerVersionReturns struct {
+ A string
+}
+
+func (g *apiRPCClient) GetServerVersion() string {
+ _args := &Z_GetServerVersionArgs{}
+ _returns := &Z_GetServerVersionReturns{}
+ if err := g.client.Call("Plugin.GetServerVersion", _args, _returns); err != nil {
+ log.Printf("RPC call to GetServerVersion API failed: %s", err.Error())
+ }
+ return _returns.A
+}
+
+func (s *apiRPCServer) GetServerVersion(args *Z_GetServerVersionArgs, returns *Z_GetServerVersionReturns) error {
+ if hook, ok := s.impl.(interface {
+ GetServerVersion() string
+ }); ok {
+ returns.A = hook.GetServerVersion()
+ } else {
+ return encodableError(fmt.Errorf("API GetServerVersion called but not implemented."))
+ }
+ return nil
+}
+
type Z_CreateUserArgs struct {
A *model.User
}
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go
index 32fab3595..531a0be4f 100644
--- a/plugin/plugintest/api.go
+++ b/plugin/plugintest/api.go
@@ -624,6 +624,20 @@ func (_m *API) GetReactions(postId string) ([]*model.Reaction, *model.AppError)
return r0, r1
}
+// GetServerVersion provides a mock function with given fields:
+func (_m *API) GetServerVersion() string {
+ ret := _m.Called()
+
+ var r0 string
+ if rf, ok := ret.Get(0).(func() string); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(string)
+ }
+
+ return r0
+}
+
// GetSession provides a mock function with given fields: sessionId
func (_m *API) GetSession(sessionId string) (*model.Session, *model.AppError) {
ret := _m.Called(sessionId)