MM-26231: Reverts plugin API breaking change. (#14852)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4d40226e02
Коммит
88a6cf0bf1
@@ -471,8 +471,8 @@ func (api *PluginAPI) GetGroup(groupId string) (*model.Group, *model.AppError) {
|
|||||||
return api.app.GetGroup(groupId)
|
return api.app.GetGroup(groupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *PluginAPI) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
func (api *PluginAPI) GetGroupByName(name string) (*model.Group, *model.AppError) {
|
||||||
return api.app.GetGroupByName(name, opts)
|
return api.app.GetGroupByName(name, model.GroupSearchOpts{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *PluginAPI) GetGroupsForUser(userId string) ([]*model.Group, *model.AppError) {
|
func (api *PluginAPI) GetGroupsForUser(userId string) ([]*model.Group, *model.AppError) {
|
||||||
|
|||||||
@@ -511,8 +511,8 @@ type API interface {
|
|||||||
// GetGroupByName gets a group by name.
|
// GetGroupByName gets a group by name.
|
||||||
//
|
//
|
||||||
// @tag Group
|
// @tag Group
|
||||||
// Minimum server version: 5.24
|
// Minimum server version: 5.18
|
||||||
GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError)
|
GetGroupByName(name string) (*model.Group, *model.AppError)
|
||||||
|
|
||||||
// GetGroupsForUser gets the groups a user is in.
|
// GetGroupsForUser gets the groups a user is in.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -553,9 +553,9 @@ func (api *apiTimerLayer) GetGroup(groupId string) (*model.Group, *model.AppErro
|
|||||||
return _returnsA, _returnsB
|
return _returnsA, _returnsB
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *apiTimerLayer) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
func (api *apiTimerLayer) GetGroupByName(name string) (*model.Group, *model.AppError) {
|
||||||
startTime := timePkg.Now()
|
startTime := timePkg.Now()
|
||||||
_returnsA, _returnsB := api.apiImpl.GetGroupByName(name, opts)
|
_returnsA, _returnsB := api.apiImpl.GetGroupByName(name)
|
||||||
api.recordTime(startTime, "GetGroupByName", _returnsB == nil)
|
api.recordTime(startTime, "GetGroupByName", _returnsB == nil)
|
||||||
return _returnsA, _returnsB
|
return _returnsA, _returnsB
|
||||||
}
|
}
|
||||||
@@ -1019,6 +1019,6 @@ func (api *apiTimerLayer) PluginHTTP(request *http.Request) *http.Response {
|
|||||||
func (api *apiTimerLayer) PublishUserTyping(userId, channelId, parentId string) *model.AppError {
|
func (api *apiTimerLayer) PublishUserTyping(userId, channelId, parentId string) *model.AppError {
|
||||||
startTime := timePkg.Now()
|
startTime := timePkg.Now()
|
||||||
_returnsA := api.apiImpl.PublishUserTyping(userId, channelId, parentId)
|
_returnsA := api.apiImpl.PublishUserTyping(userId, channelId, parentId)
|
||||||
api.recordTime(startTime, "PublishUserTyping", true)
|
api.recordTime(startTime, "PublishUserTyping", _returnsA == nil)
|
||||||
return _returnsA
|
return _returnsA
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2638,7 +2638,6 @@ func (s *apiRPCServer) GetGroup(args *Z_GetGroupArgs, returns *Z_GetGroupReturns
|
|||||||
|
|
||||||
type Z_GetGroupByNameArgs struct {
|
type Z_GetGroupByNameArgs struct {
|
||||||
A string
|
A string
|
||||||
B model.GroupSearchOpts
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Z_GetGroupByNameReturns struct {
|
type Z_GetGroupByNameReturns struct {
|
||||||
@@ -2646,8 +2645,8 @@ type Z_GetGroupByNameReturns struct {
|
|||||||
B *model.AppError
|
B *model.AppError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *apiRPCClient) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
func (g *apiRPCClient) GetGroupByName(name string) (*model.Group, *model.AppError) {
|
||||||
_args := &Z_GetGroupByNameArgs{name, opts}
|
_args := &Z_GetGroupByNameArgs{name}
|
||||||
_returns := &Z_GetGroupByNameReturns{}
|
_returns := &Z_GetGroupByNameReturns{}
|
||||||
if err := g.client.Call("Plugin.GetGroupByName", _args, _returns); err != nil {
|
if err := g.client.Call("Plugin.GetGroupByName", _args, _returns); err != nil {
|
||||||
log.Printf("RPC call to GetGroupByName API failed: %s", err.Error())
|
log.Printf("RPC call to GetGroupByName API failed: %s", err.Error())
|
||||||
@@ -2657,9 +2656,9 @@ func (g *apiRPCClient) GetGroupByName(name string, opts model.GroupSearchOpts) (
|
|||||||
|
|
||||||
func (s *apiRPCServer) GetGroupByName(args *Z_GetGroupByNameArgs, returns *Z_GetGroupByNameReturns) error {
|
func (s *apiRPCServer) GetGroupByName(args *Z_GetGroupByNameArgs, returns *Z_GetGroupByNameReturns) error {
|
||||||
if hook, ok := s.impl.(interface {
|
if hook, ok := s.impl.(interface {
|
||||||
GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError)
|
GetGroupByName(name string) (*model.Group, *model.AppError)
|
||||||
}); ok {
|
}); ok {
|
||||||
returns.A, returns.B = hook.GetGroupByName(args.A, args.B)
|
returns.A, returns.B = hook.GetGroupByName(args.A)
|
||||||
} else {
|
} else {
|
||||||
return encodableError(fmt.Errorf("API GetGroupByName called but not implemented."))
|
return encodableError(fmt.Errorf("API GetGroupByName called but not implemented."))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1089,13 +1089,13 @@ func (_m *API) GetGroup(groupId string) (*model.Group, *model.AppError) {
|
|||||||
return r0, r1
|
return r0, r1
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetGroupByName provides a mock function with given fields: name, opts
|
// GetGroupByName provides a mock function with given fields: name
|
||||||
func (_m *API) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
func (_m *API) GetGroupByName(name string) (*model.Group, *model.AppError) {
|
||||||
ret := _m.Called(name, opts)
|
ret := _m.Called(name)
|
||||||
|
|
||||||
var r0 *model.Group
|
var r0 *model.Group
|
||||||
if rf, ok := ret.Get(0).(func(string, model.GroupSearchOpts) *model.Group); ok {
|
if rf, ok := ret.Get(0).(func(string) *model.Group); ok {
|
||||||
r0 = rf(name, opts)
|
r0 = rf(name)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(0) != nil {
|
if ret.Get(0) != nil {
|
||||||
r0 = ret.Get(0).(*model.Group)
|
r0 = ret.Get(0).(*model.Group)
|
||||||
@@ -1103,8 +1103,8 @@ func (_m *API) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.G
|
|||||||
}
|
}
|
||||||
|
|
||||||
var r1 *model.AppError
|
var r1 *model.AppError
|
||||||
if rf, ok := ret.Get(1).(func(string, model.GroupSearchOpts) *model.AppError); ok {
|
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||||
r1 = rf(name, opts)
|
r1 = rf(name)
|
||||||
} else {
|
} else {
|
||||||
if ret.Get(1) != nil {
|
if ret.Get(1) != nil {
|
||||||
r1 = ret.Get(1).(*model.AppError)
|
r1 = ret.Get(1).(*model.AppError)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user