2023-02-28 14:20:26 +08:00
|
|
|
package api
|
2021-06-28 15:27:35 +08:00
|
|
|
|
2023-02-27 18:11:00 +08:00
|
|
|
import (
|
|
|
|
|
"context"
|
2023-03-16 20:21:10 +08:00
|
|
|
|
2023-03-17 11:27:34 +08:00
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
|
2023-03-16 10:46:06 +08:00
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
|
2023-05-30 16:15:11 +08:00
|
|
|
"google.golang.org/grpc"
|
2023-03-08 17:29:03 +08:00
|
|
|
|
2023-02-27 18:11:00 +08:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
2021-06-28 15:27:35 +08:00
|
|
|
|
2023-06-02 20:52:16 +08:00
|
|
|
func NewGroup(discov discoveryregistry.SvcDiscoveryRegistry) *Group {
|
2023-06-20 21:15:23 +08:00
|
|
|
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImGroupName)
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
client := group.NewGroupClient(conn)
|
|
|
|
|
return &Group{discov: discov, conn: conn, client: client}
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Group struct {
|
2023-06-02 20:52:16 +08:00
|
|
|
conn *grpc.ClientConn
|
2023-06-20 21:15:23 +08:00
|
|
|
client group.GroupClient
|
2023-06-02 20:52:16 +08:00
|
|
|
discov discoveryregistry.SvcDiscoveryRegistry
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 21:15:23 +08:00
|
|
|
func (o *Group) Client() group.GroupClient {
|
|
|
|
|
return o.client
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-08 19:18:05 +08:00
|
|
|
func (o *Group) CreateGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.CreateGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-08 19:18:05 +08:00
|
|
|
func (o *Group) SetGroupInfo(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.SetGroupInfo, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) JoinGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.JoinGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) QuitGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.QuitGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) ApplicationGroupResponse(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GroupApplicationResponse, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) TransferGroupOwner(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.TransferGroupOwner, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetRecvGroupApplicationList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetGroupApplicationList, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetUserReqGroupApplicationList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetUserReqApplicationList, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetGroupsInfo(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetGroupsInfo, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) KickGroupMember(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.KickGroupMember, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetGroupMembersInfo(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetGroupMembersInfo, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-04-12 18:16:02 +08:00
|
|
|
func (o *Group) GetGroupMemberList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetGroupMemberList, o.Client, c)
|
2023-04-12 18:16:02 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) InviteUserToGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.InviteUserToGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetJoinedGroupList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetJoinedGroupList, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) DismissGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.DismissGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) MuteGroupMember(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.MuteGroupMember, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) CancelMuteGroupMember(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.CancelMuteGroupMember, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) MuteGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.MuteGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) CancelMuteGroup(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.CancelMuteGroup, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) SetGroupMemberInfo(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.SetGroupMemberInfo, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetGroupAbstractInfo(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetGroupAbstractInfo, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//func (g *Group) SetGroupMemberNickname(c *gin.Context) {
|
2023-06-20 17:03:20 +08:00
|
|
|
// a2r.Call(group.GroupClient.SetGroupMemberNickname, g.userClient, c)
|
2023-02-09 14:33:35 +08:00
|
|
|
//}
|
|
|
|
|
//
|
2023-02-27 18:11:00 +08:00
|
|
|
//func (g *Group) GetGroupAllMemberList(c *gin.Context) {
|
2023-06-20 17:03:20 +08:00
|
|
|
// a2r.Call(group.GroupClient.GetGroupAllMember, g.userClient, c)
|
2023-01-09 18:01:41 +08:00
|
|
|
//}
|
2023-02-27 18:11:00 +08:00
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetJoinedSuperGroupList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetJoinedSuperGroupList, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 14:41:59 +08:00
|
|
|
func (o *Group) GetSuperGroupsInfo(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(group.GroupClient.GetSuperGroupsInfo, o.Client, c)
|
2023-02-27 18:11:00 +08:00
|
|
|
}
|