mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
add GetEmojiByName method to plugin API (#9641)
This commit is contained in:
committed by
Christopher Speller
parent
b843774de8
commit
1cdf717446
@@ -200,6 +200,9 @@ type API interface {
|
||||
// GetProfileImage gets user's profile image
|
||||
GetProfileImage(userId string) ([]byte, *model.AppError)
|
||||
|
||||
// GetEmojiByName gets an emoji by it's name.
|
||||
GetEmojiByName(name 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.
|
||||
//
|
||||
|
||||
@@ -2251,6 +2251,35 @@ func (s *apiRPCServer) GetProfileImage(args *Z_GetProfileImageArgs, returns *Z_G
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetEmojiByNameArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_GetEmojiByNameReturns struct {
|
||||
A *model.Emoji
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetEmojiByName(name string) (*model.Emoji, *model.AppError) {
|
||||
_args := &Z_GetEmojiByNameArgs{name}
|
||||
_returns := &Z_GetEmojiByNameReturns{}
|
||||
if err := g.client.Call("Plugin.GetEmojiByName", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetEmojiByName API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetEmojiByName(args *Z_GetEmojiByNameArgs, returns *Z_GetEmojiByNameReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetEmojiByName(name string) (*model.Emoji, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetEmojiByName(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetEmojiByName called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_CopyFileInfosArgs struct {
|
||||
A string
|
||||
B []string
|
||||
|
||||
@@ -524,6 +524,31 @@ func (_m *API) GetDirectChannel(userId1 string, userId2 string) (*model.Channel,
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetEmojiByName provides a mock function with given fields: name
|
||||
func (_m *API) GetEmojiByName(name string) (*model.Emoji, *model.AppError) {
|
||||
ret := _m.Called(name)
|
||||
|
||||
var r0 *model.Emoji
|
||||
if rf, ok := ret.Get(0).(func(string) *model.Emoji); ok {
|
||||
r0 = rf(name)
|
||||
} 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(name)
|
||||
} 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)
|
||||
|
||||
Reference in New Issue
Block a user