package api

import (
	"github.com/gin-gonic/gin"
	"github.com/goWxHook/goWxHook/core"
	"github.com/goWxHook/goWxHook/utils"
)

// voiceToText
//
//	@Summary		语音转文字
//	@Description	语音转文字接口
//	@Tags			语音转文字
//	@Accept			json
//	@Produce		json
//	@Param			body	body		core.VoiceToTextRequest									true	"语音信息"
//	@Response		200		{object}	CommonStringResponse{Data=core.VoiceToTextResponseData}	"{\"code\":0, ....}
//	@Router			/api/v1/voice/to/text [post]
func (w *WebApi) voiceToText(c *gin.Context) {
	var form core.VoiceToTextRequest
	err := c.ShouldBindJSON(&form)
	if err != nil {
		utils.ResponseError(c, err.Error(), nil)
		return
	}
	info, err := w.WxApi.VoiceToText(form)
	if err != nil {
		utils.ResponseError(c, err.Error(), nil)
		return
	}
	utils.ResponseOK(c, "success", info)
	return
}
