Added GETEmojilist plugin api (#9750)
* Add GetEmojiList plugin api * Fixed bug in getemojilist causing build test failure * Fix linting error * Add requested changes * Fix all conflicts
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
789b2f72dd
Коммит
f6b1ccbcb1
@@ -385,6 +385,10 @@ func (api *PluginAPI) GetProfileImage(userId string) ([]byte, *model.AppError) {
|
|||||||
return data, err
|
return data, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PluginAPI) GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError) {
|
||||||
|
return api.app.GetEmojiList(page, perPage, sortBy)
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PluginAPI) GetEmojiByName(name string) (*model.Emoji, *model.AppError) {
|
func (api *PluginAPI) GetEmojiByName(name string) (*model.Emoji, *model.AppError) {
|
||||||
return api.app.GetEmojiByName(name)
|
return api.app.GetEmojiByName(name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,6 +259,13 @@ type API interface {
|
|||||||
// Minimum server version: 5.6
|
// Minimum server version: 5.6
|
||||||
GetProfileImage(userId string) ([]byte, *model.AppError)
|
GetProfileImage(userId string) ([]byte, *model.AppError)
|
||||||
|
|
||||||
|
// GetEmojiList returns a page of custom emoji on the system.
|
||||||
|
//
|
||||||
|
// The sortBy parameter can be: "name".
|
||||||
|
//
|
||||||
|
// Minimum server version: 5.6
|
||||||
|
GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError)
|
||||||
|
|
||||||
// GetEmojiByName gets an emoji by it's name.
|
// GetEmojiByName gets an emoji by it's name.
|
||||||
//
|
//
|
||||||
// Minimum server version: 5.6
|
// Minimum server version: 5.6
|
||||||
|
|||||||
@@ -2432,6 +2432,37 @@ func (s *apiRPCServer) GetProfileImage(args *Z_GetProfileImageArgs, returns *Z_G
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Z_GetEmojiListArgs struct {
|
||||||
|
A string
|
||||||
|
B int
|
||||||
|
C int
|
||||||
|
}
|
||||||
|
|
||||||
|
type Z_GetEmojiListReturns struct {
|
||||||
|
A []*model.Emoji
|
||||||
|
B *model.AppError
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *apiRPCClient) GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError) {
|
||||||
|
_args := &Z_GetEmojiListArgs{sortBy, page, perPage}
|
||||||
|
_returns := &Z_GetEmojiListReturns{}
|
||||||
|
if err := g.client.Call("Plugin.GetEmojiList", _args, _returns); err != nil {
|
||||||
|
log.Printf("RPC call to GetEmojiList API failed: %s", err.Error())
|
||||||
|
}
|
||||||
|
return _returns.A, _returns.B
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *apiRPCServer) GetEmojiList(args *Z_GetEmojiListArgs, returns *Z_GetEmojiListReturns) error {
|
||||||
|
if hook, ok := s.impl.(interface {
|
||||||
|
GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError)
|
||||||
|
}); ok {
|
||||||
|
returns.A, returns.B = hook.GetEmojiList(args.A, args.B, args.C)
|
||||||
|
} else {
|
||||||
|
return encodableError(fmt.Errorf("API GetEmojiList called but not implemented."))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Z_GetEmojiByNameArgs struct {
|
type Z_GetEmojiByNameArgs struct {
|
||||||
A string
|
A string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -656,6 +656,31 @@ func (_m *API) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) {
|
|||||||
return r0, r1, r2
|
return r0, r1, r2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetEmojiList provides a mock function with given fields: sortBy, page, perPage
|
||||||
|
func (_m *API) GetEmojiList(sortBy string, page int, perPage int) ([]*model.Emoji, *model.AppError) {
|
||||||
|
ret := _m.Called(sortBy, page, perPage)
|
||||||
|
|
||||||
|
var r0 []*model.Emoji
|
||||||
|
if rf, ok := ret.Get(0).(func(string, int, int) []*model.Emoji); ok {
|
||||||
|
r0 = rf(sortBy, page, perPage)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).([]*model.Emoji)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var r1 *model.AppError
|
||||||
|
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
|
||||||
|
r1 = rf(sortBy, page, perPage)
|
||||||
|
} else {
|
||||||
|
if ret.Get(1) != nil {
|
||||||
|
r1 = ret.Get(1).(*model.AppError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
// GetFileInfo provides a mock function with given fields: fileId
|
// GetFileInfo provides a mock function with given fields: fileId
|
||||||
func (_m *API) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) {
|
func (_m *API) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError) {
|
||||||
ret := _m.Called(fileId)
|
ret := _m.Called(fileId)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user