summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/rpcplugin/api.go')
-rw-r--r--plugin/rpcplugin/api.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugin/rpcplugin/api.go b/plugin/rpcplugin/api.go
index f2068e815..fb3517ae2 100644
--- a/plugin/rpcplugin/api.go
+++ b/plugin/rpcplugin/api.go
@@ -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 {