You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/api/group.go

135 lines
3.7 KiB

2 years ago
package api
3 years ago
2 years ago
import (
"context"
2 years ago
2 years ago
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
2 years ago
"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"
"google.golang.org/grpc"
2 years ago
2 years ago
"github.com/gin-gonic/gin"
)
3 years ago
1 year ago
func NewGroup(discov discoveryregistry.SvcDiscoveryRegistry) *Group {
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImGroupName)
if err != nil {
1 year ago
// panic(err)
}
1 year ago
return &Group{conn: conn, discov: discov}
2 years ago
}
type Group struct {
1 year ago
conn *grpc.ClientConn
discov discoveryregistry.SvcDiscoveryRegistry
2 years ago
}
2 years ago
func (o *Group) client(ctx context.Context) (group.GroupClient, error) {
1 year ago
c, err := o.discov.GetConn(ctx, config.Config.RpcRegisterName.OpenImGroupName)
if err != nil {
return nil, err
}
return group.NewGroupClient(c), nil
2 years ago
}
2 years ago
func (o *Group) NewCreateGroup(c *gin.Context) {
a2r.Call(group.GroupClient.CreateGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) NewSetGroupInfo(c *gin.Context) {
a2r.Call(group.GroupClient.SetGroupInfo, o.client, c)
2 years ago
}
2 years ago
func (o *Group) JoinGroup(c *gin.Context) {
a2r.Call(group.GroupClient.JoinGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) QuitGroup(c *gin.Context) {
a2r.Call(group.GroupClient.QuitGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) ApplicationGroupResponse(c *gin.Context) {
a2r.Call(group.GroupClient.GroupApplicationResponse, o.client, c)
2 years ago
}
2 years ago
func (o *Group) TransferGroupOwner(c *gin.Context) {
a2r.Call(group.GroupClient.TransferGroupOwner, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetRecvGroupApplicationList(c *gin.Context) {
a2r.Call(group.GroupClient.GetGroupApplicationList, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetUserReqGroupApplicationList(c *gin.Context) {
a2r.Call(group.GroupClient.GetUserReqApplicationList, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetGroupsInfo(c *gin.Context) {
a2r.Call(group.GroupClient.GetGroupsInfo, o.client, c)
2 years ago
}
2 years ago
func (o *Group) KickGroupMember(c *gin.Context) {
a2r.Call(group.GroupClient.KickGroupMember, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetGroupMembersInfo(c *gin.Context) {
a2r.Call(group.GroupClient.GetGroupMembersInfo, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetGroupMemberList(c *gin.Context) {
a2r.Call(group.GroupClient.GetGroupMemberList, o.client, c)
}
2 years ago
func (o *Group) InviteUserToGroup(c *gin.Context) {
a2r.Call(group.GroupClient.InviteUserToGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetJoinedGroupList(c *gin.Context) {
a2r.Call(group.GroupClient.GetJoinedGroupList, o.client, c)
2 years ago
}
2 years ago
func (o *Group) DismissGroup(c *gin.Context) {
a2r.Call(group.GroupClient.DismissGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) MuteGroupMember(c *gin.Context) {
a2r.Call(group.GroupClient.MuteGroupMember, o.client, c)
2 years ago
}
2 years ago
func (o *Group) CancelMuteGroupMember(c *gin.Context) {
a2r.Call(group.GroupClient.CancelMuteGroupMember, o.client, c)
2 years ago
}
2 years ago
func (o *Group) MuteGroup(c *gin.Context) {
a2r.Call(group.GroupClient.MuteGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) CancelMuteGroup(c *gin.Context) {
a2r.Call(group.GroupClient.CancelMuteGroup, o.client, c)
2 years ago
}
2 years ago
func (o *Group) SetGroupMemberInfo(c *gin.Context) {
a2r.Call(group.GroupClient.SetGroupMemberInfo, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetGroupAbstractInfo(c *gin.Context) {
a2r.Call(group.GroupClient.GetGroupAbstractInfo, o.client, c)
2 years ago
}
//func (g *Group) SetGroupMemberNickname(c *gin.Context) {
2 years ago
// a2r.Call(group.GroupClient.SetGroupMemberNickname, g.client, c)
//}
//
2 years ago
//func (g *Group) GetGroupAllMemberList(c *gin.Context) {
2 years ago
// a2r.Call(group.GroupClient.GetGroupAllMember, g.client, c)
2 years ago
//}
2 years ago
2 years ago
func (o *Group) GetJoinedSuperGroupList(c *gin.Context) {
a2r.Call(group.GroupClient.GetJoinedSuperGroupList, o.client, c)
2 years ago
}
2 years ago
func (o *Group) GetSuperGroupsInfo(c *gin.Context) {
a2r.Call(group.GroupClient.GetSuperGroupsInfo, o.client, c)
2 years ago
}