green-20220302/main.tea (1,937 lines of code) (raw):
/**
*
*/
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;
extends OpenApi;
init(config: OpenApi.Config){
super(config);
@endpointRule = 'regional';
@endpointMap = {
'ap-northeast-1' = 'green.ap-southeast-1.aliyuncs.com',
'ap-south-1' = 'green.ap-southeast-1.aliyuncs.com',
'ap-southeast-2' = 'green.ap-southeast-1.aliyuncs.com',
'ap-southeast-3' = 'green.ap-southeast-1.aliyuncs.com',
'ap-southeast-5' = 'green.ap-southeast-1.aliyuncs.com',
'cn-chengdu' = 'green.aliyuncs.com',
'cn-hongkong' = 'green.aliyuncs.com',
'cn-huhehaote' = 'green.aliyuncs.com',
'cn-qingdao' = 'green.aliyuncs.com',
'cn-zhangjiakou' = 'green.aliyuncs.com',
'eu-central-1' = 'green.ap-southeast-1.aliyuncs.com',
'eu-west-1' = 'green.ap-southeast-1.aliyuncs.com',
'me-east-1' = 'green.ap-southeast-1.aliyuncs.com',
'us-east-1' = 'green.ap-southeast-1.aliyuncs.com',
'cn-hangzhou-finance' = 'green.aliyuncs.com',
'cn-shenzhen-finance-1' = 'green.aliyuncs.com',
'cn-shanghai-finance-1' = 'green.aliyuncs.com',
'cn-north-2-gov-1' = 'green.aliyuncs.com',
};
checkConfig(config);
@endpoint = getEndpoint('green', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}
function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
if (!Util.empty(endpoint)) {
return endpoint;
}
if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
return endpointMap[regionId];
}
return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model DescribeFileModerationResultRequest {
service?: string(name='Service', description='The type of the moderation service.', example='document_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.
* taskId: required. The URL of the object that you want to moderate. Make sure that the URL can be accessed over the Internet.', example='{\\\\"taskId\\\\":\\\\"vi_f_hPgx9PFIQISdlfA888hOFG-1yJq8v\\\\"}'),
}
model DescribeFileModerationResultResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code. The status code 200 indicates that the request was successful.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.', example='26769ada6e264e7ba9aa048241e12be9'),
docType?: string(name='DocType', description='Optional. The document type.', example='doc'),
pageResult?: [
{
imageResult?: [
{
description?: string(name='Description', description='The description.', example='This is a title.'),
labelResult?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places.', example='25.0'),
description?: string(name='Description', description='The description.', example='This is a title.'),
label?: string(name='Label', description='The details of the labels.', example='nonlabel'),
}
](name='LabelResult', description='The label information.'),
location?: {
h?: int32(name='H', description='The H value of the coordinate point.', example='44'),
w?: int32(name='W', description='The W value of the coordinate point.', example='33'),
x?: int32(name='X', description='The X value of the coordinate point.', example='11'),
y?: int32(name='Y', description='The Y value of the coordinate point.', example='22'),
}(name='Location', description='The location information'),
riskLevel?: string(name='RiskLevel', description='Risk Level', example='high'),
service?: string(name='Service', description='The moderation service.', example='baselineCheck'),
}
](name='ImageResult', description='The image moderation results.'),
imageUrl?: string(name='ImageUrl', description='The image URL.', example='https://detect-obj.oss-cn-hangzhou.aliyuncs.com/sample/xxxx.jpg'),
pageNum?: int32(name='PageNum', description='The page number.', example='1'),
textResult?: [
{
description?: string(name='Description', description='The description.', example='This is a title.'),
descriptions?: string(name='Descriptions'),
labels?: string(name='Labels', description='The details of the labels.', example='porn'),
riskLevel?: string(name='RiskLevel', description='Risk Level', example='high'),
riskTips?: string(name='RiskTips', description='The risk details that are hit.', example='xxx'),
riskWords?: string(name='RiskWords', description='The risk words that are hit.', example='xxx'),
service?: string(name='Service', description='The moderation service.', example='chat_detection'),
text?: string(name='Text', description='The text content.', example='This is a text.'),
textSegment?: string(name='TextSegment', description='The text segmentation information.', example='[0,999]'),
}
](name='TextResult', description='The text moderation results.'),
textUrl?: string(name='TextUrl', description='The text URL.', example='https://detect-obj.oss-cn-hangzhou.aliyuncs.com/sample/xxxx.txt'),
}
](name='PageResult', description='An array that consists of the moderation results.'),
pageSummary?: {
imageSummary?: {
imageLabels?: [
{
description?: string(name='Description', description='The description.', example='test'),
label?: string(name='Label', description='The details of the labels.', example='contraband'),
labelSum?: int32(name='LabelSum', description='The number of times that the label is matched.', example='1'),
}
](name='ImageLabels', description='Image Label'),
riskLevel?: string(name='RiskLevel', description='Risk Level', example='high'),
}(name='ImageSummary', description='Image Results Summary'),
pageSum?: int32(name='PageSum', description='Number of pages', example='1'),
textSummary?: {
riskLevel?: string(name='RiskLevel', description='Risk Level', example='high'),
textLabels?: [
{
description?: string(name='Description'),
label?: string(name='Label', description='The details of the labels.', example='contraband'),
labelSum?: int32(name='LabelSum', description='The number of times that the label is matched.', example='1'),
}
](name='TextLabels', description='Text Label'),
}(name='TextSummary', description='Text Results Summary'),
}(name='PageSummary', description='Summary of results'),
riskLevel?: string(name='RiskLevel', description='Risk Level', example='high'),
url?: string(name='Url', description='The URL of the moderated object.', example='https://detect-obj.oss-cn-hangzhou.aliyuncs.com/sample/xxxx.pdf'),
}(name='Data', description='The data returned.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='OK'),
requestId?: string(name='RequestId', description='Id of the request', example='6CF2815C-C8C7-4A01-B52E-FF6E24F53492'),
}
model DescribeFileModerationResultResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: DescribeFileModerationResultResponseBody(name='body'),
}
/**
* @summary 文档审核结果
*
* @param request DescribeFileModerationResultRequest
* @param runtime runtime options for this request RuntimeOptions
* @return DescribeFileModerationResultResponse
*/
async function describeFileModerationResultWithOptions(request: DescribeFileModerationResultRequest, runtime: Util.RuntimeOptions): DescribeFileModerationResultResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'DescribeFileModerationResult',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 文档审核结果
*
* @param request DescribeFileModerationResultRequest
* @return DescribeFileModerationResultResponse
*/
async function describeFileModerationResult(request: DescribeFileModerationResultRequest): DescribeFileModerationResultResponse {
var runtime = new Util.RuntimeOptions{};
return describeFileModerationResultWithOptions(request, runtime);
}
model DescribeImageModerationResultRequest {
reqId?: string(name='ReqId', description='The ReqId field returned by the asynchronous Image Moderation 2.0 API.', example='B0963D30-BAB4-562F-9ED0-7A23AEC51C7C'),
}
model DescribeImageModerationResultResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
dataId?: string(name='DataId', description='The value of dataId that is specified in the API request. If this parameter is not specified in the API request, this field is not available in the response.', example='2a5389eb-4ff8-4584-ac99-644e2a539aa1'),
frame?: string(name='Frame', description='The information about the captured frames.', example='[{"result":[{"confidence":81.22,"label":"violent_explosion"}]}]'),
frameNum?: int32(name='FrameNum', description='The number of frames.', example='1'),
reqId?: string(name='ReqId', description='The reqId field returned by the Image Async Moderation API.', example='B0963D30-BAB4-562F-9ED0-7A23AEC51C7C'),
result?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places.', example='81.22'),
description?: string(name='Description', description='The description of the result.', example='no risk'),
label?: string(name='Label', description='The labels returned after the image moderation.', example='violent_explosion'),
riskLevel?: string(name='RiskLevel'),
}
](name='Result', description='The results of image moderation parameters such as the label parameter and the confidence parameter.'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
}(name='Data', description='The image moderation results.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='success'),
requestId?: string(name='RequestId', description='The request ID, which is used to locate and troubleshoot issues.', example='2881AD4F-638B-52A3-BA20-F74C5B1CEAE3'),
}
model DescribeImageModerationResultResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: DescribeImageModerationResultResponseBody(name='body'),
}
/**
* @summary Obtains the moderation results of an Image Moderation 2.0 task.
*
* @description * Billing: This operation is free of charge.
* * QPS limit: You can call this operation up to 100 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
*
* @param request DescribeImageModerationResultRequest
* @param runtime runtime options for this request RuntimeOptions
* @return DescribeImageModerationResultResponse
*/
async function describeImageModerationResultWithOptions(request: DescribeImageModerationResultRequest, runtime: Util.RuntimeOptions): DescribeImageModerationResultResponse {
Util.validateModel(request);
var query = {};
if (!Util.isUnset(request.reqId)) {
query['ReqId'] = request.reqId;
}
var req = new OpenApi.OpenApiRequest{
query = OpenApiUtil.query(query),
};
var params = new OpenApi.Params{
action = 'DescribeImageModerationResult',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary Obtains the moderation results of an Image Moderation 2.0 task.
*
* @description * Billing: This operation is free of charge.
* * QPS limit: You can call this operation up to 100 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
*
* @param request DescribeImageModerationResultRequest
* @return DescribeImageModerationResultResponse
*/
async function describeImageModerationResult(request: DescribeImageModerationResultRequest): DescribeImageModerationResultResponse {
var runtime = new Util.RuntimeOptions{};
return describeImageModerationResultWithOptions(request, runtime);
}
model DescribeImageResultExtRequest {
infoType?: string(name='InfoType', description='The content of the information to be obtained. Multiple values are separated by commas.', example='customImage,textInImage'),
reqId?: string(name='ReqId', description='The reqId field returned by the Url Async Moderation API.', example='638EDDC65C82AB39319A9F60'),
}
model DescribeImageResultExtResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
customImage?: [
{
imageId?: string(name='ImageId', description='The image ID.', example='123456'),
libId?: string(name='LibId', description='The image library ID.', example='123456'),
libName?: string(name='LibName', description='The image library name.', example='图库123'),
}
](name='CustomImage', description='If a custom image library is hit, information about the hit custom image library is returned.'),
publicFigure?: [
{
figureId?: string(name='FigureId', description='Identified person coding information.', example='yzazhzou'),
}
](name='PublicFigure', description='Person information list.'),
textInImage?: {
customTexts?: [
{
keyWords?: string(name='KeyWords', description='Custom words, multiple words separated by commas.', example='aaa,bbb'),
libId?: string(name='LibId', description='Custom library ID.', example='123456'),
libName?: string(name='LibName', description='Custom library name.', example='test'),
}
](name='CustomTexts', description='When a custom text library is hit, the custom library ID, custom library name, and custom word are returned.'),
ocrDatas?: [ string ](name='OcrDatas', description='Returns the text information in the recognized image.'),
riskWords?: [ string ](name='RiskWords', description='The risk words that are hit. Multiple words are separated by commas (,).'),
}(name='TextInImage', description='Returns the text information in the hit image.'),
}(name='Data', description='The data returned.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='success'),
requestId?: string(name='RequestId', description='The request ID.', example='6CF2815C-C8C7-4A01-B52E-FF6E24F53492'),
}
model DescribeImageResultExtResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: DescribeImageResultExtResponseBody(name='body'),
}
/**
* @summary 查询检测结果辅助信息
*
* @param request DescribeImageResultExtRequest
* @param runtime runtime options for this request RuntimeOptions
* @return DescribeImageResultExtResponse
*/
async function describeImageResultExtWithOptions(request: DescribeImageResultExtRequest, runtime: Util.RuntimeOptions): DescribeImageResultExtResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.infoType)) {
body['InfoType'] = request.infoType;
}
if (!Util.isUnset(request.reqId)) {
body['ReqId'] = request.reqId;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'DescribeImageResultExt',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 查询检测结果辅助信息
*
* @param request DescribeImageResultExtRequest
* @return DescribeImageResultExtResponse
*/
async function describeImageResultExt(request: DescribeImageResultExtRequest): DescribeImageResultExtResponse {
var runtime = new Util.RuntimeOptions{};
return describeImageResultExtWithOptions(request, runtime);
}
model DescribeUploadTokenResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
accessKeyId?: string(name='AccessKeyId', description='The AccessKey ID.', example='STS.NUEUjvDqMuvH6oQA1TXxxH4wVR'),
accessKeySecret?: string(name='AccessKeySecret', description='The AccessKey secret.', example='xxxx'),
bucketName?: string(name='BucketName', description='The bucket name.', example='oss-cip-shanghai'),
expiration?: int32(name='Expiration', description='The time when the file sharing link expires.', example='1720577200'),
fileNamePrefix?: string(name='FileNamePrefix', description='The file prefix.', example='upload/1xxb89/'),
ossInternalEndPoint?: string(name='OssInternalEndPoint', description='the oss intranet point.', example='https://oss-cn-shanghai-internal.aliyuncs.com'),
ossInternetEndPoint?: string(name='OssInternetEndPoint', description='the oss internet point.', example='https://oss-cn-shanghai.aliyuncs.com'),
securityToken?: string(name='SecurityToken', description='The security token.', example='xxxx'),
}(name='Data', description='The data returned.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='OK'),
requestId?: string(name='RequestId', description='The request ID.', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model DescribeUploadTokenResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: DescribeUploadTokenResponseBody(name='body'),
}
/**
* @summary 查询上传token
*
* @param request DescribeUploadTokenRequest
* @param runtime runtime options for this request RuntimeOptions
* @return DescribeUploadTokenResponse
*/
async function describeUploadTokenWithOptions(runtime: Util.RuntimeOptions): DescribeUploadTokenResponse {
var req = new OpenApi.OpenApiRequest{};
var params = new OpenApi.Params{
action = 'DescribeUploadToken',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 查询上传token
*
* @return DescribeUploadTokenResponse
*/
async function describeUploadToken(): DescribeUploadTokenResponse {
var runtime = new Util.RuntimeOptions{};
return describeUploadTokenWithOptions(runtime);
}
model DescribeUrlModerationResultRequest {
reqId?: string(name='ReqId', description='The ReqId field returned by an asynchronous URL moderation operation.', example='B0963D30-BAB4-562F-9ED0-7A23AEC51C7C'),
}
model DescribeUrlModerationResultResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code. The status code 200 indicates that the request was successful.', example='200'),
data?: {
dataId?: string(name='DataId', description='The value of dataId that is specified in the API request. If this parameter is not specified in the API request, this field is not available in the response.', example='26769ada6e264e7ba9aa048241e12be9'),
extraInfo?: {
icpNo?: string(name='IcpNo', description='The ICP number.', example='xx'),
icpType?: string(name='IcpType', description='The type of the ICP filing.', example='xx'),
siteType?: string(name='SiteType', description='The type of site', example='game'),
}(name='ExtraInfo', description='The supplementary information.'),
reqId?: string(name='ReqId', description='The ReqId field returned by an asynchronous URL moderation operation.', example='B0963D30-BAB4-562F-9ED0-7A23AEC51C7C'),
result?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places.', example='81.22'),
label?: string(name='Label', description='The labels returned after the asynchronous URL moderation.', example='sexual_url'),
}
](name='Result', description='The returned results.'),
}(name='Data', description='The data returned.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='success'),
requestId?: string(name='RequestId', description='The request ID.', example='01F9144A-2088-5D87-935B-2DB865284B1A'),
}
model DescribeUrlModerationResultResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: DescribeUrlModerationResultResponseBody(name='body'),
}
/**
* @summary Queries the moderation results based on the ReqId returned by asynchronous URL moderation.
*
* @description * Billing: This operation is free of charge.
* * Query timeout: We recommend that you query moderation results at least 480 seconds after you send an asynchronous moderation request. Content Moderation retains moderation results for up to 3 days. After 3 days, the results are deleted.
* * You can call this operation up to 100 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
*
* @param request DescribeUrlModerationResultRequest
* @param runtime runtime options for this request RuntimeOptions
* @return DescribeUrlModerationResultResponse
*/
async function describeUrlModerationResultWithOptions(request: DescribeUrlModerationResultRequest, runtime: Util.RuntimeOptions): DescribeUrlModerationResultResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.reqId)) {
body['ReqId'] = request.reqId;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'DescribeUrlModerationResult',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary Queries the moderation results based on the ReqId returned by asynchronous URL moderation.
*
* @description * Billing: This operation is free of charge.
* * Query timeout: We recommend that you query moderation results at least 480 seconds after you send an asynchronous moderation request. Content Moderation retains moderation results for up to 3 days. After 3 days, the results are deleted.
* * You can call this operation up to 100 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
*
* @param request DescribeUrlModerationResultRequest
* @return DescribeUrlModerationResultResponse
*/
async function describeUrlModerationResult(request: DescribeUrlModerationResultRequest): DescribeUrlModerationResultResponse {
var runtime = new Util.RuntimeOptions{};
return describeUrlModerationResultWithOptions(request, runtime);
}
model FileModerationRequest {
service?: string(name='Service', description='The type of the moderation service.', example='document_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{"url":"https://detect-obj.oss-cn-hangzhou.aliyuncs.com/sample/xxxx.pdf"}'),
}
model FileModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
taskId?: string(name='TaskId', description='The task ID.', example='xxxxx-xxxxx'),
}(name='Data', description='The data returned.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='SUCCESS'),
requestId?: string(name='RequestId', description='The request ID.', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model FileModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: FileModerationResponseBody(name='body'),
}
/**
* @summary 文档审核
*
* @param request FileModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return FileModerationResponse
*/
async function fileModerationWithOptions(request: FileModerationRequest, runtime: Util.RuntimeOptions): FileModerationResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'FileModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 文档审核
*
* @param request FileModerationRequest
* @return FileModerationResponse
*/
async function fileModeration(request: FileModerationRequest): FileModerationResponse {
var runtime = new Util.RuntimeOptions{};
return fileModerationWithOptions(request, runtime);
}
model ImageAsyncModerationRequest {
service?: string(name='Service', description='The type of the moderation service.', example='baselineCheck'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{"imageUrl":"https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png","dataId":"img123****"}'),
}
model ImageAsyncModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.', example='fb5ffab1-993b-449f-b8d6-b97d5e3331f2'),
reqId?: string(name='ReqId', description='The reqId field returned by the Image Async Moderation API. You can use this field to query the detection results.', example='A07B3DB9-D762-5C56-95B1-8EC55CF176D2'),
}(name='Data', description='The data returned.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='success'),
requestId?: string(name='RequestId', description='The request ID.', example='4A926AE2-4C96-573F-824F-0532960799F8'),
}
model ImageAsyncModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: ImageAsyncModerationResponseBody(name='body'),
}
/**
* @summary 图片异步检测
*
* @param request ImageAsyncModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return ImageAsyncModerationResponse
*/
async function imageAsyncModerationWithOptions(request: ImageAsyncModerationRequest, runtime: Util.RuntimeOptions): ImageAsyncModerationResponse {
Util.validateModel(request);
var query = {};
if (!Util.isUnset(request.service)) {
query['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
query['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
query = OpenApiUtil.query(query),
};
var params = new OpenApi.Params{
action = 'ImageAsyncModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 图片异步检测
*
* @param request ImageAsyncModerationRequest
* @return ImageAsyncModerationResponse
*/
async function imageAsyncModeration(request: ImageAsyncModerationRequest): ImageAsyncModerationResponse {
var runtime = new Util.RuntimeOptions{};
return imageAsyncModerationWithOptions(request, runtime);
}
model ImageBatchModerationRequest {
service?: string(name='Service', description='The types of detection supported by the enhanced image review, separated by English commas. Values:
- baselineCheck:General Baseline Detection
- baselineCheck_pro:General Baseline Detection_Pro Edition
- tonalityImprove:Content governance monitoring
- aigcCheck:AIGC image detection', example='baselineCheck,tonalityImprove'),
serviceParameters?: string(name='ServiceParameters', description='The set of relevant parameters for content detection objects.', example='{
"imageUrl": "https://img.alicdn.com/tfs/TB1U4r9AeH2gK0jSZJnXXaT1FXa-2880-480.png",
"dataId": "img123****"
}'),
}
model ImageBatchModerationResponseBody = {
code?: int32(name='Code', description='Return code. A return of 200 represents success.', example='200'),
data?: {
dataId?: string(name='DataId', description='To detect the data ID corresponding to the object.', example='26769ada6e264e7ba9aa048241e12be9'),
result?: [
{
confidence?: float(name='Confidence', description='Confidence score, ranging from 0 to 100, retained to two decimal places. Some labels do not have a confidence score.', example='81.22'),
description?: string(name='Description', description='Description.', example='No risk detected'),
label?: string(name='Label', description='The labels returned after image content detection. A single image may be associated with multiple labels and corresponding scores.', example='violent_explosion'),
}
](name='Result', description='The risk labels, confidence scores, and other parameters of image detection results, in an array structure.'),
results?: [
{
ext?: {
customImage?: [
{
imageId?: string(name='ImageId', description='The ID of the hit custom image.', example='1965304870002'),
libId?: string(name='LibId', description='Custom library ID', example='1965304870002'),
libName?: string(name='LibName', description='The name of the hit custom gallery.', example='Whitelist'),
}
](name='CustomImage', description='Custom image library hit information list.'),
logoData?: {
location?: {
h?: int32(name='H', description='The width of the text area, in pixels.', example='440'),
w?: int32(name='W', description='The height of the text area, in pixels.', example='330'),
x?: int32(name='X', description='The distance from the top-left corner of the text area to the y-axis, with the top-left corner of the image as the origin, in pixels.', example='11'),
y?: int32(name='Y', description='The distance from the top-left corner of the text area to the x-axis, with the top-left corner of the image as the origin, in pixels.', example='22'),
}(name='Location', description='The location information of the identifier.'),
logo?: [
{
confidence?: float(name='Confidence', description='Confidence score, from 0 to 100, rounded to two decimal places.', example='99.1'),
label?: string(name='Label', description='Identify the category.', example='logo_sns'),
name?: string(name='Name', description='identifier name.', example='Alibaba Cloud'),
}
](name='Logo', description='identification information'),
}(name='LogoData', description='Logo identification information.'),
publicFigure?: [
{
figureId?: string(name='FigureId', description='Identify the encoded information of the person.', example='12324222'),
figureName?: string(name='FigureName', description='The identified person\\\\"s name information.', example='xxxxx'),
location?: [
{
h?: int32(name='H', description='The width of the text area, in pixels.', example='440'),
w?: int32(name='W', description='The height of the text area, in pixels.', example='330'),
x?: int32(name='X', description='The distance from the top-left corner of the text area to the y-axis, with the top-left corner of the image as the origin, in pixels.', example='11'),
y?: int32(name='Y', description='The distance from the top-left corner of the text area to the x-axis, with the top-left corner of the image as the origin, in pixels.', example='22'),
}
](name='Location', description='The location information of the identifier.'),
}
](name='PublicFigure', description='List of character information.'),
textInImage?: {
customText?: [
{
keyWords?: string(name='KeyWords', description='Custom words, separate multiple words with commas.', example='Custom Word 1 and Custom Word 2'),
libId?: string(name='LibId', description='Custom library ID.', example='123456'),
libName?: string(name='LibName', description='Custom library name.', example='Custom Library 1'),
}
](name='CustomText', description='When a custom text library is matched, return the custom library ID, custom library name, and custom words.'),
ocrResult?: [
{
location?: {
h?: int32(name='H', description='The height of the text area, in pixels.', example='33'),
w?: int32(name='W', description='The width of the text area, in pixels.', example='44'),
x?: int32(name='X', description='The distance from the top-left corner of the text area to the y-axis, with the top-left corner of the image as the origin, in pixels.', example='11'),
y?: int32(name='Y', description='The distance from the top-left corner of the text area to the x-axis, with the top-left corner of the image as the origin, in pixels.', example='22'),
}(name='Location', description='Text line coordinate information.'),
text?: string(name='Text', description='Text information.', example='abcd'),
}
](name='OcrResult', description='Return the text information of each line recognized in the image.'),
riskWord?: [ string ](name='RiskWord', description='hit risk keywords'),
}(name='TextInImage', description='Return the text information from the recognized images.'),
}(name='Ext', description='Image supplementary reference information.'),
result?: [
{
confidence?: float(name='Confidence', description='Confidence score, ranging from 0 to 100, rounded to two decimal places. Some labels do not have a confidence score.', example='81.22'),
description?: string(name='Description', description='Description.', example='No risk detected'),
label?: string(name='Label', description='The labels returned after image content detection. A single image may have multiple labels and corresponding scores detected.', example='violent_explosion'),
}
](name='Result', description='The risk labels, confidence scores, and other parameters of image detection results, in an array structure.'),
riskLevel?: string(name='RiskLevel', description='Risk level.', example='high'),
service?: string(name='Service', description='The enhanced image detection service supports various detection services.', example='baselineCheck'),
}
](name='Results', description='The risk labels, confidence scores, and other parameters for each service\\\\"s image detection, in an array structure.'),
riskLevel?: string(name='RiskLevel', description='Risk level.', example='high'),
}(name='Data', description='The result of image content detection.'),
msg?: string(name='Msg', description='The response message for this request.', example='success'),
requestId?: string(name='RequestId', description='The ID of this invocation request, generated by Alibaba Cloud as a unique identifier for the request, can be used for troubleshooting and pinpointing issues.', example='6CF2815C-C8C7-4A01-B52E-FF6E24F53492'),
}
model ImageBatchModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: ImageBatchModerationResponseBody(name='body'),
}
/**
* @summary 图片批量调用
*
* @param request ImageBatchModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return ImageBatchModerationResponse
*/
async function imageBatchModerationWithOptions(request: ImageBatchModerationRequest, runtime: Util.RuntimeOptions): ImageBatchModerationResponse {
Util.validateModel(request);
var query = {};
if (!Util.isUnset(request.service)) {
query['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
query['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
query = OpenApiUtil.query(query),
};
var params = new OpenApi.Params{
action = 'ImageBatchModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 图片批量调用
*
* @param request ImageBatchModerationRequest
* @return ImageBatchModerationResponse
*/
async function imageBatchModeration(request: ImageBatchModerationRequest): ImageBatchModerationResponse {
var runtime = new Util.RuntimeOptions{};
return imageBatchModerationWithOptions(request, runtime);
}
model ImageModerationRequest {
service?: string(name='Service', description='The moderation services supported by Image Moderation 2.0. Valid values:
* baselineCheck: common baseline moderation
* baselineCheck_pro: common baseline moderation_Professional
* baselineCheck_cb: common baseline moderation_For regions outside the Chinese mainland
* tonalityImprove: content governance moderation
* aigcCheck: AI-generated image identification
* profilePhotoCheck: avatar image moderation
* advertisingCheck: marketing material identification
* liveStreamCheck: moderation of screenshots of videos and live streams
Valid values:
* liveStreamCheck: moderation of screenshots of videos and live streams
* baselineCheck: common baseline moderation
* aigcCheck: AI-generated image identification
* baselineCheck_pro: common baseline moderation_Professional
* advertisingCheck: marketing material identification
* baselineCheck_cb: common baseline moderation_For regions outside the Chinese mainland
* tonalityImprove: content governance moderation
* profilePhotoCheck: avatar image moderation', example='baselineCheck'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.
* imageUrl: the URL of the object that you want to moderate. This parameter is required.
* dataId: the ID of the object that you want to moderate. This parameter is optional.', example='{"imageUrl":"https://www.aliyun.com/test.jpg","dataId":"img1234567"}'),
}
model ImageModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code. The status code 200 indicates that the request was successful.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.
> If you specify the dataId parameter in the request, the value of the dataId parameter is returned in the response.', example='fb5ffab1-993b-449f-b8d6-b97d5e3331f2'),
ext?: {
customImage?: [
{
imageId?: string(name='ImageId', description='The image ID.', example='123456'),
libId?: string(name='LibId', description='The image library ID.', example='lib_123456'),
libName?: string(name='LibName', description='The image library name.', example='xx'),
}
](name='CustomImage', description='If a custom image library is hit, information about the hit custom image library is returned.'),
faceData?: [
{
age?: int32(name='Age', description='The age recognition result.', example='18'),
bang?: {
confidence?: float(name='Confidence', description='The confidence level of the bang recognition result. Valid values: 0 to 100. A higher value indicates a more credible result.', example='81.88'),
value?: string(name='Value', description='Indicates whether the recognition result of bangs is available.', example='Has'),
}(name='Bang', description='Indicates whether the recognition result of bangs is available.'),
gender?: {
confidence?: float(name='Confidence', description='The confidence level of the gender recognition result. Valid values: 0 to 100. A higher value indicates a more credible result.', example='81.88'),
value?: string(name='Value', description='The gender recognition result. Valid values:
- Male
- FeMale', example='FeMale'),
}(name='Gender', description='The gender recognition result.'),
glasses?: string(name='Glasses', description='The recognition result of whether to wear glasses.
- None: No glasses.
- Wear: Wear glasses.
- Sunglass: Wear sunglasses.', example='Common'),
hairstyle?: {
confidence?: float(name='Confidence', description='The confidence level of the hairstyle recognition result. Valid values: 0 to 100. A higher value indicates a more credible result.', example='81.88'),
value?: string(name='Value', description='The hairstyle recognition result. Valid values:
- Bald: bald head.
- Long: Long hair.
- Short: Short hair.', example='Short'),
}(name='Hairstyle', description='The hairstyle recognition result.'),
hat?: {
confidence?: float(name='Confidence', description='The confidence level of the result of wearing the hat. Valid values: 0 to 100. A higher value indicates a more credible result.', example='88.88'),
value?: string(name='Value', description='The recognition result of whether to wear the hat. Valid values:
- Wear: Wear a hat.
- None: No hat.', example='Wear'),
}(name='Hat', description='The recognition result of whether to wear a hat.'),
location?: {
h?: int32(name='H', description='The height of the face area. Unit: pixels.', example='26'),
w?: int32(name='W', description='The width of the face area. Unit: pixels.', example='83'),
x?: int32(name='X', description='The distance from the upper-left corner of the face area to the y-axis with the upper-left corner of the image as the coordinate origin. Unit: pixels.', example='41'),
y?: int32(name='Y', description='The distance from the upper-left corner of the face area to the x-axis with the upper-left corner of the image as the coordinate origin. Unit: pixels.', example='84'),
}(name='Location', description='The location of the face.'),
mask?: {
confidence?: float(name='Confidence', description='The confidence level of the result of wearing the mask. Valid values: 0 to 100. A higher value indicates a more credible result.', example='99.99'),
value?: string(name='Value', description='The recognition result of whether to wear a mask. Valid values:
- Wear a mask.
- None: No mask.', example='Wear'),
}(name='Mask', description='The recognition result of whether to wear a mask.'),
mustache?: {
confidence?: float(name='Confidence', description='The confidence level of the result of the beard. Valid values: 0 to 100. A higher value indicates a more credible result.', example='99.99'),
value?: string(name='Value', description='The identification result of whether there is a beard.Valid values:
- Has:have a beard.
- None:No beard.', example='Has'),
}(name='Mustache', description='The identification result of whether there is a beard.'),
quality?: {
blur?: float(name='Blur', description='The blur of the face image. Valid values: 0 to 100. The higher the score, the more fuzzy it is.
Recommended values: 0 to 25.', example='5.88'),
integrity?: float(name='Integrity', description='The integrity of the human face. Recommended values:80 to 100.', example='100.0'),
pitch?: float(name='Pitch', description='The head-up or head-down angle of the face.
Recommended values:-30 to 30.', example='5.88'),
roll?: float(name='Roll', description='The plane rotation angle of the face.
Recommended values:-30 to 30.', example='5.18'),
yaw?: float(name='Yaw', description='The left and right shaking angle of the human face.
Recommended values:-30 to 30.', example='5.18'),
}(name='Quality', description='The quality information of the face image.'),
smile?: float(name='Smile', description='The smiling degree of the face.', example='85.88'),
}
](name='FaceData', description='The returned face attribute information'),
logoData?: [
{
location?: {
h?: int32(name='H', description='The height of the text area, in pixels.', example='44'),
w?: int32(name='W', description='The width of the text area, in pixels.', example='33'),
x?: int32(name='X', description='The distance between the upper-left corner of the text area and the y-axis, using the upper-left corner of the image as the coordinate origin, in pixels.', example='11'),
y?: int32(name='Y', description='The distance between the upper left corner of the text area and the x-axis, with the upper left corner of the image as the coordinate origin, in pixels.', example='22'),
}(name='Location', description='Location information.'),
logo?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places. Some labels do not have scores of confidence levels.', example='99.01'),
label?: string(name='Label', description='Logo category.', example='xx'),
name?: string(name='Name', description='Logo name.', example='xx'),
}
](name='Logo', description='Logo information.'),
}
](name='LogoData', description='Logo information.'),
ocrResult?: [
{
location?: {
h?: int32(name='H', description='The height of the text area, in pixels.', example='44'),
w?: int32(name='W', description='The width of the text area, in pixels.', example='33'),
x?: int32(name='X', description='The distance between the upper-left corner of the text area and the y-axis, using the upper-left corner of the image as the coordinate origin, in pixels.', example='11'),
y?: int32(name='Y', description='The distance between the upper left corner of the text area and the x-axis, with the upper left corner of the image as the coordinate origin, in pixels.', example='22'),
}(name='Location', description='Location information.'),
text?: string(name='Text', description='The text information in the recognized image.', example='xx'),
}
](name='OcrResult', description='Returns the text information in the recognized image.'),
publicFigure?: [
{
figureId?: string(name='FigureId', description='Identified person coding information.', example='xx'),
figureName?: string(name='FigureName', description='Identified person name information.', example='xx'),
location?: [
{
h?: int32(name='H', description='The height', example='44'),
w?: int32(name='W', description='The weight', example='33'),
x?: int32(name='X', description='X coordinate', example='11'),
y?: int32(name='Y', description='Y coordinate', example='22'),
}
](name='Location', description='the data array of location info'),
}
](name='PublicFigure', description='Person information list.'),
recognition?: [
{
classification?: string(name='Classification', description='The category of image recognition.', example='xx'),
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places. Some labels do not have scores of confidence levels.', example='99.01'),
}
](name='Recognition', description='The result of image recognition.'),
textInImage?: {
customText?: [
{
keyWords?: string(name='KeyWords', description='Custom words, multiple words separated by commas.', example='aaa,bbb'),
libId?: string(name='LibId', description='Custom library ID.', example='123456'),
libName?: string(name='LibName', description='Custom library name.', example='xxxx'),
}
](name='CustomText', description='When a custom text library is hit, the custom library ID, custom library name, and custom word are returned.'),
ocrResult?: [
{
location?: {
h?: int32(name='H', description='The height of the text area, in pixels.', example='33'),
w?: int32(name='W', description='The width of the text area, in pixels.', example='44'),
x?: int32(name='X', description='The distance between the upper-left corner of the text area and the y-axis, using the upper-left corner of the image as the coordinate origin, in pixels.', example='11'),
y?: int32(name='Y', description='The distance between the upper left corner of the text area and the x-axis, with the upper left corner of the image as the coordinate origin, in pixels.', example='22'),
}(name='Location', description='Location information.'),
text?: string(name='Text', description='The text information in the recognized image.', example='xx'),
}
](name='OcrResult', description='Returns the text information in the recognized image.'),
riskWord?: [ string ](name='RiskWord', description='The risk words that are hit. Multiple words are separated by commas (,).'),
}(name='TextInImage', description='Returns the text information in the hit image.'),
vlContent?: {
outputText?: string(name='OutputText', description='the vl output content', example='this is a cat'),
}(name='VlContent', description='the vl output content'),
}(name='Ext', description='Auxiliary reference information.'),
result?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places. Some labels do not have scores of confidence levels.', example='81.22'),
description?: string(name='Description', description='The description of the result.', example='no risk'),
label?: string(name='Label', description='The labels returned after the image moderation. Multiple risk labels and the corresponding scores of confidence levels may be returned for an image.', example='violent_explosion'),
riskLevel?: string(name='RiskLevel'),
}
](name='Result', description='The results of image moderation parameters such as the label parameter and the confidence parameter, which are an array structure.'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
}(name='Data', description='The moderation results.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='OK'),
requestId?: string(name='RequestId', description='The request ID, which is used to locate and troubleshoot issues.', example='6CF2815C-C8C7-4A01-B52E-FF6E24F53492'),
}
model ImageModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: ImageModerationResponseBody(name='body'),
}
/**
* @summary Identifies whether an image contains content or elements that violate relevant regulations on network content dissemination, affect the content order of a specific platform, or affect user experience. Image Moderation 2.0 supports over 90 content risk labels and over 100 risk control items. Image Moderation 2.0 of Content Moderation allows you to develop further moderation or governance measures for specific image content based on business scenarios, platform-specific content governance rules, or rich risk labels and scores of confidence levels returned by API calls.
*
* @description **Before you call this operation, make sure that you are familiar with the [billing](https://help.aliyun.com/document_detail/467826.html)[](https://www.aliyun.com/price/product?#/lvwang/detail/cdibag) of Image Moderation 2.0.
*
* @param request ImageModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return ImageModerationResponse
*/
async function imageModerationWithOptions(request: ImageModerationRequest, runtime: Util.RuntimeOptions): ImageModerationResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'ImageModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary Identifies whether an image contains content or elements that violate relevant regulations on network content dissemination, affect the content order of a specific platform, or affect user experience. Image Moderation 2.0 supports over 90 content risk labels and over 100 risk control items. Image Moderation 2.0 of Content Moderation allows you to develop further moderation or governance measures for specific image content based on business scenarios, platform-specific content governance rules, or rich risk labels and scores of confidence levels returned by API calls.
*
* @description **Before you call this operation, make sure that you are familiar with the [billing](https://help.aliyun.com/document_detail/467826.html)[](https://www.aliyun.com/price/product?#/lvwang/detail/cdibag) of Image Moderation 2.0.
*
* @param request ImageModerationRequest
* @return ImageModerationResponse
*/
async function imageModeration(request: ImageModerationRequest): ImageModerationResponse {
var runtime = new Util.RuntimeOptions{};
return imageModerationWithOptions(request, runtime);
}
model ManualCallbackRequest {
channel?: string(name='Channel'),
checksum?: string(name='Checksum', example='abc'),
code?: string(name='Code', example='200'),
data?: string(name='Data', example='{\\\\"Result\\\\": [{\\\\"Confidence\\\\": 100.0, \\\\"CustomizedHit\\\\": [{\\\\"KeyWords\\\\": u\\\\"\\\\u4fdd\\\\u969c,\\\\u6700\\\\u5927,\\\\u9ad8\\\\u7ea7\\\\", \\\\"LibName\\\\": u\\\\"\\\\u4f18\\\\u8def\\\\u654f\\\\u611f\\\\u8bcd\\\\"}], \\\\"Label\\\\": \\\\"customized\\\\"}]}'),
msg?: string(name='Msg', example='OK'),
reqId?: string(name='ReqId', example='B0963D30-BAB4-562F-9ED0-7A23AEC51C7C'),
}
model ManualCallbackResponseBody = {
code?: int32(name='Code', example='200'),
message?: string(name='Message', example='SUCCESS'),
requestId?: string(name='RequestId', description='Id of the request', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model ManualCallbackResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: ManualCallbackResponseBody(name='body'),
}
/**
* @summary 内容安全人审结果回调接口
*
* @param request ManualCallbackRequest
* @param runtime runtime options for this request RuntimeOptions
* @return ManualCallbackResponse
*/
async function manualCallbackWithOptions(request: ManualCallbackRequest, runtime: Util.RuntimeOptions): ManualCallbackResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.channel)) {
body['Channel'] = request.channel;
}
if (!Util.isUnset(request.checksum)) {
body['Checksum'] = request.checksum;
}
if (!Util.isUnset(request.code)) {
body['Code'] = request.code;
}
if (!Util.isUnset(request.data)) {
body['Data'] = request.data;
}
if (!Util.isUnset(request.msg)) {
body['Msg'] = request.msg;
}
if (!Util.isUnset(request.reqId)) {
body['ReqId'] = request.reqId;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'ManualCallback',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 内容安全人审结果回调接口
*
* @param request ManualCallbackRequest
* @return ManualCallbackResponse
*/
async function manualCallback(request: ManualCallbackRequest): ManualCallbackResponse {
var runtime = new Util.RuntimeOptions{};
return manualCallbackWithOptions(request, runtime);
}
model ManualModerationRequest {
service?: string(name='Service', example='imageManualCheck'),
serviceParameters?: string(name='ServiceParameters', example='{"url": "https://talesofai.oss-cn-shanghai.aliyuncs.com/xxx.mp4", "dataId": "data1234"}'),
}
model ManualModerationResponseBody = {
code?: int32(name='Code', example='200'),
data?: {
dataId?: string(name='DataId', example='2a5389eb-4ff8-4584-ac99-644e2a539aa1'),
taskId?: string(name='TaskId', example='xxxxx-xxxxx'),
}(name='Data'),
message?: string(name='Message', example='SUCCESS'),
requestId?: string(name='RequestId', description='Id of the request', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model ManualModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: ManualModerationResponseBody(name='body'),
}
/**
* @summary 内容安全人审提交请求接口
*
* @param request ManualModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return ManualModerationResponse
*/
async function manualModerationWithOptions(request: ManualModerationRequest, runtime: Util.RuntimeOptions): ManualModerationResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'ManualModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 内容安全人审提交请求接口
*
* @param request ManualModerationRequest
* @return ManualModerationResponse
*/
async function manualModeration(request: ManualModerationRequest): ManualModerationResponse {
var runtime = new Util.RuntimeOptions{};
return manualModerationWithOptions(request, runtime);
}
model ManualModerationResultRequest {
serviceParameters?: string(name='ServiceParameters', example='{\\\\"TaskId\\\\":\\\\"e5f2d886-4c23-440d-999c-bd98acde11b6\\\\"}'),
}
model ManualModerationResultResponseBody = {
code?: int32(name='Code', example='200'),
data?: {
dataId?: string(name='DataId', example='data1234'),
result?: [
{
description?: string(name='Description'),
label?: string(name='Label', example='violent_explosion'),
}
](name='Result'),
riskLevel?: string(name='RiskLevel', example='high'),
taskId?: string(name='TaskId', example='xxxxx-xxxxx'),
}(name='Data'),
message?: string(name='Message', example='SUCCESS'),
requestId?: string(name='RequestId', description='Id of the request', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model ManualModerationResultResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: ManualModerationResultResponseBody(name='body'),
}
/**
* @summary 获取人审结果
*
* @param request ManualModerationResultRequest
* @param runtime runtime options for this request RuntimeOptions
* @return ManualModerationResultResponse
*/
async function manualModerationResultWithOptions(request: ManualModerationResultRequest, runtime: Util.RuntimeOptions): ManualModerationResultResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'ManualModerationResult',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 获取人审结果
*
* @param request ManualModerationResultRequest
* @return ManualModerationResultResponse
*/
async function manualModerationResult(request: ManualModerationResultRequest): ManualModerationResultResponse {
var runtime = new Util.RuntimeOptions{};
return manualModerationResultWithOptions(request, runtime);
}
model TextModerationRequest {
service?: string(name='Service', description='The type of the moderation service.', example='nickname_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{"content":"Content to be moderated"}'),
}
model TextModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
accountId?: string(name='accountId', description='The ID of the Alibaba Cloud account.', example='123456'),
dataId?: string(name='dataId'),
descriptions?: string(name='descriptions'),
deviceId?: string(name='deviceId', description='The device ID.', example='xxxxxx'),
labels?: string(name='labels', description='Labels.', example='porn'),
reason?: string(name='reason', description='The JSON string used to locate the cause.', example='{\\\\"detectedLanguage\\\\":\\\\"ar\\\\",\\\\"riskTips\\\\":\\\\"sexuality_Suggestive\\\\",\\\\"riskWords\\\\":\\\\"pxxxxy\\\\",\\\\"translatedContent\\\\":\\\\"pxxxxy sxxxx\\\\"}'),
}(name='Data', description='The moderation results.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='OK'),
requestId?: string(name='RequestId', description='The request ID.', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model TextModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: TextModerationResponseBody(name='body'),
}
/**
* @summary 文本审核
*
* @param request TextModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return TextModerationResponse
*/
async function textModerationWithOptions(request: TextModerationRequest, runtime: Util.RuntimeOptions): TextModerationResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'TextModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 文本审核
*
* @param request TextModerationRequest
* @return TextModerationResponse
*/
async function textModeration(request: TextModerationRequest): TextModerationResponse {
var runtime = new Util.RuntimeOptions{};
return textModerationWithOptions(request, runtime);
}
model TextModerationPlusRequest {
service?: string(name='Service', description='The moderation service.
Valid values:
* chat_detection_pro: moderation of interactive content of private chats_Professional
* llm_response_moderation: moderation of text generated by LLMs
* llm_query_moderation: moderation of input text of LLMs
* nickname_detection_pro: moderation of user nicknames_Professional
* comment_detection_pro: moderation of comment content of public chats_Professional', example='llm_query_moderation'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{"content":"Content to be moderated"}'),
}
model TextModerationPlusResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code. The status code 200 indicates that the request was successful.', example='200'),
data?: {
advice?: [
{
answer?: string(name='Answer', description='The answer.', example='XXX'),
hitLabel?: string(name='HitLabel', description='Hit Label', example='xxx'),
hitLibName?: string(name='HitLibName', description='Hit Library Name', example='xxx'),
}
](name='Advice', description='The suggestion.'),
attackLevel?: string(name='AttackLevel', description='The level of prompt attack', example='none'),
attackResult?: [
{
attackLevel?: string(name='AttackLevel', description='The level of prompt attack', example='none'),
confidence?: float(name='Confidence', description='The confidence', example='0'),
description?: string(name='Description', description='Description', example='safe'),
label?: string(name='Label', description='The label', example='safe'),
}
](name='AttackResult', description='The result of prompt attack detect'),
dataId?: string(name='DataId', description='The id of data', example='text1234'),
result?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places.', example='81.22'),
customizedHit?: [
{
keyWords?: string(name='KeyWords', description='The terms that are hit. Multiple terms are separated by commas (,).', example='xxx'),
libName?: string(name='LibName', description='The library name.', example='test'),
}
](name='CustomizedHit', description='The custom term hit by the moderated content.'),
description?: string(name='Description', description='The description of the label.', example='none'),
label?: string(name='Label', description='The label.', example='porn'),
riskWords?: string(name='RiskWords', description='The term hit by the moderated content.', example='XXX'),
}
](name='Result', description='The results.'),
riskLevel?: string(name='RiskLevel', description='Risk Level', example='high'),
score?: float(name='Score', description='The score.', example='1'),
sensitiveLevel?: string(name='SensitiveLevel', description='The level of sensitivity data', example='S0'),
sensitiveResult?: [
{
description?: string(name='Description', description='Description', example='xxx'),
label?: string(name='Label', description='The label', example='1234'),
sensitiveData?: [ string ](name='SensitiveData', description='The sensitive data.'),
sensitiveLevel?: string(name='SensitiveLevel', description='The level of sensitivity data', example='S1'),
}
](name='SensitiveResult', description='The result of sensitivity data detect'),
}(name='Data', description='The moderation results.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='OK'),
requestId?: string(name='RequestId', description='Id of the request', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model TextModerationPlusResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: TextModerationPlusResponseBody(name='body'),
}
/**
* @summary Moderates the input command and generated text of large language models (LLMs). Specific model input commands can be used to retrieve standard answers. The feature of enabling and disabling the moderation labels is also available.
*
* @description Before you call this operation, make sure that you have [activated the Content Moderation 2.0 service](https://common-buy.aliyun.com/?commodityCode=lvwang_cip_public_cn) and are familiar with the [billing](https://help.aliyun.com/document_detail/2671445.html?#section-6od-32j-99n) of the Text Moderation 2.0 Plus service.
*
* @param request TextModerationPlusRequest
* @param runtime runtime options for this request RuntimeOptions
* @return TextModerationPlusResponse
*/
async function textModerationPlusWithOptions(request: TextModerationPlusRequest, runtime: Util.RuntimeOptions): TextModerationPlusResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'TextModerationPlus',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary Moderates the input command and generated text of large language models (LLMs). Specific model input commands can be used to retrieve standard answers. The feature of enabling and disabling the moderation labels is also available.
*
* @description Before you call this operation, make sure that you have [activated the Content Moderation 2.0 service](https://common-buy.aliyun.com/?commodityCode=lvwang_cip_public_cn) and are familiar with the [billing](https://help.aliyun.com/document_detail/2671445.html?#section-6od-32j-99n) of the Text Moderation 2.0 Plus service.
*
* @param request TextModerationPlusRequest
* @return TextModerationPlusResponse
*/
async function textModerationPlus(request: TextModerationPlusRequest): TextModerationPlusResponse {
var runtime = new Util.RuntimeOptions{};
return textModerationPlusWithOptions(request, runtime);
}
model UrlAsyncModerationRequest {
service?: string(name='Service', description='The type of the moderation service.', example='url_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{
"url": "https://help.aliyun.com/",
"dataId": "url123******"
}'),
}
model UrlAsyncModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.', example='26769ada6e264e7ba9aa048241e12be9'),
reqId?: string(name='ReqId', description='The reqId field returned by the Url Async Moderation API.', example='A07B3DB9-D762-5C56-95B1-8EC55CF176D2'),
}(name='Data', description='The data returned.'),
msg?: string(name='Msg', description='The message that is returned in response to the request.', example='success'),
requestId?: string(name='RequestId', description='Id of the request', example='6CF2815C-****-****-B52E-FF6E2****492'),
}
model UrlAsyncModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: UrlAsyncModerationResponseBody(name='body'),
}
/**
* @summary url异步检测
*
* @param request UrlAsyncModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return UrlAsyncModerationResponse
*/
async function urlAsyncModerationWithOptions(request: UrlAsyncModerationRequest, runtime: Util.RuntimeOptions): UrlAsyncModerationResponse {
Util.validateModel(request);
var query = {};
if (!Util.isUnset(request.service)) {
query['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
query['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
query = OpenApiUtil.query(query),
};
var params = new OpenApi.Params{
action = 'UrlAsyncModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary url异步检测
*
* @param request UrlAsyncModerationRequest
* @return UrlAsyncModerationResponse
*/
async function urlAsyncModeration(request: UrlAsyncModerationRequest): UrlAsyncModerationResponse {
var runtime = new Util.RuntimeOptions{};
return urlAsyncModerationWithOptions(request, runtime);
}
model VideoModerationRequest {
service?: string(name='Service', description='The type of the moderation service.', example='videoDetection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{\\\\"url\\\\": \\\\"https://talesofai.oss-cn-shanghai.aliyuncs.com/xxx.mp4\\\\", \\\\"dataId\\\\": \\\\"94db0b88-f521-11ed-806e-fae21c1f239c\\\\"}'),
}
model VideoModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.', example='data1234'),
taskId?: string(name='TaskId', description='The task ID.', example='xxxxx-xxxxx'),
}(name='Data', description='The data returned.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='SUCCESS'),
requestId?: string(name='RequestId', description='The request ID.', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model VideoModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: VideoModerationResponseBody(name='body'),
}
/**
* @summary 视频检测任务提交
*
* @param request VideoModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return VideoModerationResponse
*/
async function videoModerationWithOptions(request: VideoModerationRequest, runtime: Util.RuntimeOptions): VideoModerationResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'VideoModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 视频检测任务提交
*
* @param request VideoModerationRequest
* @return VideoModerationResponse
*/
async function videoModeration(request: VideoModerationRequest): VideoModerationResponse {
var runtime = new Util.RuntimeOptions{};
return videoModerationWithOptions(request, runtime);
}
model VideoModerationCancelRequest {
service?: string(name='Service', description='The type of the moderation service.', example='videoDetection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{\\\\"taskId\\\\":\\\\"vi_s_4O9gp7GfNQdx9GOqdekFmk-1z2RJT\\\\"}'),
}
model VideoModerationCancelResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='OK'),
requestId?: string(name='RequestId', description='The request ID.', example='6CF2815C-****-****-B52E-FF6E2****492'),
}
model VideoModerationCancelResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: VideoModerationCancelResponseBody(name='body'),
}
/**
* @summary 取消视频直播流检测
*
* @param request VideoModerationCancelRequest
* @param runtime runtime options for this request RuntimeOptions
* @return VideoModerationCancelResponse
*/
async function videoModerationCancelWithOptions(request: VideoModerationCancelRequest, runtime: Util.RuntimeOptions): VideoModerationCancelResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'VideoModerationCancel',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 取消视频直播流检测
*
* @param request VideoModerationCancelRequest
* @return VideoModerationCancelResponse
*/
async function videoModerationCancel(request: VideoModerationCancelRequest): VideoModerationCancelResponse {
var runtime = new Util.RuntimeOptions{};
return videoModerationCancelWithOptions(request, runtime);
}
model VideoModerationResultRequest {
service?: string(name='Service', description='The type of the moderation service.
Valid values:
* liveStreamDetection: live stream moderation
* videoDetection: video file moderation
* liveStreamDetection_cb: live stream moderation_For regions outside the Chinese mainland
* videoDetection_cb: video file moderation_For regions outside the Chinese mainland.', example='videoDetection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The ID of the task that you want to query. You can specify one task ID at a time.', example='{\\\\"taskId\\\\":\\\\"au_f_8PoWiZKoLbczp5HRn69VdT-1y8@U5\\\\"}'),
}
model VideoModerationResultResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code. The status code 200 indicates that the request was successful.', example='200'),
data?: {
audioResult?: {
audioSummarys?: [
{
description?: string(name='Description'),
label?: string(name='Label', description='The voice label.', example='profanity'),
labelSum?: int32(name='LabelSum', description='The number of times that the label is matched.', example='8'),
}
](name='AudioSummarys', description='Summary of voice labels.'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
sliceDetails?: [
{
descriptions?: string(name='Descriptions'),
endTime?: long(name='EndTime', description='The end time of the text after voice-to-text conversion. Unit: seconds.', example='30'),
endTimestamp?: long(name='EndTimestamp', description='The end timestamp of the segment. Unit: milliseconds.', example='1685245261939'),
extend?: string(name='Extend', description='A reserved parameter.', example='{\\\\"consoleProduct\\\\":\\\\"slbnext\\\\"}'),
labels?: string(name='Labels', description='The details of the labels.', example='porn'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
riskTips?: string(name='RiskTips', description='Subcategory labels. Multiple labels are separated by commas (,).', example='""'),
riskWords?: string(name='RiskWords', description='The risk words that are hit. Multiple words are separated by commas (,).', example='""'),
score?: float(name='Score', description='The risk score. Default range: 0 to 99.', example='5'),
startTime?: long(name='StartTime', description='The start time of the text after voice-to-text conversion. Unit: seconds.', example='0'),
startTimestamp?: long(name='StartTimestamp', description='The start timestamp of the segment. Unit: milliseconds.', example='1659935002123'),
text?: string(name='Text', description='The text converted from voice.', example='Disgusting'),
url?: string(name='Url', description='If the moderation object is a voice stream, this parameter indicates the temporary access URL of the voice stream to which the text entry corresponds. The validity period of the URL is 30 minutes. You must prepare another URL to store the voice stream at the earliest opportunity.', example='http://xxxx.abc.img'),
}
](name='SliceDetails', description='The details about the text in the moderated voice. The value is a JSON array that contains one or more elements. Each element corresponds to a text entry.'),
}(name='AudioResult', description='The voice moderation results. The moderation results contain a structure.'),
dataId?: string(name='DataId', description='The value of dataId that is specified in the API request. If this parameter is not specified in the API request, the dataId field is not available in the response.', example='product_content-2055763'),
frameResult?: {
frameNum?: int32(name='FrameNum', description='The number of captured frames that are returned for the video file.', example='10'),
frameSummarys?: [
{
description?: string(name='Description', description='The description of the result.', example='no risk'),
label?: string(name='Label', description='The label against which a captured frame is matched.', example='violent_armedForces'),
labelSum?: int32(name='LabelSum', description='The number of times that the label is matched.', example='8'),
}
](name='FrameSummarys', description='The summary of the labels against which captured frames are matched.'),
frames?: [
{
offset?: float(name='Offset', description='The interval between the start of the video file and the captured frame. Unit: seconds.', example='338'),
results?: [
{
customImage?: [
{
imageId?: string(name='ImageId', description='The ID of the custom image that is hit.', example='1234'),
libId?: string(name='LibId', description='The ID of the custom image library that is hit.', example='12345678'),
}
](name='CustomImage', description='If a custom image library is hit, information about the custom image library is returned.'),
logoData?: [
{
location?: {
h?: int32(name='H'),
w?: int32(name='W'),
x?: int32(name='X'),
y?: int32(name='Y'),
}(name='Location'),
logo?: [
{
confidence?: long(name='confidence'),
label?: string(name='label'),
name?: string(name='name'),
}
](name='Logo'),
}
](name='LogoData'),
publicFigure?: [
{
figureId?: string(name='FigureId', description='The information about the code of the identified figure.', example='xxx001'),
}
](name='PublicFigure', description='If the video contains a specific figure, the code of the identified figure is returned.'),
result?: [
{
confidence?: float(name='Confidence', description='The score of the confidence level. Valid values: 0 to 100. The value is accurate to two decimal places.', example='50'),
description?: string(name='Description', description='The description of the result.', example='no risk'),
label?: string(name='Label', description='The label returned after a frame is moderated. Multiple risk labels and the corresponding scores of confidence levels may be returned for a frame.', example='bloody'),
}
](name='Result', description='The results of frame moderation parameters such as the label parameter and the confidence parameter.'),
service?: string(name='Service', description='The moderation service that is called.', example='tonalityImprove'),
textInImage?: map[string]any(name='TextInImage', description='The information about the text hit in the image is returned.'),
}
](name='Results', description='The results of frame moderation parameters such as the label parameter and the confidence parameter.'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
tempUrl?: string(name='TempUrl', description='The temporary URL of a captured frame.', example='http://xxxx.abc.jpg'),
timestamp?: long(name='Timestamp', description='The absolute timestamp. Unit: milliseconds.', example='1684559739000'),
}
](name='Frames', description='The information about the frames that match the labels.'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
}(name='FrameResult', description='The image moderation results. If the call is successful, the HTTP status code 200 and moderation results are returned. The moderation results contain a structure.'),
liveId?: string(name='LiveId', description='The unique ID of the live stream.', example='liveId'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
taskId?: string(name='TaskId', description='The task ID.', example='xxxxx-xxxxx'),
}(name='Data', description='The moderation results.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='success finished'),
requestId?: string(name='RequestId', description='Id of the request', example='6CF2815C-C8C7-4A01-B52E-FF6E24F53492'),
}
model VideoModerationResultResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: VideoModerationResultResponseBody(name='body'),
}
/**
* @summary Obtains the moderation results of a Video Moderation 2.0 task
*
* @description This operation is free of charge. We recommend that you query moderation results at least 30 seconds after you send an asynchronous moderation request. Content Moderation retains moderation results for at most 24 hours. After 24 hours, the results are deleted.
*
* @param request VideoModerationResultRequest
* @param runtime runtime options for this request RuntimeOptions
* @return VideoModerationResultResponse
*/
async function videoModerationResultWithOptions(request: VideoModerationResultRequest, runtime: Util.RuntimeOptions): VideoModerationResultResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'VideoModerationResult',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary Obtains the moderation results of a Video Moderation 2.0 task
*
* @description This operation is free of charge. We recommend that you query moderation results at least 30 seconds after you send an asynchronous moderation request. Content Moderation retains moderation results for at most 24 hours. After 24 hours, the results are deleted.
*
* @param request VideoModerationResultRequest
* @return VideoModerationResultResponse
*/
async function videoModerationResult(request: VideoModerationResultRequest): VideoModerationResultResponse {
var runtime = new Util.RuntimeOptions{};
return videoModerationResultWithOptions(request, runtime);
}
model VoiceModerationRequest {
service?: string(name='Service', description='The type of the moderation service.', example='nickname_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{"url": "http://aliyundoc.com/test.flv", "dataId": "data1234"}'),
}
model VoiceModerationResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.', example='data1234'),
taskId?: string(name='TaskId', description='The task ID.', example='xxxxx-xxxxx'),
}(name='Data', description='The data returned.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='SUCCESS'),
requestId?: string(name='RequestId', description='The request ID.', example='AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****'),
}
model VoiceModerationResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: VoiceModerationResponseBody(name='body'),
}
/**
* @summary 语音审核
*
* @param request VoiceModerationRequest
* @param runtime runtime options for this request RuntimeOptions
* @return VoiceModerationResponse
*/
async function voiceModerationWithOptions(request: VoiceModerationRequest, runtime: Util.RuntimeOptions): VoiceModerationResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'VoiceModeration',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 语音审核
*
* @param request VoiceModerationRequest
* @return VoiceModerationResponse
*/
async function voiceModeration(request: VoiceModerationRequest): VoiceModerationResponse {
var runtime = new Util.RuntimeOptions{};
return voiceModerationWithOptions(request, runtime);
}
model VoiceModerationCancelRequest {
service?: string(name='Service', description='The type of the moderation service.', example='nickname_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters required by the moderation service. The value is a JSON string.', example='{"taskId":"xxxxx-xxxx"}'),
}
model VoiceModerationCancelResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='SUCCESS'),
requestId?: string(name='RequestId', description='The request ID.', example='4A926AE2-4C96-573F-824F-0532960799F8'),
}
model VoiceModerationCancelResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: VoiceModerationCancelResponseBody(name='body'),
}
/**
* @summary 取消检测
*
* @param request VoiceModerationCancelRequest
* @param runtime runtime options for this request RuntimeOptions
* @return VoiceModerationCancelResponse
*/
async function voiceModerationCancelWithOptions(request: VoiceModerationCancelRequest, runtime: Util.RuntimeOptions): VoiceModerationCancelResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'VoiceModerationCancel',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary 取消检测
*
* @param request VoiceModerationCancelRequest
* @return VoiceModerationCancelResponse
*/
async function voiceModerationCancel(request: VoiceModerationCancelRequest): VoiceModerationCancelResponse {
var runtime = new Util.RuntimeOptions{};
return voiceModerationCancelWithOptions(request, runtime);
}
model VoiceModerationResultRequest {
service?: string(name='Service', description='The type of the moderation service. Valid values: nickname_detection: user nickname', example='nickname_detection'),
serviceParameters?: string(name='ServiceParameters', description='The parameters of API requests that are sent from API Gateway to the backend service.
For more information, see [ServiceParameter](https://help.aliyun.com/document_detail/43988.html).', example='{"taskId":"xxxxx-xxxx"}'),
}
model VoiceModerationResultResponseBody = {
code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
data?: {
dataId?: string(name='DataId', description='The ID of the moderated object.', example='26769ada6e264e7ba9aa048241e12be9'),
liveId?: string(name='LiveId', description='The unique ID of the live stream.', example='liveId'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
sliceDetails?: [
{
descriptions?: string(name='Descriptions'),
endTime?: long(name='EndTime', description='The end time of the audio segment in seconds.', example='10'),
endTimestamp?: long(name='EndTimestamp', description='The end timestamp of the segment. Unit: milliseconds.', example='1678854649720'),
extend?: string(name='Extend', description='Extended fields.', example='{\\\\"riskTips\\\\":\\\\"sexuality_Suggestive\\\\",\\\\"riskWords\\\\":\\\\"pxxxxy\\\\"}'),
labels?: string(name='Labels', description='The details of the labels.', example='sexual_sounds'),
originAlgoResult?: map[string]any(name='OriginAlgoResult', description='Reserved parameter.', example='{}'),
riskLevel?: string(name='RiskLevel', description='Risk Level.', example='high'),
riskTips?: string(name='RiskTips', description='The details of the risky content.', example='sexuality_Suggestive'),
riskWords?: string(name='RiskWords', description='The term hit by the risky content.', example='AAA,BBB,CCC'),
score?: float(name='Score', description='The risk score. Default range: 0 to 99.', example='87.01'),
startTime?: long(name='StartTime', description='The start time of the audio segment in seconds.', example='0'),
startTimestamp?: long(name='StartTimestamp', description='The start timestamp of the segment. Unit: milliseconds.', example='1678854649720'),
text?: string(name='Text', description='The text converted from the audio segment.', example='Disgusting'),
url?: string(name='Url', description='The temporary URL of the audio segment.', example='https://aliyundoc.com'),
}
](name='SliceDetails', description='The moderation results of audio segments.'),
taskId?: string(name='TaskId', description='The task ID.', example='kw24ihd0WGkdi5nniVZM@qOj-1x5Ibb'),
url?: string(name='Url', description='The URL of the moderated content.', example='https://aliyundoc.com'),
}(name='Data', description='The data returned.'),
message?: string(name='Message', description='The message that is returned in response to the request.', example='SUCCESS'),
requestId?: string(name='RequestId', description='Id of the request', example='2881AD4F-638B-52A3-BA20-F74C5B1CEAE3'),
}
model VoiceModerationResultResponse = {
headers?: map[string]string(name='headers'),
statusCode?: int32(name='statusCode'),
body?: VoiceModerationResultResponseBody(name='body'),
}
/**
* @summary Obtains the moderation results of a Voice Moderation 2.0 task.
*
* @param request VoiceModerationResultRequest
* @param runtime runtime options for this request RuntimeOptions
* @return VoiceModerationResultResponse
*/
async function voiceModerationResultWithOptions(request: VoiceModerationResultRequest, runtime: Util.RuntimeOptions): VoiceModerationResultResponse {
Util.validateModel(request);
var body : map[string]any = {};
if (!Util.isUnset(request.service)) {
body['Service'] = request.service;
}
if (!Util.isUnset(request.serviceParameters)) {
body['ServiceParameters'] = request.serviceParameters;
}
var req = new OpenApi.OpenApiRequest{
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'VoiceModerationResult',
version = '2022-03-02',
protocol = 'HTTPS',
pathname = '/',
method = 'POST',
authType = 'AK',
style = 'RPC',
reqBodyType = 'formData',
bodyType = 'json',
};
if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
return callApi(params, req, runtime);
} else {
return execute(params, req, runtime);
}
}
/**
* @summary Obtains the moderation results of a Voice Moderation 2.0 task.
*
* @param request VoiceModerationResultRequest
* @return VoiceModerationResultResponse
*/
async function voiceModerationResult(request: VoiceModerationResultRequest): VoiceModerationResultResponse {
var runtime = new Util.RuntimeOptions{};
return voiceModerationResultWithOptions(request, runtime);
}