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/friend.go

78 lines
1.9 KiB

2 years ago
package api
3 years ago
2 years ago
import (
2 years ago
"OpenIM/internal/api/a2r"
2 years ago
"OpenIM/pkg/common/config"
2 years ago
"OpenIM/pkg/discoveryregistry"
2 years ago
"OpenIM/pkg/proto/friend"
"context"
2 years ago
2 years ago
"github.com/gin-gonic/gin"
)
var _ context.Context // 解决goland编辑器bug
2 years ago
func NewFriend(c discoveryregistry.SvcDiscoveryRegistry) *Friend {
return &Friend{c: c}
2 years ago
}
type Friend struct {
2 years ago
c discoveryregistry.SvcDiscoveryRegistry
2 years ago
}
2 years ago
func (o *Friend) client() (friend.FriendClient, error) {
2 years ago
conn, err := o.c.GetConn(config.Config.RpcRegisterName.OpenImFriendName)
2 years ago
if err != nil {
return nil, err
}
return friend.NewFriendClient(conn), nil
}
2 years ago
func (o *Friend) ApplyToAddFriend(c *gin.Context) {
a2r.Call(friend.FriendClient.ApplyToAddFriend, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) DeleteFriend(c *gin.Context) {
a2r.Call(friend.FriendClient.DeleteFriend, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) GetFriendApplyList(c *gin.Context) {
a2r.Call(friend.FriendClient.GetPaginationFriendsApplyFrom, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) GetSelfApplyList(c *gin.Context) {
a2r.Call(friend.FriendClient.GetPaginationFriendsApplyFrom, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) GetFriendList(c *gin.Context) {
a2r.Call(friend.FriendClient.GetDesignatedFriends, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) RespondFriendApply(c *gin.Context) {
a2r.Call(friend.FriendClient.RespondFriendApply, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) SetFriendRemark(c *gin.Context) {
a2r.Call(friend.FriendClient.SetFriendRemark, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) AddBlack(c *gin.Context) {
a2r.Call(friend.FriendClient.AddBlack, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) GetPaginationBlacks(c *gin.Context) {
a2r.Call(friend.FriendClient.GetPaginationBlacks, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) RemoveBlack(c *gin.Context) {
a2r.Call(friend.FriendClient.RemoveBlack, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) ImportFriends(c *gin.Context) {
a2r.Call(friend.FriendClient.ImportFriends, o.client, c)
2 years ago
}
2 years ago
func (o *Friend) IsFriend(c *gin.Context) {
a2r.Call(friend.FriendClient.IsFriend, o.client, c)
2 years ago
}