280 lines
7.9 KiB
Go
280 lines
7.9 KiB
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/goWxHook/goWxHook/core"
|
|
"github.com/goWxHook/goWxHook/utils"
|
|
)
|
|
|
|
// videoMomentInit
|
|
//
|
|
// @Summary 视频号初始化
|
|
// @Description 视频号初始化接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Response 200 {object} CommonStringResponse{Data=core.VideoMomentInitResponseData} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/init [post]
|
|
func (w *WebApi) videoMomentInit(c *gin.Context) {
|
|
info, err := w.WxApi.VideoMomentInit()
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentSearch
|
|
//
|
|
// @Summary 搜索视频号
|
|
// @Description 搜索视频号接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentSearchRequest true "搜索信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=interface{}} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/search [post]
|
|
func (w *WebApi) videoMomentSearch(c *gin.Context) {
|
|
var form core.VideoMomentSearchRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentSearch(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentUserHome
|
|
//
|
|
// @Summary 视频号用户主页
|
|
// @Description 视频号用户主页接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentUserHomeRequest true "用户信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=interface{}} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/user/home [post]
|
|
func (w *WebApi) videoMomentUserHome(c *gin.Context) {
|
|
var form core.VideoMomentUserHomeRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentUserHome(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentVideoDetail
|
|
//
|
|
// @Summary 查看视频详细信息(包含评论)
|
|
// @Description 查看视频详细信息(包含评论)接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentVideoDetailRequest true "视频信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=interface{}} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/video/detail [post]
|
|
func (w *WebApi) videoMomentVideoDetail(c *gin.Context) {
|
|
var form core.VideoMomentVideoDetailRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentVideoDetail(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentFollow
|
|
//
|
|
// @Summary 关注视频号
|
|
// @Description 关注视频号接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentFollowRequest true "关注信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=core.VideoMomentFollowResponseData} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/follow [post]
|
|
func (w *WebApi) videoMomentFollow(c *gin.Context) {
|
|
var form core.VideoMomentFollowRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentFollow(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentLike
|
|
//
|
|
// @Summary 点赞视频
|
|
// @Description 点赞视频接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentLikeRequest true "点赞信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=core.VideoMomentLikeResponseData} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/like [post]
|
|
func (w *WebApi) videoMomentLike(c *gin.Context) {
|
|
var form core.VideoMomentLikeRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentLike(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentGetSessionId
|
|
//
|
|
// @Summary 获取私信sessionId
|
|
// @Description 获取私信sessionId接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentGetSessionIdRequest true "sessionId信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=core.VideoMomentGetSessionIdResponseData} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/get/session_id [post]
|
|
func (w *WebApi) videoMomentGetSessionId(c *gin.Context) {
|
|
var form core.VideoMomentGetSessionIdRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentGetSessionId(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentSendMsg
|
|
//
|
|
// @Summary 发送私信
|
|
// @Description 发送私信接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentSendMsgRequest true "发送信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=core.VideoMomentSendMsgResponseData} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/send/msg [post]
|
|
func (w *WebApi) videoMomentSendMsg(c *gin.Context) {
|
|
var form core.VideoMomentSendMsgRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentSendMsg(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentCreateVirtualNickName
|
|
//
|
|
// @Summary 创建虚拟昵称
|
|
// @Description 创建虚拟昵称接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentCreateVirtualNickNameRequest true "昵称信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=interface{}} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/create/virtual_nickname [post]
|
|
func (w *WebApi) videoMomentCreateVirtualNickName(c *gin.Context) {
|
|
var form core.VideoMomentCreateVirtualNickNameRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentCreateVirtualNickName(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentSwitchVirtualNickName
|
|
//
|
|
// @Summary 切换虚拟昵称
|
|
// @Description 切换虚拟昵称接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param body body core.VideoMomentSwitchVirtualNickNameRequest true "昵称信息"
|
|
// @Response 200 {object} CommonStringResponse{Data=interface{}} "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/switch/virtual_nickname [post]
|
|
func (w *WebApi) videoMomentSwitchVirtualNickName(c *gin.Context) {
|
|
var form core.VideoMomentSwitchVirtualNickNameRequest
|
|
err := c.ShouldBindJSON(&form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
info, err := w.WxApi.VideoMomentSwitchVirtualNickName(form)
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", info)
|
|
return
|
|
}
|
|
|
|
// videoMomentDeleteVirtualNickName
|
|
//
|
|
// @Summary 删除虚拟昵称
|
|
// @Description 删除虚拟昵称接口
|
|
// @Tags 视频号
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Response 200 {object} CommonStringResponse "{\"code\":0, ....}
|
|
// @Router /api/v1/video_moment/delete/virtual_nickname [post]
|
|
func (w *WebApi) videoMomentDeleteVirtualNickName(c *gin.Context) {
|
|
err := w.WxApi.VideoMomentDeleteVirtualNickName()
|
|
if err != nil {
|
|
utils.ResponseError(c, err.Error(), nil)
|
|
return
|
|
}
|
|
utils.ResponseOK(c, "success", nil)
|
|
return
|
|
}
|