diff options
author | S4KH <kh.syerikjan@gmail.com> | 2018-10-19 04:07:21 +0800 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2018-10-18 16:07:21 -0400 |
commit | c3d536c644f102cbdc07354aa2ecf8bc8194882e (patch) | |
tree | e44825da2de7c9c6a8bb9f8352597b57de8af1aa /plugin | |
parent | d1805733feb8c48a7286eb1affc1f98ed1a044a8 (diff) | |
download | chat-c3d536c644f102cbdc07354aa2ecf8bc8194882e.tar.gz chat-c3d536c644f102cbdc07354aa2ecf8bc8194882e.tar.bz2 chat-c3d536c644f102cbdc07354aa2ecf8bc8194882e.zip |
GH-9619 GetEmojiImage added to plugin API (#9628)
* GH-9619 conflict fix
* GH-9619 fixed conflicts, version comment
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/api.go | 5 | ||||
-rw-r--r-- | plugin/client_rpc_generated.go | 30 | ||||
-rw-r--r-- | plugin/plugintest/api.go | 32 |
3 files changed, 67 insertions, 0 deletions
diff --git a/plugin/api.go b/plugin/api.go index fc64c627a..dc60bb57a 100644 --- a/plugin/api.go +++ b/plugin/api.go @@ -276,6 +276,11 @@ type API interface { // Minimum server version: 5.3 ReadFile(path string) ([]byte, *model.AppError) + // GetEmojiImage returns the emoji image. + // + // Minimum server version: 5.6 + GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) + // KVSet will store a key-value pair, unique per plugin. KVSet(key string, value []byte) *model.AppError diff --git a/plugin/client_rpc_generated.go b/plugin/client_rpc_generated.go index db4acaec1..d99b7b0e6 100644 --- a/plugin/client_rpc_generated.go +++ b/plugin/client_rpc_generated.go @@ -2518,6 +2518,36 @@ func (s *apiRPCServer) ReadFile(args *Z_ReadFileArgs, returns *Z_ReadFileReturns return nil } +type Z_GetEmojiImageArgs struct { + A string +} + +type Z_GetEmojiImageReturns struct { + A []byte + B string + C *model.AppError +} + +func (g *apiRPCClient) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) { + _args := &Z_GetEmojiImageArgs{emojiId} + _returns := &Z_GetEmojiImageReturns{} + if err := g.client.Call("Plugin.GetEmojiImage", _args, _returns); err != nil { + log.Printf("RPC call to GetEmojiImage API failed: %s", err.Error()) + } + return _returns.A, _returns.B, _returns.C +} + +func (s *apiRPCServer) GetEmojiImage(args *Z_GetEmojiImageArgs, returns *Z_GetEmojiImageReturns) error { + if hook, ok := s.impl.(interface { + GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) + }); ok { + returns.A, returns.B, returns.C = hook.GetEmojiImage(args.A) + } else { + return encodableError(fmt.Errorf("API GetEmojiImage called but not implemented.")) + } + return nil +} + type Z_KVSetArgs struct { A string B []byte diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go index 00328d155..b3df3616f 100644 --- a/plugin/plugintest/api.go +++ b/plugin/plugintest/api.go @@ -549,6 +549,38 @@ func (_m *API) GetEmojiByName(name string) (*model.Emoji, *model.AppError) { return r0, r1 } +// GetEmojiImage provides a mock function with given fields: emojiId +func (_m *API) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) { + ret := _m.Called(emojiId) + + var r0 []byte + if rf, ok := ret.Get(0).(func(string) []byte); ok { + r0 = rf(emojiId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + var r1 string + if rf, ok := ret.Get(1).(func(string) string); ok { + r1 = rf(emojiId) + } else { + r1 = ret.Get(1).(string) + } + + var r2 *model.AppError + if rf, ok := ret.Get(2).(func(string) *model.AppError); ok { + r2 = rf(emojiId) + } else { + if ret.Get(2) != nil { + r2 = ret.Get(2).(*model.AppError) + } + } + + return r0, r1, r2 +} + // GetFileInfo provides a mock function with given fields: fileId func (_m *API) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) { ret := _m.Called(fileId) |