GH-9617 Add plugin API for GetEmoji method (#9656)
* Add GetEmoji plugin api * Add server version
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
54b7a29581
Коммит
a9ee2e01c5
@@ -377,6 +377,10 @@ func (api *PluginAPI) GetEmojiByName(name string) (*model.Emoji, *model.AppError
|
|||||||
return api.app.GetEmojiByName(name)
|
return api.app.GetEmojiByName(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PluginAPI) GetEmoji(emojiId string) (*model.Emoji, *model.AppError) {
|
||||||
|
return api.app.GetEmoji(emojiId)
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PluginAPI) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError) {
|
func (api *PluginAPI) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError) {
|
||||||
return api.app.CopyFileInfos(userId, fileIds)
|
return api.app.CopyFileInfos(userId, fileIds)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,11 @@ type API interface {
|
|||||||
// Minimum server version: 5.6
|
// Minimum server version: 5.6
|
||||||
GetEmojiByName(name string) (*model.Emoji, *model.AppError)
|
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,
|
// 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.
|
// recording the given user id as the new creator and returning the new set of file ids.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -2402,6 +2402,35 @@ func (s *apiRPCServer) GetEmojiByName(args *Z_GetEmojiByNameArgs, returns *Z_Get
|
|||||||
return nil
|
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 {
|
type Z_CopyFileInfosArgs struct {
|
||||||
A string
|
A string
|
||||||
B []string
|
B []string
|
||||||
|
|||||||
@@ -581,6 +581,31 @@ func (_m *API) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError) {
|
|||||||
return r0, r1, r2
|
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
|
// 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