mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
GH-9619 GetEmojiImage added to plugin API (#9628)
* GH-9619 conflict fix * GH-9619 fixed conflicts, version comment
This commit is contained in:
@@ -398,6 +398,10 @@ func (api *PluginAPI) ReadFile(path string) ([]byte, *model.AppError) {
|
||||
return api.app.ReadFile(path)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) {
|
||||
return api.app.GetEmojiImage(emojiId)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) KVSet(key string, value []byte) *model.AppError {
|
||||
return api.app.SetPluginKey(api.id, key, value)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user