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
text_single_async_check_demo.go 1.08 KB
Copy Edit Raw Blame History
fengyunlong authored 2024-01-03 14:06 . 【go语言sdk】第一版v1.0.0
package main
import (
"fmt"
"log"
v5 "github.com/yidun/yidun-golang-sdk/yidun/service/antispam/text"
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/text/v5/check/async/single"
)
/**
* 文本单次异步检测demo
*/
func main() {
// 设置易盾内容安全分配的businessId
request := single.NewTextAsyncCheckRequest("YOUR_BUSINESS_ID")
// 实例化一个textClient,入参需要传入易盾内容安全分配的secretId,secretKey
textCheckClient := v5.NewTextClientWithAccessKey("YOUR_SECRET_ID", "YOUR_SECRET_KEY")
request.SetDataID("DATA_ID")
request.SetContent("/ / %【 玉 米 】 , , , 。 。 。")
request.SetCheckLabels("100,200")
response, err := textCheckClient.AsyncCheckText(request)
if err != nil {
// 处理错误并打印日志
log.Fatal(err)
}
if response.GetCode() == 200 {
data := response.Result
fmt.Println("Antispam dealingCount:", *data.DealingCount)
fmt.Println("Antispam taskId:", *data.CheckTexts[0].TaskID)
} else {
fmt.Println("error code: ", response.GetCode())
fmt.Println("error msg: ", response.GetMsg())
}
}
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

53164aa7 5694891 3bd8fe86 5694891