2023-02-28 14:20:26 +08:00
|
|
|
package api
|
2021-12-23 17:22:49 +08:00
|
|
|
|
2023-02-28 11:38:05 +08:00
|
|
|
import (
|
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/discoveryregistry"
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/friend"
|
2023-06-20 22:12:01 +08:00
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
2023-03-08 17:29:03 +08:00
|
|
|
|
2023-02-28 11:38:05 +08:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
type FriendApi rpcclient.Friend
|
2023-02-28 11:38:05 +08:00
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func NewFriendApi(discov discoveryregistry.SvcDiscoveryRegistry) FriendApi {
|
|
|
|
|
return FriendApi(*rpcclient.NewFriend(discov))
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) ApplyToAddFriend(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.ApplyToAddFriend, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) RespondFriendApply(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.RespondFriendApply, o.Client, c)
|
2023-03-16 20:21:10 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) DeleteFriend(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.DeleteFriend, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) GetFriendApplyList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.GetPaginationFriendsApplyTo, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) GetSelfApplyList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.GetPaginationFriendsApplyFrom, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) GetFriendList(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.GetPaginationFriends, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) SetFriendRemark(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.SetFriendRemark, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) AddBlack(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.AddBlack, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) GetPaginationBlacks(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.GetPaginationBlacks, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) RemoveBlack(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.RemoveBlack, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) ImportFriends(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.ImportFriends, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|
|
|
|
|
|
2023-06-20 22:12:01 +08:00
|
|
|
func (o *FriendApi) IsFriend(c *gin.Context) {
|
2023-06-20 21:15:23 +08:00
|
|
|
a2r.Call(friend.FriendClient.IsFriend, o.Client, c)
|
2023-02-28 11:38:05 +08:00
|
|
|
}
|