Skip to content

Commit b07189d

Browse files
author
markjrzhang
committed
Merge branch 'mark-dev' into 'master' (merge request !37)
add ImageAuditing new param
2 parents 452be01 + 33c7045 commit b07189d

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/main/java/com/qcloud/cos/COSClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,13 +3834,14 @@ public ImageAuditingResponse imageAuditing(ImageAuditingRequest imageAuditingReq
38343834
"The imageAuditingRequest parameter must be specified setting the object tags");
38353835
rejectNull(imageAuditingRequest.getBucketName(),
38363836
"The bucketName parameter must be specified setting the object tags");
3837-
this.checkAuditingRequest(imageAuditingRequest);
3837+
rejectNull(imageAuditingRequest.getDetectType(), "The detectType parameter must be specified setting the object tags");
38383838
CosHttpRequest<ImageAuditingRequest> request = createRequest(imageAuditingRequest.getBucketName(), imageAuditingRequest.getObjectKey(), imageAuditingRequest, HttpMethodName.GET);
38393839
request.addParameter("ci-process", "sensitive-content-recognition");
38403840
addParameterIfNotNull(request, "detect-type", imageAuditingRequest.getDetectType());
38413841
addParameterIfNotNull(request, "interval", Integer.toString(imageAuditingRequest.getInterval()));
38423842
addParameterIfNotNull(request, "max-frames", Integer.toString(imageAuditingRequest.getMaxFrames()));
38433843
addParameterIfNotNull(request, "biz-type", imageAuditingRequest.getBizType());
3844+
addParameterIfNotNull(request, "detect-url", imageAuditingRequest.getDetectUrl());
38443845
return invoke(request, new Unmarshallers.ImageAuditingUnmarshaller());
38453846
}
38463847

@@ -3924,7 +3925,7 @@ public TextAuditingResponse describeAuditingTextJob(TextAuditingRequest textAudi
39243925

39253926
private void checkAuditingRequest(ImageAuditingRequest request) {
39263927
rejectNull(request.getDetectType(), "The detectType parameter must be specified setting the object tags");
3927-
rejectNull(request.getObjectKey(), "The detectType parameter must be specified setting the object tags");
3928+
rejectNull(request.getObjectKey(), "The objectKey parameter must be specified setting the object tags");
39283929
}
39293930

39303931
private void checkWorkflowParameter(MediaWorkflowRequest request) {

src/main/java/com/qcloud/cos/model/ciModel/auditing/ImageAuditingRequest.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,28 @@ public class ImageAuditingRequest extends CosServiceRequest {
2525
private String objectKey;
2626

2727
/**
28-
* 截帧频率,GIF 图或长图检测专用,默认值为0,表示只会检测 GIF 图或长图的第一帧
28+
* 截帧频率,GIF 图或长图检测专用,默认值为5,表示只会检测 GIF 图或长图的第一帧
2929
*/
30-
private int interval;
30+
private int interval = 5;
3131

3232
/**
33-
* 最大截帧数量,GIF 图或长图检测专用,默认值为1,表示只取 GIF 的第1帧图片进行审核,或长图不进行切分识别
33+
* 最大截帧数量,GIF 图或长图检测专用,默认值为5,表示只取 GIF 的第1帧图片进行审核,或长图不进行切分识别
3434
*/
35-
private int maxFrames;
35+
private int maxFrames = 5;
3636

3737
/**
3838
* 审核策略的唯一标识,由后台自动生成,在控制台中对应为 Biztype 值
3939
*/
4040
private String bizType;
4141

42+
/**
43+
* 您可以通过填写detect-url审核任意公网可访问的图片链接
44+
* 不填写detect-url时,后台会默认审核ObjectKey
45+
* 填写了detect-url时,后台会审核detect-url链接,无需再填写ObjectKey
46+
* detect-url示例:http://www.example.com/abc.jpg
47+
*/
48+
private String detectUrl;
49+
4250
public String getDetectType() {
4351
return detectType;
4452
}
@@ -88,6 +96,14 @@ public void setBizType(String bizType) {
8896
this.bizType = bizType;
8997
}
9098

99+
public String getDetectUrl() {
100+
return detectUrl;
101+
}
102+
103+
public void setDetectUrl(String detectUrl) {
104+
this.detectUrl = detectUrl;
105+
}
106+
91107
@Override
92108
public String toString() {
93109
final StringBuffer sb = new StringBuffer("ImageAuditingRequest{");
@@ -96,7 +112,8 @@ public String toString() {
96112
sb.append(", objectKey='").append(objectKey).append('\'');
97113
sb.append(", interval=").append(interval);
98114
sb.append(", maxFrames=").append(maxFrames);
99-
sb.append(", bizType=").append(bizType);
115+
sb.append(", bizType='").append(bizType).append('\'');
116+
sb.append(", detectUrl='").append(detectUrl).append('\'');
100117
sb.append('}');
101118
return sb.toString();
102119
}

0 commit comments

Comments
 (0)