-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
主站任务/公众号/微博任务更新接口
- Loading branch information
谢铁藜
authored and
fengyunlong
committed
Mar 18, 2024
1 parent
baa8acf
commit f338f9b
Showing
16 changed files
with
559 additions
and
37 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
yidun/demo/antispam/crawler/v1/crawler_job_update/crawler_job_update_demo.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
crawler "github.com/yidun/yidun-golang-sdk/yidun/service/antispam/crawler" | ||
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/crawler/v1/update" | ||
) | ||
|
||
/** | ||
* 网站解决方案-主站检测任务更新接口 | ||
*/ | ||
func main() { | ||
// 构造CrawlerJobUpdateV1Request请求对象 | ||
request := update.NewCrawlerJobUpdateV1Request() | ||
|
||
url := "https://news.163.com" | ||
request.SetSiteUrl(url) | ||
request.SetJobId(123123) | ||
request.SetSliceStartTime(123123123) | ||
request.SetSiteName("ceshi") | ||
|
||
// 实例化一个crawlerClient,入参需要传入易盾内容安全分配的secretId,secretKey | ||
crawlerClient := crawler.NewCrawlerClientWithAccessKey("YOUR_SECRET_ID", "YOUR_SECRET_KEY") | ||
|
||
response, err := crawlerClient.CrawlerJobUpdate(request) | ||
if err != nil { | ||
// 处理错误并打印日志 | ||
log.Fatal(err) | ||
} | ||
|
||
if response.GetCode() == 200 { | ||
// do something | ||
fmt.Printf("res msg:%s", response.GetMsg()) | ||
} else { | ||
fmt.Println("error code: ", response.GetCode()) | ||
fmt.Println("error msg: ", response.GetMsg()) | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
yidun/demo/antispam/crawler/v1/official_accounts_update/official_accounts_update_demo.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
crawler "github.com/yidun/yidun-golang-sdk/yidun/service/antispam/crawler" | ||
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/crawler/v1/update" | ||
) | ||
|
||
/** | ||
* 网站解决方案-公众号检测任务更新接口 | ||
*/ | ||
func main() { | ||
// 构造OfficialAccountsUpdateV1Request请求对象 | ||
request := update.NewOfficialAccountsUpdateV1Request() | ||
|
||
request.SetOfficialAccountName("123") | ||
request.SetJobId(123123) | ||
request.SetStartTime(123123123) | ||
request.SetWechatAccount("ceshi") | ||
|
||
// 实例化一个crawlerClient,入参需要传入易盾内容安全分配的secretId,secretKey | ||
crawlerClient := crawler.NewCrawlerClientWithAccessKey("YOUR_SECRET_ID", "YOUR_SECRET_KEY") | ||
|
||
response, err := crawlerClient.OfficialAccountsUpdate(request) | ||
if err != nil { | ||
// 处理错误并打印日志 | ||
log.Fatal(err) | ||
} | ||
|
||
if response.GetCode() == 200 { | ||
// do something | ||
fmt.Printf("res msg:%s", response.GetMsg()) | ||
} else { | ||
fmt.Println("error code: ", response.GetCode()) | ||
fmt.Println("error msg: ", response.GetMsg()) | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
yidun/demo/antispam/crawler/v1/weibo_job_update/weibo_job_update_demo.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
crawler "github.com/yidun/yidun-golang-sdk/yidun/service/antispam/crawler" | ||
"github.com/yidun/yidun-golang-sdk/yidun/service/antispam/crawler/v1/update" | ||
) | ||
|
||
/** | ||
* 网站解决方案-微博检测任务更新接口 | ||
*/ | ||
func main() { | ||
// 构造WeiboUpdateV1Request请求对象 | ||
request := update.NewWeiboUpdateV1Request() | ||
|
||
request.SetBlogger("123") | ||
request.SetJobId(123123) | ||
request.SetStartTime(123123123) | ||
request.SetUrl("ceshi") | ||
|
||
// 实例化一个crawlerClient,入参需要传入易盾内容安全分配的secretId,secretKey | ||
crawlerClient := crawler.NewCrawlerClientWithAccessKey("YOUR_SECRET_ID", "YOUR_SECRET_KEY") | ||
|
||
response, err := crawlerClient.WeiboJobUpdate(request) | ||
if err != nil { | ||
// 处理错误并打印日志 | ||
log.Fatal(err) | ||
} | ||
|
||
if response.GetCode() == 200 { | ||
// do something | ||
fmt.Printf("res msg:%s", response.GetMsg()) | ||
} else { | ||
fmt.Println("error code: ", response.GetCode()) | ||
fmt.Println("error msg: ", response.GetMsg()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
yidun/service/antispam/crawler/v1/update/crawler_job_update_request.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package update | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/yidun/yidun-golang-sdk/yidun/core/http" | ||
"github.com/yidun/yidun-golang-sdk/yidun/core/types" | ||
"github.com/yidun/yidun-golang-sdk/yidun/core/validation" | ||
) | ||
|
||
// CrawlerJobUpdateV1Request 网站任务检测更新接口v1.0 | ||
type CrawlerJobUpdateV1Request struct { | ||
*types.BizPostFormRequest | ||
// jobId | ||
JobId *int64 `json:"jobId,omitempty"` | ||
// 主站url | ||
SiteUrl *string `json:"siteUrl,omitempty"` | ||
// 网站名称 | ||
SiteName *string `json:"siteName,omitempty"` | ||
// 循环爬虫时间区间--开始时间 | ||
SliceStartTime *int64 `json:"sliceStartTime,omitempty"` | ||
} | ||
|
||
// For NewCrawlerJobUpdateV1Request | ||
func NewCrawlerJobUpdateV1Request() *CrawlerJobUpdateV1Request { | ||
var request = &CrawlerJobUpdateV1Request{ | ||
BizPostFormRequest: types.NewBizPostFormRequestWithoutBizId(), | ||
} | ||
request.SetProductCode("crawler") | ||
request.SetUriPattern("/v1/crawler/job/update") | ||
request.SetMethod(http.HttpMethodPost) | ||
request.SetVersion("v1.0") | ||
return request | ||
} | ||
|
||
// SetJobId sets the jobId field for the CrawlerJobUpdateV1Request struct. | ||
func (r *CrawlerJobUpdateV1Request) SetJobId(jobId int64) { | ||
r.JobId = &jobId | ||
} | ||
|
||
// SetSiteUrl sets the siteUrl field for the CrawlerJobUpdateV1Request struct. | ||
func (r *CrawlerJobUpdateV1Request) SetSiteUrl(siteUrl string) { | ||
r.SiteUrl = &siteUrl | ||
} | ||
|
||
// SetSiteName sets the siteName field for the CrawlerJobUpdateV1Request struct. | ||
func (r *CrawlerJobUpdateV1Request) SetSiteName(siteName string) { | ||
r.SiteName = &siteName | ||
} | ||
|
||
// SetSliceStartTime sets the sliceStartTime field for the CrawlerJobUpdateV1Request struct. | ||
func (r *CrawlerJobUpdateV1Request) SetSliceStartTime(sliceStartTime int64) { | ||
r.SliceStartTime = &sliceStartTime | ||
} | ||
|
||
func (c *CrawlerJobUpdateV1Request) GetBusinessCustomSignParams() map[string]string { | ||
data := c.PostFormRequest.GetBusinessCustomSignParams() | ||
|
||
if c.JobId != nil { | ||
data["jobId"] = strconv.FormatInt(*c.JobId, 10) | ||
} | ||
if c.SiteUrl != nil { | ||
data["siteUrl"] = *c.SiteUrl | ||
} | ||
if c.SiteName != nil { | ||
data["siteName"] = *c.SiteName | ||
} | ||
if c.SliceStartTime != nil { | ||
data["sliceStartTime"] = strconv.FormatInt(*c.SliceStartTime, 10) | ||
} | ||
return data | ||
} | ||
|
||
func (c *CrawlerJobUpdateV1Request) ValidateParam() error { | ||
invalidParams := validation.ErrInvalidParams{Context: "CrawlerJobUpdateV1Request"} | ||
if c.JobId == nil { | ||
invalidParams.Add(validation.NewErrParamRequired("JobId不能为空")) | ||
} | ||
|
||
if invalidParams.Len() > 0 { | ||
return invalidParams | ||
} | ||
return nil | ||
} |
8 changes: 8 additions & 0 deletions
8
yidun/service/antispam/crawler/v1/update/crawler_job_update_response.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package update | ||
|
||
import "github.com/yidun/yidun-golang-sdk/yidun/core/types" | ||
|
||
// CrawlerJobUpdateV1Response 网站任务更新接口响应对象v1.0 | ||
type CrawlerJobUpdateV1Response struct { | ||
*types.CommonResponse | ||
} |
84 changes: 84 additions & 0 deletions
84
yidun/service/antispam/crawler/v1/update/official_accounts_update_request.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package update | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/yidun/yidun-golang-sdk/yidun/core/http" | ||
"github.com/yidun/yidun-golang-sdk/yidun/core/types" | ||
"github.com/yidun/yidun-golang-sdk/yidun/core/validation" | ||
) | ||
|
||
// OfficialAccountsUpdateV1Request 公众号检测更新接口v1.0 | ||
type OfficialAccountsUpdateV1Request struct { | ||
*types.BizPostFormRequest | ||
// @NotNull | ||
JobId *int64 `json:"jobId,omitempty"` | ||
// 微信号 | ||
WechatAccount *string `json:"wechatAccount,omitempty"` | ||
// 公众号名称 | ||
OfficialAccountName *string `json:"officialAccountName,omitempty"` | ||
// 循环爬虫时间区间--开始时间 | ||
StartTime *int64 `json:"startTime,omitempty"` | ||
} | ||
|
||
// For OfficialAccountsUpdateV1Request | ||
func NewOfficialAccountsUpdateV1Request() *OfficialAccountsUpdateV1Request { | ||
var request = &OfficialAccountsUpdateV1Request{ | ||
BizPostFormRequest: types.NewBizPostFormRequestWithoutBizId(), | ||
} | ||
request.SetProductCode("crawler") | ||
request.SetUriPattern("/v1/official-accounts/job/update") | ||
request.SetMethod(http.HttpMethodPost) | ||
request.SetVersion("v1.0") | ||
return request | ||
} | ||
|
||
// SetJobId sets the jobId field for the OfficialAccountsUpdateV1Request struct. | ||
func (r *OfficialAccountsUpdateV1Request) SetJobId(jobId int64) { | ||
r.JobId = &jobId | ||
} | ||
|
||
// SetWechatAccount sets the wechatAccount field for the OfficialAccountsUpdateV1Request struct. | ||
func (r *OfficialAccountsUpdateV1Request) SetWechatAccount(wechatAccount string) { | ||
r.WechatAccount = &wechatAccount | ||
} | ||
|
||
// SetOfficialAccountName sets the officialAccountName field for the OfficialAccountsUpdateV1Request struct. | ||
func (r *OfficialAccountsUpdateV1Request) SetOfficialAccountName(officialAccountName string) { | ||
r.OfficialAccountName = &officialAccountName | ||
} | ||
|
||
// SetStartTime sets the startTime field for the OfficialAccountsUpdateV1Request struct. | ||
func (r *OfficialAccountsUpdateV1Request) SetStartTime(startTime int64) { | ||
r.StartTime = &startTime | ||
} | ||
|
||
func (c *OfficialAccountsUpdateV1Request) GetBusinessCustomSignParams() map[string]string { | ||
data := c.PostFormRequest.GetBusinessCustomSignParams() | ||
|
||
if c.JobId != nil { | ||
data["jobId"] = strconv.FormatInt(*c.JobId, 10) | ||
} | ||
if c.WechatAccount != nil { | ||
data["wechatAccount"] = *c.WechatAccount | ||
} | ||
if c.OfficialAccountName != nil { | ||
data["officialAccountName"] = *c.OfficialAccountName | ||
} | ||
if c.StartTime != nil { | ||
data["startTime"] = strconv.FormatInt(*c.StartTime, 10) | ||
} | ||
return data | ||
} | ||
|
||
func (c *OfficialAccountsUpdateV1Request) ValidateParam() error { | ||
invalidParams := validation.ErrInvalidParams{Context: "OfficialAccountsUpdateV1Request"} | ||
if c.JobId == nil { | ||
invalidParams.Add(validation.NewErrParamRequired("JobId不能为空")) | ||
} | ||
|
||
if invalidParams.Len() > 0 { | ||
return invalidParams | ||
} | ||
return nil | ||
} |
Oops, something went wrong.