add CreateDirectChannel plugin api (#9848)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a78913178c
Коммит
cae7798d76
@@ -52,6 +52,11 @@ type API interface {
|
||||
// CreateUser creates a user.
|
||||
CreateUser(user *model.User) (*model.User, *model.AppError)
|
||||
|
||||
// CreateDirectChannel creates a Direct channel.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
CreateDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError)
|
||||
|
||||
// DeleteUser deletes a user.
|
||||
DeleteUser(userId string) *model.AppError
|
||||
|
||||
|
||||
@@ -767,6 +767,36 @@ func (s *apiRPCServer) CreateUser(args *Z_CreateUserArgs, returns *Z_CreateUserR
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_CreateDirectChannelArgs struct {
|
||||
A string
|
||||
B string
|
||||
}
|
||||
|
||||
type Z_CreateDirectChannelReturns struct {
|
||||
A *model.Channel
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) CreateDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError) {
|
||||
_args := &Z_CreateDirectChannelArgs{userId1, userId2}
|
||||
_returns := &Z_CreateDirectChannelReturns{}
|
||||
if err := g.client.Call("Plugin.CreateDirectChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to CreateDirectChannel API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) CreateDirectChannel(args *Z_CreateDirectChannelArgs, returns *Z_CreateDirectChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
CreateDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.CreateDirectChannel(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API CreateDirectChannel called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_DeleteUserArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
@@ -112,6 +112,31 @@ func (_m *API) CreateChannel(channel *model.Channel) (*model.Channel, *model.App
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreateDirectChannel provides a mock function with given fields: userId1, userId2
|
||||
func (_m *API) CreateDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError) {
|
||||
ret := _m.Called(userId1, userId2)
|
||||
|
||||
var r0 *model.Channel
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.Channel); ok {
|
||||
r0 = rf(userId1, userId2)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
r1 = rf(userId1, userId2)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreatePost provides a mock function with given fields: post
|
||||
func (_m *API) CreatePost(post *model.Post) (*model.Post, *model.AppError) {
|
||||
ret := _m.Called(post)
|
||||
|
||||
Ссылка в новой задаче
Block a user