GH-9617 Add plugin API for GetEmoji method (#9656)

* Add GetEmoji plugin api

* Add server version
This commit is contained in:
Jason Mojica
2018-10-25 13:54:10 +00:00
committed by Harrison Healey
parent 54b7a29581
commit a9ee2e01c5
4 changed files with 63 additions and 0 deletions

View File

@@ -254,6 +254,11 @@ type API interface {
// Minimum server version: 5.6
GetEmojiByName(name string) (*model.Emoji, *model.AppError)
// GetEmoji returns a custom emoji based on the emojiId string.
//
// Minimum server version: 5.6
GetEmoji(emojiId string) (*model.Emoji, *model.AppError)
// CopyFileInfos duplicates the FileInfo objects referenced by the given file ids,
// recording the given user id as the new creator and returning the new set of file ids.
//

View File

@@ -2402,6 +2402,35 @@ func (s *apiRPCServer) GetEmojiByName(args *Z_GetEmojiByNameArgs, returns *Z_Get
return nil
}
type Z_GetEmojiArgs struct {
A string
}
type Z_GetEmojiReturns struct {
A *model.Emoji
B *model.AppError
}
func (g *apiRPCClient) GetEmoji(emojiId string) (*model.Emoji, *model.AppError) {
_args := &Z_GetEmojiArgs{emojiId}
_returns := &Z_GetEmojiReturns{}
if err := g.client.Call("Plugin.GetEmoji", _args, _returns); err != nil {
log.Printf("RPC call to GetEmoji API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetEmoji(args *Z_GetEmojiArgs, returns *Z_GetEmojiReturns) error {
if hook, ok := s.impl.(interface {
GetEmoji(emojiId string) (*model.Emoji, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetEmoji(args.A)
} else {
return encodableError(fmt.Errorf("API GetEmoji called but not implemented."))
}
return nil
}
type Z_CopyFileInfosArgs struct {
A string
B []string

View File

@@ -581,6 +581,31 @@ func (_m *API) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) {
return r0, r1, r2
}
// GetEmoji provides a mock function with given fields: emojiId
func (_m *API) GetEmoji(emojiId string) (*model.Emoji, *model.AppError) {
ret := _m.Called(emojiId)
var r0 *model.Emoji
if rf, ok := ret.Get(0).(func(string) *model.Emoji); ok {
r0 = rf(emojiId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Emoji)
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(emojiId)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetFileInfo provides a mock function with given fields: fileId
func (_m *API) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) {
ret := _m.Called(fileId)