Adding SetFileSearchableContent plugin API endpoint (#24355)

* Adding SetFileSearchableContent plugin API endpoint

* Fixing CI problems

* Fixing CI problems

* Fixing CI problems

* Fixing CI problems

* Fixing CI problems

* Exposing it to the public API

* Fix CI problems

* Adding SetSearchableContent to the pluginapi File struct
Этот коммит содержится в:
Jesús Espino
2023-08-30 22:43:40 +02:00
коммит произвёл GitHub
родитель fd74208af1
Коммит c9d49536f8
12 изменённых файлов: 154 добавлений и 10 удалений

Просмотреть файл

@@ -783,6 +783,12 @@ type API interface {
// Minimum server version: 5.3
GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)
// SetFileSearchableContent update the File Info searchable text for full text search
//
// @tag File
// Minimum server version: 9.1
SetFileSearchableContent(fileID string, content string) *model.AppError
// GetFileInfos gets File Infos with options
//
// @tag File

Просмотреть файл

@@ -852,6 +852,13 @@ func (api *apiTimerLayer) GetFileInfo(fileId string) (*model.FileInfo, *model.Ap
return _returnsA, _returnsB
}
func (api *apiTimerLayer) SetFileSearchableContent(fileID string, content string) *model.AppError {
startTime := timePkg.Now()
_returnsA := api.apiImpl.SetFileSearchableContent(fileID, content)
api.recordTime(startTime, "SetFileSearchableContent", _returnsA == nil)
return _returnsA
}
func (api *apiTimerLayer) GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError) {
startTime := timePkg.Now()
_returnsA, _returnsB := api.apiImpl.GetFileInfos(page, perPage, opt)

Просмотреть файл

@@ -4345,6 +4345,35 @@ func (s *apiRPCServer) GetFileInfo(args *Z_GetFileInfoArgs, returns *Z_GetFileIn
return nil
}
type Z_SetFileSearchableContentArgs struct {
A string
B string
}
type Z_SetFileSearchableContentReturns struct {
A *model.AppError
}
func (g *apiRPCClient) SetFileSearchableContent(fileID string, content string) *model.AppError {
_args := &Z_SetFileSearchableContentArgs{fileID, content}
_returns := &Z_SetFileSearchableContentReturns{}
if err := g.client.Call("Plugin.SetFileSearchableContent", _args, _returns); err != nil {
log.Printf("RPC call to SetFileSearchableContent API failed: %s", err.Error())
}
return _returns.A
}
func (s *apiRPCServer) SetFileSearchableContent(args *Z_SetFileSearchableContentArgs, returns *Z_SetFileSearchableContentReturns) error {
if hook, ok := s.impl.(interface {
SetFileSearchableContent(fileID string, content string) *model.AppError
}); ok {
returns.A = hook.SetFileSearchableContent(args.A, args.B)
} else {
return encodableError(fmt.Errorf("API SetFileSearchableContent called but not implemented."))
}
return nil
}
type Z_GetFileInfosArgs struct {
A int
B int

Просмотреть файл

@@ -3655,6 +3655,22 @@ func (_m *API) SendPushNotification(notification *model.PushNotification, userID
return r0
}
// SetFileSearchableContent provides a mock function with given fields: fileID, content
func (_m *API) SetFileSearchableContent(fileID string, content string) *model.AppError {
ret := _m.Called(fileID, content)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) *model.AppError); ok {
r0 = rf(fileID, content)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// SetProfileImage provides a mock function with given fields: userID, data
func (_m *API) SetProfileImage(userID string, data []byte) *model.AppError {
ret := _m.Called(userID, data)