api to rpc

This commit is contained in:
withchao
2023-02-27 14:44:14 +08:00
parent 03ccd0131a
commit 0411a5045b
9 changed files with 173 additions and 16 deletions
+8 -11
View File
@@ -1,14 +1,19 @@
package group
import (
"OpenIM/internal/api2rpc"
"OpenIM/internal/a2r"
"OpenIM/pkg/apistruct"
"OpenIM/pkg/common/config"
"OpenIM/pkg/proto/group"
"context"
"github.com/OpenIMSDK/openKeeper"
"github.com/gin-gonic/gin"
)
func _() {
context.Background()
}
type Group struct {
zk *openKeeper.ZkClient
}
@@ -22,17 +27,9 @@ func (g *Group) getGroupClient() (group.GroupClient, error) {
}
func (g *Group) KickGroupMember(c *gin.Context) {
api2rpc.New(&apistruct.KickGroupMemberReq{}, &apistruct.KickGroupMemberResp{}, group.GroupClient.KickGroupMember).Call(c, g.getGroupClient)
a2r.Call(&apistruct.KickGroupMemberReq{}, &apistruct.KickGroupMemberResp{}, group.GroupClient.KickGroupMember, g.getGroupClient, c, nil, nil)
}
func (g *Group) GetGroupMembersInfo(c *gin.Context) {
api2rpc.New(&apistruct.GetGroupMembersInfoReq{}, &apistruct.GetGroupMembersInfoResp{}, group.GroupClient.GetGroupMembersInfo).Call(c, g.getGroupClient)
a2r.Call1(group.GroupClient.GetGroupMembersInfo, g.getGroupClient, c)
}
//func GetGroupMembersInfo(c *gin.Context) {
// api2rpc.New(&apistruct.GetGroupMembersInfoReq{}, &apistruct.GetGroupMembersInfoResp{}, group.GroupClient.GetGroupMembersInfo).Call(c, g.getGroupClient)
//}
//func New[A, B, C, D any, E any](apiReq *A, apiResp *B, rpc func(client E, ctx context.Context, req *C, options ...grpc.CallOption) (*D, error)) {
//
//}