mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
swagger docs
This commit is contained in:
+3697
-13
File diff suppressed because it is too large
Load Diff
+3697
-13
File diff suppressed because it is too large
Load Diff
+2463
-10
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,18 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// @Summary 用户登录
|
||||
// @Description 用户登录
|
||||
// @Tags 鉴权认证
|
||||
// @ID UserRegister
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.UserRegisterReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段 <br> platform为平台ID <br> ex为拓展字段"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.UserRegisterResp
|
||||
// @Failure 500 {object} api.UserRegisterResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.UserRegisterResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /auth/user_register [post]
|
||||
func UserRegister(c *gin.Context) {
|
||||
params := api.UserRegisterReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -73,6 +85,18 @@ func UserRegister(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
// @Summary 用户登录
|
||||
// @Description 获取用户的token
|
||||
// @Tags 鉴权认证
|
||||
// @ID UserToken
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.UserTokenReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段, platform为平台ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.UserTokenResp
|
||||
// @Failure 500 {object} api.UserTokenResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.UserTokenResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /auth/user_token [post]
|
||||
func UserToken(c *gin.Context) {
|
||||
params := api.UserTokenReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -111,6 +135,18 @@ func UserToken(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 解析token
|
||||
// @Description 解析用户token
|
||||
// @Tags 鉴权认证
|
||||
// @ID ParseToken
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.ParseTokenReq true "secret为openIM密钥, 详细见服务端config.yaml secret字段, platform为平台ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.ParseTokenResp
|
||||
// @Failure 500 {object} api.ParseTokenResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.ParseTokenResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /auth/parse_token [post]
|
||||
func ParseToken(c *gin.Context) {
|
||||
params := api.ParseTokenReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -137,6 +173,18 @@ func ParseToken(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 强制登出
|
||||
// @Description 对应的平台强制登出
|
||||
// @Tags 鉴权认证
|
||||
// @ID ForceLogout
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.ForceLogoutReq true "platform为平台ID, fromUserID为要执行强制登出的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.ForceLogoutResp
|
||||
// @Failure 500 {object} api.ForceLogoutResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.ForceLogoutResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /auth/force_logout [post]
|
||||
func ForceLogout(c *gin.Context) {
|
||||
params := api.ForceLogoutReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
||||
@@ -16,6 +16,18 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// @Summary 根据seq列表删除消息
|
||||
// @Description 根据seq列表删除消息
|
||||
// @Tags 消息相关
|
||||
// @ID DelMsg
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.DelMsgReq true "userID为要删除的用户ID <br> seqList为seq列表"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.DelMsgResp
|
||||
// @Failure 500 {object} api.DelMsgResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.DelMsgResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /msg/del_msg [post]
|
||||
func DelMsg(c *gin.Context) {
|
||||
var (
|
||||
req api.DelMsgReq
|
||||
@@ -30,6 +42,17 @@ func DelMsg(c *gin.Context) {
|
||||
if err := utils.CopyStructFields(&reqPb, &req); err != nil {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, reqPb.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
|
||||
if grpcConn == nil {
|
||||
errMsg := req.OperationID + " getcdv3.GetConn == nil"
|
||||
@@ -50,6 +73,18 @@ func DelMsg(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 清空用户消息
|
||||
// @Description 清空用户消息
|
||||
// @Tags 消息相关
|
||||
// @ID ClearMsg
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.CleanUpMsgReq true "userID为要清空的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.CleanUpMsgResp
|
||||
// @Failure 500 {object} api.CleanUpMsgResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.CleanUpMsgResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /msg/clear_msg [post]
|
||||
func ClearMsg(c *gin.Context) {
|
||||
params := api.CleanUpMsgReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
||||
@@ -16,6 +16,18 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// @Summary 添加黑名单
|
||||
// @Description 添加黑名单
|
||||
// @Tags 好友相关
|
||||
// @ID AddBlack
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.AddBlacklistReq true "fromUserID为设置的用户, toUserID为被设置的用户"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.AddBlacklistResp
|
||||
// @Failure 500 {object} api.AddBlacklistResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.AddBlacklistResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/add_black [post]
|
||||
func AddBlack(c *gin.Context) {
|
||||
params := api.AddBlacklistReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -49,6 +61,18 @@ func AddBlack(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 批量加好友
|
||||
// @Description 批量加好友
|
||||
// @Tags 好友相关
|
||||
// @ID ImportFriend
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.ImportFriendReq true "fromUserID批量加好友的用户ID, friendUserIDList为"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.ImportFriendResp "data列表中对象的result-1为添加该用户失败, 0为成功"
|
||||
// @Failure 500 {object} api.ImportFriendResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.ImportFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/import_friend [post]
|
||||
func ImportFriend(c *gin.Context) {
|
||||
params := api.ImportFriendReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -97,6 +121,18 @@ func ImportFriend(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 添加好友
|
||||
// @Description 添加好友
|
||||
// @Tags 好友相关
|
||||
// @ID AddFriend
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.AddFriendReq true "reqMsg为申请信息, fromUserID为申请用户, toUserID为被添加用户"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.AddFriendResp
|
||||
// @Failure 500 {object} api.AddFriendResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.AddFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/add_friend [post]
|
||||
func AddFriend(c *gin.Context) {
|
||||
params := api.AddFriendReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -114,7 +150,7 @@ func AddFriend(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -140,6 +176,18 @@ func AddFriend(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 同意/拒绝好友请求
|
||||
// @Description 同意/拒绝好友请求
|
||||
// @Tags 好友相关
|
||||
// @ID AddFriendResponse
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.AddFriendResponseReq true "fromUserID同意/拒绝的用户ID, toUserID为申请用户, handleMsg为处理信息, flag为具体操作, 1为同意, 2为拒绝"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.AddFriendResponseResp
|
||||
// @Failure 500 {object} api.AddFriendResponseResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.AddFriendResponseResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/add_friend_response [post]
|
||||
func AddFriendResponse(c *gin.Context) {
|
||||
params := api.AddFriendResponseReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -158,7 +206,7 @@ func AddFriendResponse(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -186,6 +234,18 @@ func AddFriendResponse(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 删除好友
|
||||
// @Description 删除好友
|
||||
// @Tags 好友相关
|
||||
// @ID DeleteFriend
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.DeleteFriendReq true "fromUserID为操作用户, toUserID为被删除用户"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.DeleteFriendResp
|
||||
// @Failure 500 {object} api.DeleteFriendResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.DeleteFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/delete_friend [post]
|
||||
func DeleteFriend(c *gin.Context) {
|
||||
params := api.DeleteFriendReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -228,6 +288,18 @@ func DeleteFriend(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 获取黑名单列表
|
||||
// @Description 获取黑名单列表
|
||||
// @Tags 好友相关
|
||||
// @ID GetBlacklist
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetBlackListReq true "fromUserID要获取黑名单的用户"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetBlackListResp
|
||||
// @Failure 500 {object} api.GetBlackListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetBlackListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/get_black_list [post]
|
||||
func GetBlacklist(c *gin.Context) {
|
||||
params := api.GetBlackListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -244,7 +316,7 @@ func GetBlacklist(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -276,6 +348,18 @@ func GetBlacklist(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 设置好友备注
|
||||
// @Description 设置好友备注
|
||||
// @Tags 好友相关
|
||||
// @ID SetFriendRemark
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.SetFriendRemarkReq true "fromUserID为设置的用户, toUserID为被设置的用户, remark为好友备注"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.SetFriendRemarkResp
|
||||
// @Failure 500 {object} api.SetFriendRemarkResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.SetFriendRemarkResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/set_friend_remark [post]
|
||||
func SetFriendRemark(c *gin.Context) {
|
||||
params := api.SetFriendRemarkReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -319,6 +403,18 @@ func SetFriendRemark(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 把用户移除黑名单
|
||||
// @Description 把用户移除黑名单
|
||||
// @Tags 好友相关
|
||||
// @ID RemoveBlack
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.RemoveBlackListReq true "fromUserID要获取黑名单的用户"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.RemoveBlackListResp
|
||||
// @Failure 500 {object} api.RemoveBlackListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.RemoveBlackListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/remove_black [post]
|
||||
func RemoveBlack(c *gin.Context) {
|
||||
params := api.RemoveBlackListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -335,7 +431,7 @@ func RemoveBlack(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -360,6 +456,18 @@ func RemoveBlack(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 检查用户之间是否为好友
|
||||
// @Description 检查用户之间是否为好友
|
||||
// @Tags 好友相关
|
||||
// @ID IsFriend
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.IsFriendReq true "fromUserID为请求用户, toUserID为要检查的用户"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.IsFriendResp
|
||||
// @Failure 500 {object} api.IsFriendResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.IsFriendResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/is_friend [post]
|
||||
func IsFriend(c *gin.Context) {
|
||||
params := api.IsFriendReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -376,7 +484,7 @@ func IsFriend(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -403,6 +511,18 @@ func IsFriend(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 获取用户的好友列表
|
||||
// @Description 获取用户的好友列表
|
||||
// @Tags 好友相关
|
||||
// @ID GetFriendList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetFriendListReq true "fromUserID为要获取好友列表的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetFriendListResp
|
||||
// @Failure 500 {object} api.GetFriendListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetFriendListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/get_friend_list [post]
|
||||
func GetFriendList(c *gin.Context) {
|
||||
params := api.GetFriendListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -447,6 +567,18 @@ func GetFriendList(c *gin.Context) {
|
||||
//c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 获取好友申请列表
|
||||
// @Description 删除好友
|
||||
// @Tags 好友相关
|
||||
// @ID GetFriendApplyList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetFriendApplyListReq true "fromUserID为要获取申请列表的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetFriendApplyListResp
|
||||
// @Failure 500 {object} api.GetFriendApplyListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetFriendApplyListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/get_friend_apply_list [post]
|
||||
func GetFriendApplyList(c *gin.Context) {
|
||||
params := api.GetFriendApplyListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -463,7 +595,7 @@ func GetFriendApplyList(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -491,6 +623,18 @@ func GetFriendApplyList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 获取自己的好友申请列表
|
||||
// @Description 获取自己的好友申请列表
|
||||
// @Tags 好友相关
|
||||
// @ID GetSelfFriendApplyList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetSelfApplyListReq true "fromUserID为自己的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetSelfApplyListResp
|
||||
// @Failure 500 {object} api.GetSelfApplyListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetSelfApplyListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /friend/get_self_friend_apply_list [post]
|
||||
func GetSelfFriendApplyList(c *gin.Context) {
|
||||
params := api.GetSelfApplyListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -507,7 +651,7 @@ func GetSelfFriendApplyList(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.CommID.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.CommID.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+260
-17
@@ -20,6 +20,18 @@ import (
|
||||
jsonData "Open_IM/internal/utils"
|
||||
)
|
||||
|
||||
// @Summary 把用户踢出群组
|
||||
// @Description 把用户踢出群组
|
||||
// @Tags 群组相关
|
||||
// @ID KickGroupMember
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.KickGroupMemberReq true "GroupID为要操作的群ID <br> kickedUserIDList为要踢出的群用户ID <br> reason为原因"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.KickGroupMemberResp "result为结果码, -1为失败, 0为成功"
|
||||
// @Failure 500 {object} api.KickGroupMemberResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.KickGroupMemberResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/kick_group [post]
|
||||
func KickGroupMember(c *gin.Context) {
|
||||
params := api.KickGroupMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -72,6 +84,18 @@ func KickGroupMember(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, memberListResp)
|
||||
}
|
||||
|
||||
// @Summary 获取群成员信息
|
||||
// @Description 获取群成员信息
|
||||
// @Tags 群组相关
|
||||
// @ID GetGroupMembersInfo
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetGroupMembersInfoReq true "memberList为要获取群成员的群ID列表"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetGroupMembersInfoResp{data=[]open_im_sdk.GroupMemberFullInfo}
|
||||
// @Failure 500 {object} api.GetGroupMembersInfoResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetGroupMembersInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/get_group_members_info [post]
|
||||
func GetGroupMembersInfo(c *gin.Context) {
|
||||
params := api.GetGroupMembersInfoReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -161,6 +185,18 @@ func GetGroupMemberList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, memberListResp)
|
||||
}
|
||||
|
||||
// @Summary 获取全部群成员列表
|
||||
// @Description 获取全部群成员列表
|
||||
// @Tags 群组相关
|
||||
// @ID GetGroupAllMemberList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetGroupAllMemberReq true "GroupID为要获取群成员的群ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetGroupAllMemberResp{data=[]open_im_sdk.GroupMemberFullInfo}
|
||||
// @Failure 500 {object} api.GetGroupAllMemberResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetGroupAllMemberResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/get_group_all_member_list [post]
|
||||
func GetGroupAllMemberList(c *gin.Context) {
|
||||
params := api.GetGroupAllMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -204,6 +240,18 @@ func GetGroupAllMemberList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, memberListResp)
|
||||
}
|
||||
|
||||
// @Summary 获取用户加入群列表
|
||||
// @Description 获取用户加入群列表
|
||||
// @Tags 群组相关
|
||||
// @ID GetJoinedGroupList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetJoinedGroupListReq true "fromUserID为要获取的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetJoinedGroupListResp{data=[]open_im_sdk.GroupInfo}
|
||||
// @Failure 500 {object} api.GetJoinedGroupListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetJoinedGroupListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/get_joined_group_list [post]
|
||||
func GetJoinedGroupList(c *gin.Context) {
|
||||
params := api.GetJoinedGroupListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -247,6 +295,18 @@ func GetJoinedGroupList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, GroupListResp)
|
||||
}
|
||||
|
||||
// @Summary 将用户拉入群组
|
||||
// @Description 将用户拉入群组
|
||||
// @Tags 群组相关
|
||||
// @ID InviteUserToGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.InviteUserToGroupReq true "groupID为要拉进的群组ID <br> invitedUserIDList为要获取群成员的群ID列表 <br> reason为原因"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.InviteUserToGroupResp "result为结果码, -1为失败, 0为成功""
|
||||
// @Failure 500 {object} api.InviteUserToGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.InviteUserToGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/invite_user_to_group [post]
|
||||
func InviteUserToGroup(c *gin.Context) {
|
||||
params := api.InviteUserToGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -297,6 +357,18 @@ func InviteUserToGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 创建群组
|
||||
// @Description 创建群组
|
||||
// @Tags 群组相关
|
||||
// @ID CreateGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.CreateGroupReq true "ownerUserID为群主ID <br> ex为群扩展字段 <br> roleLevel为群员角色,1为普通用户 2为群主 3为管理员"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.CreateGroupResp{data=open_im_sdk.GroupInfo}
|
||||
// @Failure 500 {object} api.CreateGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.CreateGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/create_group [post]
|
||||
func CreateGroup(c *gin.Context) {
|
||||
params := api.CreateGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -318,7 +390,7 @@ func CreateGroup(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -351,7 +423,18 @@ func CreateGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// 群主或管理员收到的
|
||||
// @Summary 获取用户收到的加群信息列表
|
||||
// @Description 获取用户收到的加群信息列表
|
||||
// @Tags 群组相关
|
||||
// @ID GetRecvGroupApplicationList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetGroupApplicationListReq true "fromUserID为要获取的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetGroupApplicationListResp
|
||||
// @Failure 500 {object} api.GetGroupApplicationListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetGroupApplicationListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/get_recv_group_applicationList [post]
|
||||
func GetRecvGroupApplicationList(c *gin.Context) {
|
||||
params := api.GetGroupApplicationListReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -361,13 +444,15 @@ func GetRecvGroupApplicationList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetGroupApplicationListReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
//var ok bool
|
||||
//ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
//if !ok {
|
||||
// log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
// return
|
||||
//}
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
@@ -391,6 +476,18 @@ func GetRecvGroupApplicationList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 获取用户加群申请列表
|
||||
// @Description 获取用户加群申请列表
|
||||
// @Tags 群组相关
|
||||
// @ID GetUserReqGroupApplicationList
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetUserReqGroupApplicationListReq true "userID为要获取的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetGroupApplicationListResp
|
||||
// @Failure 500 {object} api.GetGroupApplicationListResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetGroupApplicationListResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/get_user_req_group_applicationList [post]
|
||||
func GetUserReqGroupApplicationList(c *gin.Context) {
|
||||
var params api.GetUserReqGroupApplicationListReq
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -400,12 +497,15 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
|
||||
}
|
||||
req := &rpc.GetUserReqApplicationListReq{}
|
||||
utils.CopyStructFields(req, params)
|
||||
//ok, req.OpUserID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"))
|
||||
//if !ok {
|
||||
// log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
|
||||
// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
|
||||
// return
|
||||
//}
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String())
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID)
|
||||
if etcdConn == nil {
|
||||
@@ -428,6 +528,18 @@ func GetUserReqGroupApplicationList(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 通过群ID列表获取群信息
|
||||
// @Description 通过群ID列表获取群信息
|
||||
// @Tags 群组相关
|
||||
// @ID GetGroupsInfo
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetGroupInfoReq true "groupIDList为群ID列表"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetGroupInfoResp
|
||||
// @Failure 500 {object} api.GetGroupInfoResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetGroupInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/get_groups_info [post]
|
||||
func GetGroupsInfo(c *gin.Context) {
|
||||
params := api.GetGroupInfoReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -470,7 +582,18 @@ func GetGroupsInfo(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
//process application
|
||||
// @Summary 处理加群消息
|
||||
// @Description 处理加群消息
|
||||
// @Tags 群组相关
|
||||
// @ID ApplicationGroupResponse
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.ApplicationGroupResponseReq true "groupID为要处理的群ID <br> fromUserID为要处理的用户ID <br> handleMsg为处理结果信息 <br> handleResult为处理结果 1为同意加群 2为拒绝加群"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.ApplicationGroupResponseResp
|
||||
// @Failure 500 {object} api.ApplicationGroupResponseResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.ApplicationGroupResponseResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/group_application_response [post]
|
||||
func ApplicationGroupResponse(c *gin.Context) {
|
||||
params := api.ApplicationGroupResponseReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -513,6 +636,18 @@ func ApplicationGroupResponse(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 加入群聊
|
||||
// @Description 加入群聊
|
||||
// @Tags 群组相关
|
||||
// @ID JoinGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.JoinGroupReq true "reqMessage为申请进群信息"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.JoinGroupResp
|
||||
// @Failure 500 {object} api.JoinGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.JoinGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/join_group [post]
|
||||
func JoinGroup(c *gin.Context) {
|
||||
params := api.JoinGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -529,7 +664,7 @@ func JoinGroup(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -554,6 +689,18 @@ func JoinGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 退出群聊
|
||||
// @Description 退出群聊
|
||||
// @Tags 群组相关
|
||||
// @ID QuitGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.QuitGroupReq true "groupID为要退出的群ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.QuitGroupResp
|
||||
// @Failure 500 {object} api.QuitGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.QuitGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/quit_group [post]
|
||||
func QuitGroup(c *gin.Context) {
|
||||
params := api.QuitGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -595,6 +742,18 @@ func QuitGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 设置群信息
|
||||
// @Description 设置群信息
|
||||
// @Tags 群组相关
|
||||
// @ID SetGroupInfo
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.SetGroupInfoReq true "notification为群介绍 <br> introduction为群公告 <br> needVerification为加群验证 0为申请需要同意 邀请直接进 1为所有人进群需要验证,除了群主管理员邀请进群 2为直接进群"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.SetGroupInfoResp
|
||||
// @Failure 500 {object} api.SetGroupInfoResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.SetGroupInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/set_group_info [post]
|
||||
func SetGroupInfo(c *gin.Context) {
|
||||
params := api.SetGroupInfoReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -641,6 +800,18 @@ func SetGroupInfo(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp)
|
||||
}
|
||||
|
||||
// @Summary 转让群主
|
||||
// @Description 转让群主
|
||||
// @Tags 群组相关
|
||||
// @ID TransferGroupOwner
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.TransferGroupOwnerReq true "GroupID为要操作的群ID <br> oldOwnerUserID为老群主ID <br> newOwnerUserID为新群主ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.TransferGroupOwnerResp
|
||||
// @Failure 500 {object} api.TransferGroupOwnerResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.TransferGroupOwnerResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/transfer_group [post]
|
||||
func TransferGroupOwner(c *gin.Context) {
|
||||
params := api.TransferGroupOwnerReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -683,6 +854,18 @@ func TransferGroupOwner(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 解散群组
|
||||
// @Description 解散群组
|
||||
// @Tags 群组相关
|
||||
// @ID DismissGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.DismissGroupReq true "groupID为要解散的群组ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.DismissGroupResp
|
||||
// @Failure 500 {object} api.DismissGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.DismissGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/dismiss_group [post]
|
||||
func DismissGroup(c *gin.Context) {
|
||||
params := api.DismissGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -725,6 +908,18 @@ func DismissGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 禁言群成员
|
||||
// @Description 禁言群成员
|
||||
// @Tags 群组相关
|
||||
// @ID MuteGroupMember
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.MuteGroupMemberReq true "groupID为群组ID <br> userID为要禁言的用户ID <br> mutedSeconds为禁言秒数"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.DismissGroupResp
|
||||
// @Failure 500 {object} api.DismissGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.DismissGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/mute_group_member [post]
|
||||
func MuteGroupMember(c *gin.Context) {
|
||||
params := api.MuteGroupMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -767,6 +962,18 @@ func MuteGroupMember(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 取消禁言群成员
|
||||
// @Description 取消禁言群成员
|
||||
// @Tags 群组相关
|
||||
// @ID CancelMuteGroupMember
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.CancelMuteGroupMemberReq true "groupID为群组ID <br> userID为要取消禁言的用户ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.CancelMuteGroupMemberResp
|
||||
// @Failure 500 {object} api.CancelMuteGroupMemberResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.CancelMuteGroupMemberResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/cancel_mute_group_member [post]
|
||||
func CancelMuteGroupMember(c *gin.Context) {
|
||||
params := api.CancelMuteGroupMemberReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -809,6 +1016,18 @@ func CancelMuteGroupMember(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 禁言群组
|
||||
// @Description 禁言群组
|
||||
// @Tags 群组相关
|
||||
// @ID MuteGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.MuteGroupReq true "groupID为群组ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.MuteGroupResp
|
||||
// @Failure 500 {object} api.MuteGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.MuteGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/mute_group [post]
|
||||
func MuteGroup(c *gin.Context) {
|
||||
params := api.MuteGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -851,6 +1070,18 @@ func MuteGroup(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 取消禁言群组
|
||||
// @Description 取消禁言群组
|
||||
// @Tags 群组相关
|
||||
// @ID CancelMuteGroup
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.CancelMuteGroupReq true "groupID为群组ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.CancelMuteGroupResp
|
||||
// @Failure 500 {object} api.CancelMuteGroupResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.CancelMuteGroupResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/cancel_mute_group [post]
|
||||
func CancelMuteGroup(c *gin.Context) {
|
||||
params := api.CancelMuteGroupReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
@@ -937,6 +1168,18 @@ func SetGroupMemberNickname(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
// @Summary 修改群成员信息
|
||||
// @Description 修改群成员信息
|
||||
// @Tags 群组相关
|
||||
// @ID SetGroupMemberInfo
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.SetGroupMemberInfoReq true "除了operationID, userID, groupID其他参数可选"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.SetGroupMemberInfoResp
|
||||
// @Failure 500 {object} api.SetGroupMemberInfoResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.SetGroupMemberInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /group/set_group_member_info [post]
|
||||
func SetGroupMemberInfo(c *gin.Context) {
|
||||
var (
|
||||
req api.SetGroupMemberInfoReq
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package apiThird
|
||||
|
||||
import (
|
||||
apiStruct "Open_IM/pkg/base_info"
|
||||
api "Open_IM/pkg/base_info"
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
|
||||
@@ -17,10 +17,24 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// @Summary minio上传文件(web api)
|
||||
// @Description minio上传文件(web api), 请注意本api请求为form并非json
|
||||
// @Tags 第三方服务相关
|
||||
// @ID MinioUploadFile
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param file formData file true "要上传的文件文件"
|
||||
// @Param fileType formData int true "文件类型"
|
||||
// @Param operationID formData string true "操作唯一ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.MinioUploadFileResp ""
|
||||
// @Failure 500 {object} api.MinioUploadFileResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.MinioUploadFileResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /third/minio_upload [post]
|
||||
func MinioUploadFile(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.MinioUploadFileReq
|
||||
resp apiStruct.MinioUploadFileResp
|
||||
req api.MinioUploadFileReq
|
||||
resp api.MinioUploadFileResp
|
||||
)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -41,7 +55,7 @@ func MinioUploadFile(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -100,8 +114,8 @@ func MinioUploadFile(c *gin.Context) {
|
||||
|
||||
func MinioStorageCredential(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.MinioStorageCredentialReq
|
||||
resp apiStruct.MiniostorageCredentialResp
|
||||
req api.MinioStorageCredentialReq
|
||||
resp api.MiniostorageCredentialResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
@@ -151,8 +165,8 @@ func MinioStorageCredential(c *gin.Context) {
|
||||
|
||||
func UploadUpdateApp(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.UploadUpdateAppReq
|
||||
resp apiStruct.UploadUpdateAppResp
|
||||
req api.UploadUpdateAppReq
|
||||
resp api.UploadUpdateAppResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
@@ -204,8 +218,8 @@ func UploadUpdateApp(c *gin.Context) {
|
||||
|
||||
func GetDownloadURL(c *gin.Context) {
|
||||
var (
|
||||
req apiStruct.GetDownloadURLReq
|
||||
resp apiStruct.GetDownloadURLResp
|
||||
req api.GetDownloadURLReq
|
||||
resp api.GetDownloadURLResp
|
||||
)
|
||||
defer func() {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
|
||||
@@ -30,7 +30,7 @@ func TencentCloudStorageCredential(c *gin.Context) {
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ func SetGlobalRecvMessageOpt(c *gin.Context) {
|
||||
// @Param token header string true "im token"
|
||||
// @Param req body api.GetSelfUserInfoReq true "请求体"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.GetSelfUserInfoResp
|
||||
// @Success 0 {object} api.GetSelfUserInfoResp{data=open_im_sdk.UserInfo}
|
||||
// @Failure 500 {object} api.GetSelfUserInfoResp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.GetSelfUserInfoResp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /user/get_self_user_info [post]
|
||||
|
||||
@@ -95,7 +95,7 @@ type CreateGroupReq struct {
|
||||
type CreateGroupResp struct {
|
||||
CommResp
|
||||
GroupInfo open_im_sdk.GroupInfo `json:"-"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Data map[string]interface{} `json:"data" swaggerignore:"true"`
|
||||
}
|
||||
|
||||
type GetGroupApplicationListReq struct {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package base_info
|
||||
|
||||
type DelMsgReq struct {
|
||||
OpUserID string `json:"opUserID,omitempty"`
|
||||
UserID string `json:"userID,omitempty"`
|
||||
SeqList []uint32 `json:"seqList,omitempty"`
|
||||
OperationID string `json:"operationID,omitempty"`
|
||||
UserID string `json:"userID,omitempty" binding:"required"`
|
||||
SeqList []uint32 `json:"seqList,omitempty" binding:"required"`
|
||||
OperationID string `json:"operationID,omitempty" binding:"required"`
|
||||
}
|
||||
|
||||
type DelMsgResp struct {
|
||||
|
||||
@@ -11,7 +11,7 @@ type GetUsersInfoReq struct {
|
||||
type GetUsersInfoResp struct {
|
||||
CommResp
|
||||
UserInfoList []*open_im_sdk.PublicUserInfo `json:"-"`
|
||||
Data []map[string]interface{} `json:"data"`
|
||||
Data []map[string]interface{} `json:"data" swaggerignore:"true"`
|
||||
}
|
||||
|
||||
type UpdateSelfUserInfoReq struct {
|
||||
@@ -36,7 +36,7 @@ type GetSelfUserInfoReq struct {
|
||||
type GetSelfUserInfoResp struct {
|
||||
CommResp
|
||||
UserInfo *open_im_sdk.UserInfo `json:"-"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Data map[string]interface{} `json:"data" swaggerignore:"true"`
|
||||
}
|
||||
|
||||
type GetFriendIDListFromCacheReq struct {
|
||||
|
||||
Reference in New Issue
Block a user