1 Star 0 Fork 0

网易易盾/yidun-golang-sdk

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
live_audio_query_task_id_v1_demo.go 1.44 KB
Copy Edit Raw Blame History
fengyunlong authored 2024-01-03 14:06 . 【go语言sdk】第一版v1.0.0
package main
import (
"encoding/json"
"fmt"
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/liveaudio"
request2 "github.com/yidun/yidun-golang-sdk/yidun/service/antispam/liveaudio/query/v1/request"
"log"
"os"
)
func main() {
// Create a AntispamRequester instance, the parameters need to pass in the secretId, secretKey distributed by Antispam.
// 设置易盾内容安全分配的businessId
YourBusinessId := os.Getenv("BUSINESS_ID")
YourSecretId := os.Getenv("SECRET_ID")
YourSecretKey := os.Getenv("SECRET_KEY")
request := request2.NewLiveAudioQueryTaskIdV1Req(YourBusinessId)
// 设置查询开始时间和结束时间
request.SetStartTime(1701414528000)
request.SetEndTime(1701414648138)
request.SetTaskId("YourTaskId")
// 实例化一个 Client,入参需要传入易盾内容安全分配的secretId,secretKey
client := liveaudio.NewLiveAudioClientWithAccessKey(YourSecretId, YourSecretKey)
response, err := client.QueryTaskID(request)
if err != nil {
// 处理错误并打印日志
log.Fatal(err)
}
if response.GetCode() == 200 {
if response.Result == nil {
fmt.Println("response empty")
return
}
data := response.Result
jsonBytes, err := json.Marshal(data)
if err != nil {
fmt.Println("转换为JSON时出错:", err)
return
}
jsonStr := string(jsonBytes)
fmt.Println(jsonStr)
} else {
fmt.Println("error code: ", response.GetCode())
fmt.Println("error msg: ", response.GetMsg())
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/netease_yidun/yidun-golang-sdk.git
git@gitee.com:netease_yidun/yidun-golang-sdk.git
netease_yidun
yidun-golang-sdk
yidun-golang-sdk
main

Search