From 0f58de290245298cdb5c109c7a1ee4fb02dc95f6 Mon Sep 17 00:00:00 2001 From: markjrzhang Date: Tue, 7 Dec 2021 19:17:28 +0800 Subject: [PATCH] update DocumentAuditing api and add WebpageAuditing api --- src/main/java/com/qcloud/cos/COS.java | 12 ++ src/main/java/com/qcloud/cos/COSClient.java | 20 ++ .../com/qcloud/cos/demo/ci/DocBucketDemo.java | 2 +- .../com/qcloud/cos/demo/ci/QueueDemo.java | 2 - .../cos/demo/ci/WebpageAuditingJobDemo.java | 63 ++++++ .../cos/internal/RequestXmlFactory.java | 26 +++ .../qcloud/cos/internal/Unmarshallers.java | 18 ++ .../cos/internal/XmlResponsesSaxParser.java | 195 ++++++++++++++++++ .../ciModel/auditing/AudtingCommonInfo.java | 17 ++ .../ciModel/auditing/BaseAuditingDetail.java | 63 ++++++ .../cos/model/ciModel/auditing/Conf.java | 17 +- .../auditing/DocumentAuditingJobsDetail.java | 14 ++ .../ciModel/auditing/DocumentInputObject.java | 20 ++ .../auditing/ResultsImageAuditingDetail.java | 31 +++ .../auditing/ResultsTextAuditingDetail.java | 21 ++ .../auditing/WebpageAuditingJobsDetail.java | 105 ++++++++++ .../auditing/WebpageAuditingRequest.java | 59 ++++++ .../auditing/WebpageAuditingResponse.java | 37 ++++ .../model/ciModel/job/DocJobListResponse.java | 12 +- 19 files changed, 728 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/qcloud/cos/demo/ci/WebpageAuditingJobDemo.java create mode 100644 src/main/java/com/qcloud/cos/model/ciModel/auditing/BaseAuditingDetail.java create mode 100644 src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsImageAuditingDetail.java create mode 100644 src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsTextAuditingDetail.java create mode 100644 src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingJobsDetail.java create mode 100644 src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingRequest.java create mode 100644 src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingResponse.java diff --git a/src/main/java/com/qcloud/cos/COS.java b/src/main/java/com/qcloud/cos/COS.java index 67fd5e48..338401ac 100644 --- a/src/main/java/com/qcloud/cos/COS.java +++ b/src/main/java/com/qcloud/cos/COS.java @@ -46,6 +46,8 @@ import com.qcloud.cos.model.ciModel.auditing.TextAuditingResponse; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingRequest; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingResponse; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingRequest; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingResponse; import com.qcloud.cos.model.ciModel.bucket.DocBucketRequest; import com.qcloud.cos.model.ciModel.bucket.DocBucketResponse; import com.qcloud.cos.model.ciModel.bucket.MediaBucketRequest; @@ -3001,6 +3003,16 @@ SelectObjectContentResult selectObjectContent(SelectObjectContentRequest selectR * GenerateDocPreviewHtmlUrl 查询账号下已开通文档预览功能的bucket */ String GenerateDocPreviewUrl(DocHtmlRequest docJobRequest) throws URISyntaxException; + + /** + * createWebpageAuditingJob 提交网页审核任务 https://cloud.tencent.com/document/product/460/63968 + */ + WebpageAuditingResponse createWebpageAuditingJob(WebpageAuditingRequest request); + + /** + * describeWebpageAuditingJob 查询网页审核任务 https://cloud.tencent.com/document/product/460/63970 + */ + WebpageAuditingResponse describeWebpageAuditingJob(WebpageAuditingRequest request); } diff --git a/src/main/java/com/qcloud/cos/COSClient.java b/src/main/java/com/qcloud/cos/COSClient.java index 1e59af8f..2258f762 100644 --- a/src/main/java/com/qcloud/cos/COSClient.java +++ b/src/main/java/com/qcloud/cos/COSClient.java @@ -108,6 +108,8 @@ import com.qcloud.cos.model.ciModel.auditing.TextAuditingResponse; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingRequest; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingResponse; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingRequest; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingResponse; import com.qcloud.cos.model.ciModel.bucket.DocBucketRequest; import com.qcloud.cos.model.ciModel.bucket.DocBucketResponse; import com.qcloud.cos.model.ciModel.bucket.MediaBucketRequest; @@ -4043,6 +4045,24 @@ public String GenerateDocPreviewUrl(DocHtmlRequest docJobRequest) throws URISynt return buildDocPreview(request); } + @Override + public WebpageAuditingResponse createWebpageAuditingJob(WebpageAuditingRequest webpageAuditingRequest) { + this.checkCIRequestCommon(webpageAuditingRequest); + this.rejectStartWith(webpageAuditingRequest.getInput().getUrl(), "http", "The Conf.CallBack parameter mush start with http or https"); + CosHttpRequest request = createRequest(webpageAuditingRequest.getBucketName(), "/webpage/auditing", webpageAuditingRequest, HttpMethodName.POST); + this.setContent(request, RequestXmlFactory.convertToXmlByteArray(webpageAuditingRequest), "application/xml", false); + return invoke(request, new Unmarshallers.WebpageAuditingJobUnmarshaller()); + } + + @Override + public WebpageAuditingResponse describeWebpageAuditingJob(WebpageAuditingRequest webpageAuditingRequest) { + this.checkCIRequestCommon(webpageAuditingRequest); + rejectNull(webpageAuditingRequest.getJobId(), + "The jobId parameter must be specified setting the object tags"); + CosHttpRequest request = createRequest(webpageAuditingRequest.getBucketName(), "/webpage/auditing/" + webpageAuditingRequest.getJobId(), webpageAuditingRequest, HttpMethodName.GET); + return invoke(request, new Unmarshallers.WebpageAuditingDescribeJobUnmarshaller()); + } + private String buildDocPreview(CosHttpRequest request) throws URISyntaxException { String urlStr = request.getProtocol().toString() + "://" + request.getEndpoint() + request.getResourcePath(); diff --git a/src/main/java/com/qcloud/cos/demo/ci/DocBucketDemo.java b/src/main/java/com/qcloud/cos/demo/ci/DocBucketDemo.java index 2cf0c021..eb60ba85 100644 --- a/src/main/java/com/qcloud/cos/demo/ci/DocBucketDemo.java +++ b/src/main/java/com/qcloud/cos/demo/ci/DocBucketDemo.java @@ -25,7 +25,7 @@ public static void createDocProcessBucket(COSClient client) { DocBucketRequest request = new DocBucketRequest(); //2.添加请求参数 参数详情请见api接口文档 request.setBucketName("examplebucket-1250000000"); - //3.调用接口,获取任务响应对象 + //3.调用接口 Boolean result = client.createDocProcessBucket(request); System.out.println(result); } diff --git a/src/main/java/com/qcloud/cos/demo/ci/QueueDemo.java b/src/main/java/com/qcloud/cos/demo/ci/QueueDemo.java index 36cbf4b1..aaec3249 100644 --- a/src/main/java/com/qcloud/cos/demo/ci/QueueDemo.java +++ b/src/main/java/com/qcloud/cos/demo/ci/QueueDemo.java @@ -5,8 +5,6 @@ import com.qcloud.cos.model.ciModel.queue.MediaQueueRequest; import com.qcloud.cos.model.ciModel.queue.MediaQueueResponse; -import java.io.UnsupportedEncodingException; - /** * 媒体处理 queue接口相关demo 详情见https://cloud.tencent.com/document/product/460/38913 */ diff --git a/src/main/java/com/qcloud/cos/demo/ci/WebpageAuditingJobDemo.java b/src/main/java/com/qcloud/cos/demo/ci/WebpageAuditingJobDemo.java new file mode 100644 index 00000000..cb77f4eb --- /dev/null +++ b/src/main/java/com/qcloud/cos/demo/ci/WebpageAuditingJobDemo.java @@ -0,0 +1,63 @@ +package com.qcloud.cos.demo.ci; + +import com.qcloud.cos.COSClient; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingRequest; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingResponse; +import com.qcloud.cos.utils.Jackson; + + + +/** + * 网页审核相关demo 详情见https://cloud.tencent.com/document/product/460/63968 + */ +public class WebpageAuditingJobDemo { + + public static void main(String[] args) throws InterruptedException { + // 1 初始化用户身份信息(secretId, secretKey)。 + COSClient client = ClientUtils.getTestClient(); + // 2 调用要使用的方法。 + describeWebpageAuditingJob(client); + } + + /** + * createWebpageAuditingJob 接口用于提交网页审核任务。 + * + * @param client + */ + public static void createWebpageAuditingJob(COSClient client) { + //1.创建任务请求对象 + WebpageAuditingRequest request = new WebpageAuditingRequest(); + //2.添加请求参数 参数详情请见api接口文档 + request.setBucketName("demo-123456789"); +// request.getInput().setObject("pron.mp3"); + request.getInput().setUrl("https://console.cloud.tencent.com/"); + request.getConf().setDetectType("all"); + //3.调用接口,获取任务响应对象 + WebpageAuditingResponse response = client.createWebpageAuditingJob(request); + System.out.println(response); + } + + /** + * describeWebpageAuditingJob 接口用于查询网页审核任务。 + * + * @param client + */ + public static void describeWebpageAuditingJob(COSClient client) throws InterruptedException { + //1.创建任务请求对象 + WebpageAuditingRequest request = new WebpageAuditingRequest(); + //2.添加请求参数 参数详情请见api接口文档 + request.setBucketName("demo-123456789"); + request.setJobId("sh1acd0928572f11ecaf945254008*****"); + while (true) { + //3.调用接口,获取任务响应对象 + WebpageAuditingResponse response = client.describeWebpageAuditingJob(request); + String state = response.getJobsDetail().getState(); + if ("Success".equalsIgnoreCase(state) || "Failed".equalsIgnoreCase(state)) { + System.out.println(Jackson.toJsonString(response)); + break; + } + Thread.sleep(100); + } + + } +} diff --git a/src/main/java/com/qcloud/cos/internal/RequestXmlFactory.java b/src/main/java/com/qcloud/cos/internal/RequestXmlFactory.java index f8ce831c..e6466b85 100644 --- a/src/main/java/com/qcloud/cos/internal/RequestXmlFactory.java +++ b/src/main/java/com/qcloud/cos/internal/RequestXmlFactory.java @@ -47,6 +47,7 @@ import com.qcloud.cos.model.ciModel.auditing.DocumentAuditingRequest; import com.qcloud.cos.model.ciModel.auditing.TextAuditingRequest; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingRequest; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingRequest; import com.qcloud.cos.model.ciModel.bucket.DocBucketRequest; import com.qcloud.cos.model.ciModel.common.MediaOutputObject; import com.qcloud.cos.model.ciModel.job.DocJobObject; @@ -804,6 +805,7 @@ public static byte[] convertToXmlByteArray(TextAuditingRequest request) { xml.start("Input"); addIfNotNull(xml, "Object", request.getInput().getObject()); addIfNotNull(xml, "Content", request.getInput().getContent()); + addIfNotNull(xml, "Url", request.getInput().getUrl()); addIfNotNull(xml, "DataId", request.getInput().getDataId()); xml.end(); Conf conf = request.getConf(); @@ -827,6 +829,7 @@ public static byte[] convertToXmlByteArray(DocumentAuditingRequest request) { xml.start("Request"); xml.start("Input"); addIfNotNull(xml, "Url", request.getInput().getUrl()); + addIfNotNull(xml, "Object", request.getInput().getObject()); addIfNotNull(xml, "Type", request.getInput().getType()); addIfNotNull(xml, "DataId", request.getInput().getDataId()); xml.end(); @@ -845,6 +848,29 @@ public static byte[] convertToXmlByteArray(DocumentAuditingRequest request) { return xml.getBytes(); } + public static byte[] convertToXmlByteArray(WebpageAuditingRequest request) { + XmlWriter xml = new XmlWriter(); + + xml.start("Request"); + xml.start("Input"); + addIfNotNull(xml, "Url", request.getInput().getUrl()); + xml.end(); + Conf conf = request.getConf(); + xml.start("Conf"); + String detectType = conf.getDetectType(); + if ("all".equalsIgnoreCase(detectType)) { + detectType = "Porn,Terrorism,Politics,Ads,Illegal,Abuse"; + } + addIfNotNull(xml, "DetectType", detectType); + addIfNotNull(xml, "Callback", conf.getCallback()); + addIfNotNull(xml, "BizType", conf.getBizType()); + addIfNotNull(xml, "ReturnHighlightHtml", conf.getReturnHighlightHtml()); + xml.end(); + + xml.end(); + return xml.getBytes(); + } + public static byte[] convertToXmlByteArray(BatchImageAuditingRequest request) { XmlWriter xml = new XmlWriter(); diff --git a/src/main/java/com/qcloud/cos/internal/Unmarshallers.java b/src/main/java/com/qcloud/cos/internal/Unmarshallers.java index 1b8968ff..dbd02c00 100644 --- a/src/main/java/com/qcloud/cos/internal/Unmarshallers.java +++ b/src/main/java/com/qcloud/cos/internal/Unmarshallers.java @@ -55,6 +55,7 @@ import com.qcloud.cos.model.ciModel.auditing.ImageAuditingResponse; import com.qcloud.cos.model.ciModel.auditing.TextAuditingResponse; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingResponse; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingResponse; import com.qcloud.cos.model.ciModel.bucket.DocBucketResponse; import com.qcloud.cos.model.ciModel.bucket.MediaBucketResponse; import com.qcloud.cos.model.ciModel.image.ImageLabelResponse; @@ -729,4 +730,21 @@ public BatchImageAuditingResponse unmarshall(InputStream in) throws Exception { .parseBatchImageAuditingResponse(in).getResponse(); } } + + public static class WebpageAuditingJobUnmarshaller implements Unmarshaller { + + public WebpageAuditingResponse unmarshall(InputStream in) throws Exception { + return new XmlResponsesSaxParser() + .parseWebpageAuditingJobResponse(in).getResponse(); + } + } + + public static final class WebpageAuditingDescribeJobUnmarshaller + implements Unmarshaller { + + public WebpageAuditingResponse unmarshall(InputStream in) throws Exception { + return new XmlResponsesSaxParser() + .parseDWebpageAuditingDescribeResponse(in).getResponse(); + } + } } diff --git a/src/main/java/com/qcloud/cos/internal/XmlResponsesSaxParser.java b/src/main/java/com/qcloud/cos/internal/XmlResponsesSaxParser.java index f8ebdbe5..cf493b41 100644 --- a/src/main/java/com/qcloud/cos/internal/XmlResponsesSaxParser.java +++ b/src/main/java/com/qcloud/cos/internal/XmlResponsesSaxParser.java @@ -79,10 +79,14 @@ import com.qcloud.cos.model.ciModel.auditing.ImageAuditingResponse; import com.qcloud.cos.model.ciModel.auditing.ObjectResults; import com.qcloud.cos.model.ciModel.auditing.OcrResults; +import com.qcloud.cos.model.ciModel.auditing.ResultsImageAuditingDetail; +import com.qcloud.cos.model.ciModel.auditing.ResultsTextAuditingDetail; import com.qcloud.cos.model.ciModel.auditing.SectionInfo; import com.qcloud.cos.model.ciModel.auditing.SnapshotInfo; import com.qcloud.cos.model.ciModel.auditing.TextAuditingResponse; import com.qcloud.cos.model.ciModel.auditing.VideoAuditingResponse; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingJobsDetail; +import com.qcloud.cos.model.ciModel.auditing.WebpageAuditingResponse; import com.qcloud.cos.model.ciModel.bucket.DocBucketObject; import com.qcloud.cos.model.ciModel.bucket.DocBucketResponse; import com.qcloud.cos.model.ciModel.bucket.MediaBucketObject; @@ -821,6 +825,18 @@ public BatchImageAuditingHandler parseBatchImageAuditingResponse(InputStream inp return handler; } + public WebpageAuditingJobHandler parseWebpageAuditingJobResponse(InputStream inputStream) throws IOException { + WebpageAuditingJobHandler handler = new WebpageAuditingJobHandler(); + parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream)); + return handler; + } + + public WebpageAuditingDescribeJobHandler parseDWebpageAuditingDescribeResponse(InputStream inputStream) throws IOException { + WebpageAuditingDescribeJobHandler handler = new WebpageAuditingDescribeJobHandler(); + parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream)); + return handler; + } + /** * @param inputStream * @@ -6056,6 +6072,9 @@ protected void doEndElement(String uri, String name, String qName) { case "Url": jobsDetail.setUrl(getText()); break; + case "Object": + jobsDetail.setObject(getText()); + break; default: break; } @@ -6133,6 +6152,9 @@ protected void doEndElement(String uri, String name, String qName) { case "Url": jobsDetail.setUrl(getText()); break; + case "Object": + jobsDetail.setObject(getText()); + break; case "DataId": jobsDetail.setDataId(getText()); break; @@ -6364,6 +6386,179 @@ private void parseInfo(AudtingCommonInfo obj, String name, String value) { break; } } + } + + public static class WebpageAuditingJobHandler extends AbstractHandler { + private WebpageAuditingResponse response = new WebpageAuditingResponse(); + + @Override + protected void doStartElement(String uri, String name, String qName, Attributes attrs) { + + } + + @Override + protected void doEndElement(String uri, String name, String qName) { + if (in("Response", "JobsDetail")) { + WebpageAuditingJobsDetail jobsDetail = response.getJobsDetail(); + switch (name) { + case "JobId": + jobsDetail.setJobId(getText()); + break; + case "State": + jobsDetail.setState(getText()); + break; + case "CreationTime": + jobsDetail.setCreationTime(getText()); + break; + case "Url": + jobsDetail.setUrl(getText()); + break; + default: + break; + } + } else if (in("Response")) { + if ("RequestId".equalsIgnoreCase(name)) { + response.setRequestId(getText()); + } + } + } + + public WebpageAuditingResponse getResponse() { + return response; + } + + public void setResponse(WebpageAuditingResponse response) { + this.response = response; + } + } + + public static class WebpageAuditingDescribeJobHandler extends AbstractHandler { + private WebpageAuditingResponse response = new WebpageAuditingResponse(); + + @Override + protected void doStartElement(String uri, String name, String qName, Attributes attrs) { + List imageResults = response.getJobsDetail().getImageResults(); + List textResults = response.getJobsDetail().getTextResults(); + if (in("Response", "JobsDetail", "ImageResults") && "Results".equals(name)) { + imageResults.add(new ResultsImageAuditingDetail()); + } else if (in("Response", "JobsDetail", "TextResults") && "Results".equals(name)) { + textResults.add(new ResultsTextAuditingDetail()); + } + } + + @Override + protected void doEndElement(String uri, String name, String qName) { + WebpageAuditingJobsDetail jobsDetail = response.getJobsDetail(); + List imageResults = jobsDetail.getImageResults(); + List textResults = jobsDetail.getTextResults(); + ResultsImageAuditingDetail imageAuditingDetail = null; + ResultsTextAuditingDetail textAuditingDetail = null; + if (imageResults.isEmpty()) { + imageAuditingDetail = new ResultsImageAuditingDetail(); + } else { + imageAuditingDetail = imageResults.get(imageResults.size() - 1); + } + if (textResults.isEmpty()) { + textAuditingDetail = new ResultsTextAuditingDetail(); + } else { + textAuditingDetail = textResults.get(textResults.size() - 1); + } + if (in("Response")) { + if ("RequestId".equalsIgnoreCase(name)) { + response.setRequestId(getText()); + } + } else if (in("Response", "JobsDetail")) { + switch (name) { + case "JobId": + jobsDetail.setJobId(getText()); + break; + case "State": + jobsDetail.setState(getText()); + break; + case "CreationTime": + jobsDetail.setCreationTime(getText()); + break; + case "Suggestion": + jobsDetail.setSuggestion(getText()); + break; + case "PageCount": + jobsDetail.setPageCount(getText()); + break; + case "Url": + jobsDetail.setUrl(getText()); + break; + case "Label": + jobsDetail.setLabel(getText()); + break; + default: + break; + } + } else if (in("Response", "JobsDetail", "ImageResults", "Results")) { + switch (name) { + case "Text": + imageAuditingDetail.setText(getText()); + break; + case "Url": + imageAuditingDetail.setUrl(getText()); + break; + default: + break; + } + } else if (in("Response", "JobsDetail", "TextResults", "Results")) { + if ("Text".equals(name)) { + textAuditingDetail.setText(getText()); + } + } else if (in("Response", "JobsDetail", "ImageResults", "Results","PoliticsInfo")) { + parseInfo(imageAuditingDetail.getPoliticsInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "ImageResults", "Results", "PornInfo")) { + parseInfo(imageAuditingDetail.getPornInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "ImageResults", "Results", "TerrorismInfo")) { + parseInfo(imageAuditingDetail.getTerroristInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "ImageResults", "Results", "AdsInfo")) { + parseInfo(imageAuditingDetail.getAdsInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "TextResults", "Results","PoliticsInfo")) { + parseInfo(textAuditingDetail.getPoliticsInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "TextResults", "Results", "PornInfo")) { + parseInfo(textAuditingDetail.getPornInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "TextResults", "Results", "TerrorismInfo")) { + parseInfo(textAuditingDetail.getTerroristInfo(), name, getText()); + } else if (in("Response", "JobsDetail", "TextResults", "Results", "AdsInfo")) { + parseInfo(textAuditingDetail.getAdsInfo(), name, getText()); + } + } + + private void parseInfo(AudtingCommonInfo obj, String name, String value) { + switch (name) { + case "Code": + obj.setCode(value); + break; + case "HitFlag": + obj.setHitFlag(getText()); + break; + case "Score": + obj.setScore(getText()); + break; + case "Keywords": + obj.setLabel(getText()); + break; + case "Count": + obj.setCount(getText()); + break; + case "SubLabel": + obj.setSubLabel(getText()); + break; + default: + break; + } + } + + public WebpageAuditingResponse getResponse() { + return response; + } + + public void setResponse(WebpageAuditingResponse response) { + this.response = response; + } } } diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/AudtingCommonInfo.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/AudtingCommonInfo.java index a0741bb3..4bb25372 100644 --- a/src/main/java/com/qcloud/cos/model/ciModel/auditing/AudtingCommonInfo.java +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/AudtingCommonInfo.java @@ -33,6 +33,12 @@ public class AudtingCommonInfo { */ private String count; + /** + * 该字段表示审核命中的具体子标签,例如:Porn 下的 SexBehavior 子标签。 + * 注意:该字段可能返回空,表示未命中具体的子标签。 + */ + private String subLabel; + private OcrResults ocrResults; private List objectResults = new ArrayList<>(); @@ -116,6 +122,14 @@ public void setObjectResults(List objectResults) { this.objectResults = objectResults; } + public String getSubLabel() { + return subLabel; + } + + public void setSubLabel(String subLabel) { + this.subLabel = subLabel; + } + @Override public String toString() { final StringBuffer sb = new StringBuffer("AudtingCommonInfo{"); @@ -125,6 +139,9 @@ public String toString() { sb.append(", score='").append(score).append('\''); sb.append(", label='").append(label).append('\''); sb.append(", count='").append(count).append('\''); + sb.append(", subLabel='").append(subLabel).append('\''); + sb.append(", ocrResults=").append(ocrResults); + sb.append(", objectResults=").append(objectResults); sb.append('}'); return sb.toString(); } diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/BaseAuditingDetail.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/BaseAuditingDetail.java new file mode 100644 index 00000000..6ed89264 --- /dev/null +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/BaseAuditingDetail.java @@ -0,0 +1,63 @@ +package com.qcloud.cos.model.ciModel.auditing; + +public class BaseAuditingDetail { + private PornInfo pornInfo; + private TerroristInfo terroristInfo; + private PoliticsInfo politicsInfo; + private AdsInfo adsInfo; + + public PornInfo getPornInfo() { + if (pornInfo == null) { + pornInfo = new PornInfo(); + } + return pornInfo; + } + + public void setPornInfo(PornInfo pornInfo) { + this.pornInfo = pornInfo; + } + + public TerroristInfo getTerroristInfo() { + if (terroristInfo == null) { + terroristInfo = new TerroristInfo(); + } + return terroristInfo; + } + + public void setTerroristInfo(TerroristInfo terroristInfo) { + this.terroristInfo = terroristInfo; + } + + public PoliticsInfo getPoliticsInfo() { + if (politicsInfo == null) { + politicsInfo = new PoliticsInfo(); + } + return politicsInfo; + } + + public void setPoliticsInfo(PoliticsInfo politicsInfo) { + this.politicsInfo = politicsInfo; + } + + public AdsInfo getAdsInfo() { + if (adsInfo == null) { + adsInfo = new AdsInfo(); + } + return adsInfo; + } + + public void setAdsInfo(AdsInfo adsInfo) { + this.adsInfo = adsInfo; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("BaseAuditingDetail{"); + sb.append("pornInfo=").append(pornInfo); + sb.append(", terroristInfo=").append(terroristInfo); + sb.append(", politicsInfo=").append(politicsInfo); + sb.append(", adsInfo=").append(adsInfo); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/Conf.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/Conf.java index bd34a7c5..01095c06 100644 --- a/src/main/java/com/qcloud/cos/model/ciModel/auditing/Conf.java +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/Conf.java @@ -34,10 +34,14 @@ public class Conf { private String detectContent; /** - * 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。 + * 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。 */ private CallbackVersion callbackVersion; + /** + * 指定是否需要高亮展示网页内的违规文本,并返回高亮展示的 html 链接。取值为 true 和 false,默认为 false。 + */ + private CallbackVersion returnHighlightHtml; public String getBizType() { @@ -91,15 +95,24 @@ public void setCallbackVersion(CallbackVersion callbackVersion) { this.callbackVersion = callbackVersion; } + public CallbackVersion getReturnHighlightHtml() { + return returnHighlightHtml; + } + + public void setReturnHighlightHtml(CallbackVersion returnHighlightHtml) { + this.returnHighlightHtml = returnHighlightHtml; + } + @Override public String toString() { - final StringBuilder sb = new StringBuilder("Conf{"); + final StringBuffer sb = new StringBuffer("Conf{"); sb.append("detectType='").append(detectType).append('\''); sb.append(", snapshot=").append(snapshot); sb.append(", callback='").append(callback).append('\''); sb.append(", bizType='").append(bizType).append('\''); sb.append(", detectContent='").append(detectContent).append('\''); sb.append(", callbackVersion=").append(callbackVersion); + sb.append(", returnHighlightHtml=").append(returnHighlightHtml); sb.append('}'); return sb.toString(); } diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentAuditingJobsDetail.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentAuditingJobsDetail.java index e21a93ed..f43f5d4c 100644 --- a/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentAuditingJobsDetail.java +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentAuditingJobsDetail.java @@ -31,6 +31,11 @@ public class DocumentAuditingJobsDetail { */ private String url; + /** + * 文档的cos相对地址 + */ + private String object; + /** * 表示本次判定的审核结果 * 0(审核正常),1 (判定为违规敏感文件),2(疑似敏感,建议人工复核) @@ -154,6 +159,14 @@ public void setDataId(String dataId) { this.dataId = dataId; } + public String getObject() { + return object; + } + + public void setObject(String object) { + this.object = object; + } + @Override public String toString() { final StringBuffer sb = new StringBuffer("DocumentAuditingJobsDetail{"); @@ -163,6 +176,7 @@ public String toString() { sb.append(", code='").append(code).append('\''); sb.append(", message='").append(message).append('\''); sb.append(", url='").append(url).append('\''); + sb.append(", object='").append(object).append('\''); sb.append(", suggestion='").append(suggestion).append('\''); sb.append(", pageCount='").append(pageCount).append('\''); sb.append(", dataId='").append(dataId).append('\''); diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentInputObject.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentInputObject.java index 31937fa8..b8124a13 100644 --- a/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentInputObject.java +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/DocumentInputObject.java @@ -7,6 +7,7 @@ */ public class DocumentInputObject { private String url; + private String object; private String type; private String dataId; @@ -33,4 +34,23 @@ public String getType() { public void setType(String type) { this.type = type; } + + public String getObject() { + return object; + } + + public void setObject(String object) { + this.object = object; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("DocumentInputObject{"); + sb.append("url='").append(url).append('\''); + sb.append(", object='").append(object).append('\''); + sb.append(", type='").append(type).append('\''); + sb.append(", dataId='").append(dataId).append('\''); + sb.append('}'); + return sb.toString(); + } } diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsImageAuditingDetail.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsImageAuditingDetail.java new file mode 100644 index 00000000..162262cb --- /dev/null +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsImageAuditingDetail.java @@ -0,0 +1,31 @@ +package com.qcloud.cos.model.ciModel.auditing; + +public class ResultsImageAuditingDetail extends BaseAuditingDetail { + private String url; + private String text; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("ResultsImageAuditingDetail{"); + sb.append("url='").append(url).append('\''); + sb.append(", text='").append(text).append('\''); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsTextAuditingDetail.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsTextAuditingDetail.java new file mode 100644 index 00000000..003ade0f --- /dev/null +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/ResultsTextAuditingDetail.java @@ -0,0 +1,21 @@ +package com.qcloud.cos.model.ciModel.auditing; + + +public class ResultsTextAuditingDetail extends BaseAuditingDetail { + private String text; + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("ResultsTextAuditingDetail{"); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingJobsDetail.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingJobsDetail.java new file mode 100644 index 00000000..c721f9e9 --- /dev/null +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingJobsDetail.java @@ -0,0 +1,105 @@ +package com.qcloud.cos.model.ciModel.auditing; + + +import java.util.ArrayList; +import java.util.List; + +public class WebpageAuditingJobsDetail { + private List imageResults = new ArrayList<>(); + private List textResults = new ArrayList<>(); + private String jobId; + private String label; + private String pageCount; + private String state; + private String suggestion; + private String url; + private String creationTime; + + public List getImageResults() { + return imageResults; + } + + public void setImageResults(List imageResults) { + this.imageResults = imageResults; + } + + public List getTextResults() { + return textResults; + } + + public void setTextResults(List textResults) { + this.textResults = textResults; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getPageCount() { + return pageCount; + } + + public void setPageCount(String pageCount) { + this.pageCount = pageCount; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getSuggestion() { + return suggestion; + } + + public void setSuggestion(String suggestion) { + this.suggestion = suggestion; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getCreationTime() { + return creationTime; + } + + public void setCreationTime(String creationTime) { + this.creationTime = creationTime; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("WebpageAuditingJobsDetail{"); + sb.append("imageResults=").append(imageResults); + sb.append(", textResults=").append(textResults); + sb.append(", jobId='").append(jobId).append('\''); + sb.append(", label='").append(label).append('\''); + sb.append(", pageCount='").append(pageCount).append('\''); + sb.append(", state='").append(state).append('\''); + sb.append(", suggestion='").append(suggestion).append('\''); + sb.append(", url='").append(url).append('\''); + sb.append(", creationTime='").append(creationTime).append('\''); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingRequest.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingRequest.java new file mode 100644 index 00000000..d40de43d --- /dev/null +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingRequest.java @@ -0,0 +1,59 @@ +package com.qcloud.cos.model.ciModel.auditing; + + +import com.qcloud.cos.internal.CIServiceRequest; + +/** + * 音频审核请求实体 参数详情参考:https://cloud.tencent.com/document/product/460/53395 + */ +public class WebpageAuditingRequest extends CIServiceRequest { + /** + * 审核类型,拥有 porn(涉黄识别)、terrorist(涉暴恐识别)、politics(涉政识别)、ads(广告识别)四种。用户可选择多种识别类型, + * 例如 detectType=porn,ads 表示对图片进行涉黄及广告审核 + */ + private Conf conf; + + private AuditingInputObject input; + + private String jobId; + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public AuditingInputObject getInput() { + if (input == null) { + input = new AuditingInputObject(); + } + return input; + } + + public void setInput(AuditingInputObject input) { + this.input = input; + } + + public Conf getConf() { + if (conf == null) { + conf = new Conf(); + } + return conf; + } + + public void setConf(Conf conf) { + this.conf = conf; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("AudioAuditingRequest{"); + sb.append("conf=").append(conf); + sb.append(", input=").append(input); + sb.append(", jobId='").append(jobId).append('\''); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingResponse.java b/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingResponse.java new file mode 100644 index 00000000..46601a1d --- /dev/null +++ b/src/main/java/com/qcloud/cos/model/ciModel/auditing/WebpageAuditingResponse.java @@ -0,0 +1,37 @@ +package com.qcloud.cos.model.ciModel.auditing; + +/** + * 音频审核响应实体 参数详情参考:https://cloud.tencent.com/document/product/460/53396 + */ +public class WebpageAuditingResponse { + /** + * 任务的详细信息 + */ + private WebpageAuditingJobsDetail jobsDetail = new WebpageAuditingJobsDetail(); + private String requestId; + + public WebpageAuditingJobsDetail getJobsDetail() { + return jobsDetail; + } + + public void setJobsDetail(WebpageAuditingJobsDetail jobsDetail) { + this.jobsDetail = jobsDetail; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("WebpageAuditingResponse{"); + sb.append("jobsDetail=").append(jobsDetail); + sb.append(", requestId='").append(requestId).append('\''); + sb.append('}'); + return sb.toString(); + } +} diff --git a/src/main/java/com/qcloud/cos/model/ciModel/job/DocJobListResponse.java b/src/main/java/com/qcloud/cos/model/ciModel/job/DocJobListResponse.java index bce4b999..4a8b2d14 100644 --- a/src/main/java/com/qcloud/cos/model/ciModel/job/DocJobListResponse.java +++ b/src/main/java/com/qcloud/cos/model/ciModel/job/DocJobListResponse.java @@ -8,8 +8,9 @@ public class DocJobListResponse extends CiServiceResult { List docJobDetailList; private String nextToken; + public List getDocJobDetailList() { - if (docJobDetailList==null){ + if (docJobDetailList == null) { docJobDetailList = new ArrayList<>(); } return docJobDetailList; @@ -26,4 +27,13 @@ public String getNextToken() { public void setNextToken(String nextToken) { this.nextToken = nextToken; } + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("DocJobListResponse{"); + sb.append("docJobDetailList=").append(docJobDetailList); + sb.append(", nextToken='").append(nextToken).append('\''); + sb.append('}'); + return sb.toString(); + } }