Add GetChannelMember method to plugin API (#7930)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
46f51197fb
Коммит
7a1f81cd52
@@ -154,11 +154,21 @@ type APIGetGroupChannelArgs struct {
|
||||
UserIds []string
|
||||
}
|
||||
|
||||
type APIGetChannelMemberArgs struct {
|
||||
ChannelId string
|
||||
UserId string
|
||||
}
|
||||
|
||||
type APIChannelReply struct {
|
||||
Channel *model.Channel
|
||||
Error *model.AppError
|
||||
}
|
||||
|
||||
type APIChannelMemberReply struct {
|
||||
ChannelMember *model.ChannelMember
|
||||
Error *model.AppError
|
||||
}
|
||||
|
||||
func (api *LocalAPI) CreateChannel(args *model.Channel, reply *APIChannelReply) error {
|
||||
channel, err := api.api.CreateChannel(args)
|
||||
*reply = APIChannelReply{
|
||||
@@ -220,6 +230,15 @@ func (api *LocalAPI) UpdateChannel(args *model.Channel, reply *APIChannelReply)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (api *LocalAPI) GetChannelMember(args *APIGetChannelMemberArgs, reply *APIChannelMemberReply) error {
|
||||
member, err := api.api.GetChannelMember(args.ChannelId, args.UserId)
|
||||
*reply = APIChannelMemberReply{
|
||||
ChannelMember: member,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type APIPostReply struct {
|
||||
Post *model.Post
|
||||
Error *model.AppError
|
||||
@@ -476,6 +495,17 @@ func (api *RemoteAPI) UpdateChannel(channel *model.Channel) (*model.Channel, *mo
|
||||
return reply.Channel, reply.Error
|
||||
}
|
||||
|
||||
func (api *RemoteAPI) GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError) {
|
||||
var reply APIChannelMemberReply
|
||||
if err := api.client.Call("LocalAPI.GetChannelMember", &APIGetChannelMemberArgs{
|
||||
ChannelId: channelId,
|
||||
UserId: userId,
|
||||
}, &reply); err != nil {
|
||||
return nil, model.NewAppError("RemoteAPI.GetChannelMember", "plugin.rpcplugin.invocation.error", nil, "err="+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return reply.ChannelMember, reply.Error
|
||||
}
|
||||
|
||||
func (api *RemoteAPI) CreatePost(post *model.Post) (*model.Post, *model.AppError) {
|
||||
var reply APIPostReply
|
||||
if err := api.client.Call("LocalAPI.CreatePost", post, &reply); err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user