1// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package v20201229
16
17import (
18    "encoding/json"
19    "errors"
20
21    tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
22)
23
24type Device struct {
25
26	// 发表消息设备IP
27	Ip *string `json:"Ip,omitempty" name:"Ip"`
28
29	// Mac地址
30	Mac *string `json:"Mac,omitempty" name:"Mac"`
31
32	// 设备指纹Token
33	TokenId *string `json:"TokenId,omitempty" name:"TokenId"`
34
35	// 设备指纹ID
36	DeviceId *string `json:"DeviceId,omitempty" name:"DeviceId"`
37
38	// 设备序列号
39	IMEI *string `json:"IMEI,omitempty" name:"IMEI"`
40
41	// IOS设备,Identifier For Advertising(广告标识符)
42	IDFA *string `json:"IDFA,omitempty" name:"IDFA"`
43
44	// IOS设备,IDFV - Identifier For Vendor(应用开发商标识符)
45	IDFV *string `json:"IDFV,omitempty" name:"IDFV"`
46
47	// IP地址类型 0 代表ipv4 1 代表ipv6
48	IpType *uint64 `json:"IpType,omitempty" name:"IpType"`
49}
50
51type ImageModerationRequest struct {
52	*tchttp.BaseRequest
53
54	// 该字段用于标识业务场景。您可以在内容安全控制台创建对应的ID,配置不同的内容审核策略,通过接口调用,默认不填为0,后端使用默认策略。 -- 该字段暂未开放。
55	BizType *string `json:"BizType,omitempty" name:"BizType"`
56
57	// 数据ID,可以由英文字母、数字、下划线、-、@#组成,不超过64个字符
58	DataId *string `json:"DataId,omitempty" name:"DataId"`
59
60	// 数据Base64编码,图片检测接口为图片文件内容,大小不能超过5M
61	FileContent *string `json:"FileContent,omitempty" name:"FileContent"`
62
63	// 图片资源访问链接,__与FileContent参数必须二选一输入__
64	FileUrl *string `json:"FileUrl,omitempty" name:"FileUrl"`
65
66	// 截帧频率,GIF图/长图检测专用,默认值为0,表示只会检测GIF图/长图的第一帧
67	Interval *int64 `json:"Interval,omitempty" name:"Interval"`
68
69	// GIF图/长图检测专用,代表均匀最大截帧数量,默认值为1(即只取GIF第一张,或长图不做切分处理(可能会造成处理超时))。
70	MaxFrames *int64 `json:"MaxFrames,omitempty" name:"MaxFrames"`
71
72	// 账号相关信息字段,填入后可识别违规风险账号。
73	User *User `json:"User,omitempty" name:"User"`
74
75	// 设备相关信息字段,填入后可识别违规风险设备。
76	Device *Device `json:"Device,omitempty" name:"Device"`
77}
78
79func (r *ImageModerationRequest) ToJsonString() string {
80    b, _ := json.Marshal(r)
81    return string(b)
82}
83
84// It is highly **NOT** recommended to use this function
85// because it has no param check, nor strict type check
86func (r *ImageModerationRequest) FromJsonString(s string) error {
87	f := make(map[string]interface{})
88	if err := json.Unmarshal([]byte(s), &f); err != nil {
89		return err
90	}
91	delete(f, "BizType")
92	delete(f, "DataId")
93	delete(f, "FileContent")
94	delete(f, "FileUrl")
95	delete(f, "Interval")
96	delete(f, "MaxFrames")
97	delete(f, "User")
98	delete(f, "Device")
99	if len(f) > 0 {
100		return errors.New("ImageModerationRequest has unknown keys!")
101	}
102	return json.Unmarshal([]byte(s), &r)
103}
104
105type ImageModerationResponse struct {
106	*tchttp.BaseResponse
107	Response *struct {
108
109		// 建议您拿到判断结果后的执行操作。
110	// 建议值,Block:建议屏蔽,Review:建议复审,Pass:建议通过
111		Suggestion *string `json:"Suggestion,omitempty" name:"Suggestion"`
112
113		// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义图片。
114	// 以及其他令人反感、不安全或不适宜的内容类型。
115		Label *string `json:"Label,omitempty" name:"Label"`
116
117		// 子标签名称,如色情--性行为;当未命中子标签时,返回空字符串;
118		SubLabel *string `json:"SubLabel,omitempty" name:"SubLabel"`
119
120		// 机器判断当前分类的置信度,取值范围:0.00~100.00。分数越高,表示越有可能属于当前分类。
121	// (如:色情 99.99,则该样本属于色情的置信度非常高。)
122		Score *int64 `json:"Score,omitempty" name:"Score"`
123
124		// 智能模型的识别结果,包括涉黄、广告等令人反感、不安全或不适宜的内容类型识别结果。
125	// 注意:此字段可能返回 null,表示取不到有效值。
126		LabelResults []*LabelResult `json:"LabelResults,omitempty" name:"LabelResults" list`
127
128		// 物体检测模型的审核结果,包括实体、广告台标/二维码等物体坐标信息与内容审核信息。
129	// 注意:此字段可能返回 null,表示取不到有效值。
130		ObjectResults []*ObjectResult `json:"ObjectResults,omitempty" name:"ObjectResults" list`
131
132		// OCR识别后的文本识别结果,包括文本所处图片的OCR坐标信息以及图片文本的识别结果。
133	// 注意:此字段可能返回 null,表示取不到有效值。
134		OcrResults []*OcrResult `json:"OcrResults,omitempty" name:"OcrResults" list`
135
136		// 基于图片风险库识别的结果。
137	// 风险库包括不安全黑库与正常白库的结果。
138	// 注意:此字段可能返回 null,表示取不到有效值。
139		LibResults []*LibResult `json:"LibResults,omitempty" name:"LibResults" list`
140
141		// 请求参数中的DataId。
142		DataId *string `json:"DataId,omitempty" name:"DataId"`
143
144		// 您在入参时所填入的Biztype参数。 -- 该字段暂未开放。
145		BizType *string `json:"BizType,omitempty" name:"BizType"`
146
147		// 扩展字段,用于特定信息返回,不同客户/Biztype下返回信息不同。
148	// 注意:此字段可能返回 null,表示取不到有效值。
149	// 注意:此字段可能返回 null,表示取不到有效值。
150		Extra *string `json:"Extra,omitempty" name:"Extra"`
151
152		// 图片MD5值
153		FileMD5 *string `json:"FileMD5,omitempty" name:"FileMD5"`
154
155		// 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
156		RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
157	} `json:"Response"`
158}
159
160func (r *ImageModerationResponse) ToJsonString() string {
161    b, _ := json.Marshal(r)
162    return string(b)
163}
164
165// It is highly **NOT** recommended to use this function
166// because it has no param check, nor strict type check
167func (r *ImageModerationResponse) FromJsonString(s string) error {
168	return json.Unmarshal([]byte(s), &r)
169}
170
171type ImageRecognitionRequest struct {
172	*tchttp.BaseRequest
173
174	// 渠道ID,必须与主调账号一致,由天御分配并与API调用账号绑定
175	Channel *uint64 `json:"Channel,omitempty" name:"Channel"`
176
177	// 产品侧腾讯云用户账号AppId
178	CustomAppId *string `json:"CustomAppId,omitempty" name:"CustomAppId"`
179
180	// 该字段用于标识业务场景。您可以在内容安全控制台创建对应的ID,配置不同的内容审核策略,通过接口调用,默认不填为0,后端使用默认策略。 -- 该字段暂未开放。
181	BizType *string `json:"BizType,omitempty" name:"BizType"`
182
183	// 数据ID,可以由英文字母、数字、下划线、-、@#组成,不超过64个字符
184	DataId *string `json:"DataId,omitempty" name:"DataId"`
185
186	// 数据Base64编码,图片检测接口为图片文件内容,大小不能超过5M
187	FileContent *string `json:"FileContent,omitempty" name:"FileContent"`
188
189	// 图片资源访问链接,__与FileContent参数必须二选一输入__
190	FileUrl *string `json:"FileUrl,omitempty" name:"FileUrl"`
191
192	// 截帧频率,GIF图/长图检测专用,默认值为0,表示只会检测GIF图/长图的第一帧
193	Interval *int64 `json:"Interval,omitempty" name:"Interval"`
194
195	// GIF图/长图检测专用,代表均匀最大截帧数量,默认值为1(即只取GIF第一张,或长图不做切分处理(可能会造成处理超时))。
196	MaxFrames *int64 `json:"MaxFrames,omitempty" name:"MaxFrames"`
197
198	// 账号相关信息字段,填入后可识别违规风险账号。
199	User *User `json:"User,omitempty" name:"User"`
200
201	// 设备相关信息字段,填入后可识别违规风险设备。
202	Device *Device `json:"Device,omitempty" name:"Device"`
203
204	// 产品侧腾讯云用户账号Uin
205	CustomUin *string `json:"CustomUin,omitempty" name:"CustomUin"`
206
207	// 产品侧腾讯云用户子账号Uin
208	CustomSubAccountUin *string `json:"CustomSubAccountUin,omitempty" name:"CustomSubAccountUin"`
209
210	// 视频流ID
211	StreamId *string `json:"StreamId,omitempty" name:"StreamId"`
212}
213
214func (r *ImageRecognitionRequest) ToJsonString() string {
215    b, _ := json.Marshal(r)
216    return string(b)
217}
218
219// It is highly **NOT** recommended to use this function
220// because it has no param check, nor strict type check
221func (r *ImageRecognitionRequest) FromJsonString(s string) error {
222	f := make(map[string]interface{})
223	if err := json.Unmarshal([]byte(s), &f); err != nil {
224		return err
225	}
226	delete(f, "Channel")
227	delete(f, "CustomAppId")
228	delete(f, "BizType")
229	delete(f, "DataId")
230	delete(f, "FileContent")
231	delete(f, "FileUrl")
232	delete(f, "Interval")
233	delete(f, "MaxFrames")
234	delete(f, "User")
235	delete(f, "Device")
236	delete(f, "CustomUin")
237	delete(f, "CustomSubAccountUin")
238	delete(f, "StreamId")
239	if len(f) > 0 {
240		return errors.New("ImageRecognitionRequest has unknown keys!")
241	}
242	return json.Unmarshal([]byte(s), &r)
243}
244
245type ImageRecognitionResponse struct {
246	*tchttp.BaseResponse
247	Response *struct {
248
249		// 建议您拿到判断结果后的执行操作。
250	// 建议值,Block:建议屏蔽,Review:建议复审,Pass:建议通过
251		Suggestion *string `json:"Suggestion,omitempty" name:"Suggestion"`
252
253		// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义图片。
254	// 以及令人反感、不安全或不适宜的内容类型。
255		Label *string `json:"Label,omitempty" name:"Label"`
256
257		// 子标签名称,如色情--性行为;当未命中子标签时,返回空字符串;
258		SubLabel *string `json:"SubLabel,omitempty" name:"SubLabel"`
259
260		// 机器判断当前分类的置信度,取值范围:0.00~100.00。分数越高,表示越有可能属于当前分类。
261	// (如:色情 99.99,则该样本属于色情的置信度非常高。)
262		Score *int64 `json:"Score,omitempty" name:"Score"`
263
264		// 智能模型的识别结果,包括涉黄、广告等令人反感、不安全或不适宜的内容类型识别结果。
265	// 注意:此字段可能返回 null,表示取不到有效值。
266		LabelResults []*LabelResult `json:"LabelResults,omitempty" name:"LabelResults" list`
267
268		// 物体检测模型的审核结果,包括实体、广告台标/二维码等物体坐标信息与内容审核信息。
269	// 注意:此字段可能返回 null,表示取不到有效值。
270		ObjectResults []*ObjectResult `json:"ObjectResults,omitempty" name:"ObjectResults" list`
271
272		// OCR识别后的文本识别结果,包括文本所处图片的OCR坐标信息以及图片文本的识别结果。
273	// 注意:此字段可能返回 null,表示取不到有效值。
274		OcrResults []*OcrResult `json:"OcrResults,omitempty" name:"OcrResults" list`
275
276		// 基于图片风险库识别的结果。
277	// 风险库包括不安全黑库与正常白库的结果。
278	// 注意:此字段可能返回 null,表示取不到有效值。
279		LibResults []*LibResult `json:"LibResults,omitempty" name:"LibResults" list`
280
281		// 请求参数中的DataId。
282		DataId *string `json:"DataId,omitempty" name:"DataId"`
283
284		// 您在入参时所填入的Biztype参数。 -- 该字段暂未开放。
285		BizType *string `json:"BizType,omitempty" name:"BizType"`
286
287		// 扩展字段,用于特定信息返回,不同客户/Biztype下返回信息不同。
288	// 注意:此字段可能返回 null,表示取不到有效值。
289	// 注意:此字段可能返回 null,表示取不到有效值。
290		Extra *string `json:"Extra,omitempty" name:"Extra"`
291
292		// 图片MD5值
293		FileMD5 *string `json:"FileMD5,omitempty" name:"FileMD5"`
294
295		// 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
296		RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
297	} `json:"Response"`
298}
299
300func (r *ImageRecognitionResponse) ToJsonString() string {
301    b, _ := json.Marshal(r)
302    return string(b)
303}
304
305// It is highly **NOT** recommended to use this function
306// because it has no param check, nor strict type check
307func (r *ImageRecognitionResponse) FromJsonString(s string) error {
308	return json.Unmarshal([]byte(s), &r)
309}
310
311type LabelDetailItem struct {
312
313	// 序号
314	// 注意:此字段可能返回 null,表示取不到有效值。
315	Id *int64 `json:"Id,omitempty" name:"Id"`
316
317	// 子标签名称
318	// 注意:此字段可能返回 null,表示取不到有效值。
319	Name *string `json:"Name,omitempty" name:"Name"`
320
321	// 子标签分数
322	// 注意:此字段可能返回 null,表示取不到有效值。
323	Score *uint64 `json:"Score,omitempty" name:"Score"`
324}
325
326type LabelResult struct {
327
328	// 场景识别结果
329	Scene *string `json:"Scene,omitempty" name:"Scene"`
330
331	// 建议您拿到判断结果后的执行操作。
332	// 建议值,Block:建议屏蔽,Review:建议复审,Pass:建议通过
333	Suggestion *string `json:"Suggestion,omitempty" name:"Suggestion"`
334
335	// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义图片。
336	// 以及其他令人反感、不安全或不适宜的内容类型。
337	Label *string `json:"Label,omitempty" name:"Label"`
338
339	// 子标签检测结果
340	SubLabel *string `json:"SubLabel,omitempty" name:"SubLabel"`
341
342	// 该标签模型命中的分值
343	Score *uint64 `json:"Score,omitempty" name:"Score"`
344
345	// 分类模型命中子标签结果
346	// 注意:此字段可能返回 null,表示取不到有效值。
347	Details []*LabelDetailItem `json:"Details,omitempty" name:"Details" list`
348}
349
350type LibDetail struct {
351
352	// 序号
353	Id *int64 `json:"Id,omitempty" name:"Id"`
354
355	// 仅当Label为Custom自定义关键词时有效,表示自定义库id
356	LibId *string `json:"LibId,omitempty" name:"LibId"`
357
358	// 仅当Label为Custom自定义关键词时有效,表示自定义库名称
359	// 注意:此字段可能返回 null,表示取不到有效值。
360	LibName *string `json:"LibName,omitempty" name:"LibName"`
361
362	// 图片ID
363	ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
364
365	// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义词库。
366	// 以及其他其他令人反感、不安全或不适宜的内容类型。
367	Label *string `json:"Label,omitempty" name:"Label"`
368
369	// 自定义标签
370	// 注意:此字段可能返回 null,表示取不到有效值。
371	Tag *string `json:"Tag,omitempty" name:"Tag"`
372
373	// 命中的模型分值
374	Score *int64 `json:"Score,omitempty" name:"Score"`
375}
376
377type LibResult struct {
378
379	// 场景识别结果
380	Scene *string `json:"Scene,omitempty" name:"Scene"`
381
382	// 建议您拿到判断结果后的执行操作。
383	// 建议值,Block:建议屏蔽,Review:建议复审,Pass:建议通过
384	Suggestion *string `json:"Suggestion,omitempty" name:"Suggestion"`
385
386	// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义词库。
387	// 以及其他令人反感、不安全或不适宜的内容类型。
388	Label *string `json:"Label,omitempty" name:"Label"`
389
390	// 子标签检测结果
391	// 注意:此字段可能返回 null,表示取不到有效值。
392	SubLabel *string `json:"SubLabel,omitempty" name:"SubLabel"`
393
394	// 该标签模型命中的分值
395	Score *int64 `json:"Score,omitempty" name:"Score"`
396
397	// 黑白库结果明细
398	// 注意:此字段可能返回 null,表示取不到有效值。
399	Details []*LibDetail `json:"Details,omitempty" name:"Details" list`
400}
401
402type Location struct {
403
404	// 左上角横坐标
405	X *float64 `json:"X,omitempty" name:"X"`
406
407	// 左上角纵坐标
408	Y *float64 `json:"Y,omitempty" name:"Y"`
409
410	// 宽度
411	Width *float64 `json:"Width,omitempty" name:"Width"`
412
413	// 高度
414	Height *float64 `json:"Height,omitempty" name:"Height"`
415
416	// 检测框的旋转角度
417	Rotate *float64 `json:"Rotate,omitempty" name:"Rotate"`
418}
419
420type ObjectDetail struct {
421
422	// 序号
423	Id *uint64 `json:"Id,omitempty" name:"Id"`
424
425	// 标签名称
426	Name *string `json:"Name,omitempty" name:"Name"`
427
428	// 标签值,
429	// 当标签为二维码时,表示URL地址,如Name为QrCode时,Value为"http//abc.com/aaa"
430	Value *string `json:"Value,omitempty" name:"Value"`
431
432	// 分数
433	Score *uint64 `json:"Score,omitempty" name:"Score"`
434
435	// 检测框坐标
436	Location *Location `json:"Location,omitempty" name:"Location"`
437}
438
439type ObjectResult struct {
440
441	// 场景识别结果
442	Scene *string `json:"Scene,omitempty" name:"Scene"`
443
444	// 建议您拿到判断结果后的执行操作。
445	// 建议值,Block:建议屏蔽,Review:建议复审,Pass:建议通过
446	Suggestion *string `json:"Suggestion,omitempty" name:"Suggestion"`
447
448	// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义图片。
449	// 以及其他令人反感、不安全或不适宜的内容类型。
450	Label *string `json:"Label,omitempty" name:"Label"`
451
452	// 子标签检测结果
453	SubLabel *string `json:"SubLabel,omitempty" name:"SubLabel"`
454
455	// 该标签模型命中的分值
456	Score *uint64 `json:"Score,omitempty" name:"Score"`
457
458	// 实体名称
459	// 注意:此字段可能返回 null,表示取不到有效值。
460	Names []*string `json:"Names,omitempty" name:"Names" list`
461
462	// 实体检测结果明细
463	// 注意:此字段可能返回 null,表示取不到有效值。
464	Details []*ObjectDetail `json:"Details,omitempty" name:"Details" list`
465}
466
467type OcrResult struct {
468
469	// 场景识别结果
470	Scene *string `json:"Scene,omitempty" name:"Scene"`
471
472	// 建议您拿到判断结果后的执行操作。
473	// 建议值,Block:建议屏蔽,Review:建议复审,Pass:建议通过
474	Suggestion *string `json:"Suggestion,omitempty" name:"Suggestion"`
475
476	// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义词库。
477	// 以及其他令人反感、不安全或不适宜的内容类型。
478	Label *string `json:"Label,omitempty" name:"Label"`
479
480	// 子标签检测结果
481	SubLabel *string `json:"SubLabel,omitempty" name:"SubLabel"`
482
483	// 该标签模型命中的分值
484	Score *uint64 `json:"Score,omitempty" name:"Score"`
485
486	// ocr结果详情
487	// 注意:此字段可能返回 null,表示取不到有效值。
488	Details []*OcrTextDetail `json:"Details,omitempty" name:"Details" list`
489
490	// ocr识别出的文本结果
491	Text *string `json:"Text,omitempty" name:"Text"`
492}
493
494type OcrTextDetail struct {
495
496	// OCR文本内容
497	Text *string `json:"Text,omitempty" name:"Text"`
498
499	// 恶意标签,Normal:正常,Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义词库。
500	// 以及其他令人反感、不安全或不适宜的内容类型。
501	Label *string `json:"Label,omitempty" name:"Label"`
502
503	// 仅当Label为Custom自定义关键词时有效,表示自定义库id
504	LibId *string `json:"LibId,omitempty" name:"LibId"`
505
506	// 仅当Label为Custom自定义关键词时有效,表示自定义库名称
507	LibName *string `json:"LibName,omitempty" name:"LibName"`
508
509	// 该标签下命中的关键词
510	Keywords []*string `json:"Keywords,omitempty" name:"Keywords" list`
511
512	// 该标签模型命中的分值
513	Score *uint64 `json:"Score,omitempty" name:"Score"`
514
515	// OCR位置
516	Location *Location `json:"Location,omitempty" name:"Location"`
517
518	// OCR文本识别置信度
519	Rate *uint64 `json:"Rate,omitempty" name:"Rate"`
520}
521
522type User struct {
523
524	// 业务用户ID 如填写,会根据账号历史恶意情况,判定消息有害结果,特别是有利于可疑恶意情况下的辅助判断。账号可以填写微信uin、QQ号、微信openid、QQopenid、字符串等。该字段和账号类别确定唯一账号。
525	UserId *string `json:"UserId,omitempty" name:"UserId"`
526
527	// 业务用户ID类型 "1-微信uin 2-QQ号 3-微信群uin 4-qq群号 5-微信openid 6-QQopenid 7-其它string"
528	AccountType *string `json:"AccountType,omitempty" name:"AccountType"`
529
530	// 用户昵称
531	Nickname *string `json:"Nickname,omitempty" name:"Nickname"`
532
533	// 性别 默认0 未知 1 男性 2 女性
534	Gender *uint64 `json:"Gender,omitempty" name:"Gender"`
535
536	// 年龄 默认0 未知
537	Age *uint64 `json:"Age,omitempty" name:"Age"`
538
539	// 用户等级,默认0 未知 1 低 2 中 3 高
540	Level *uint64 `json:"Level,omitempty" name:"Level"`
541
542	// 手机号
543	Phone *string `json:"Phone,omitempty" name:"Phone"`
544
545	// 用户简介,长度不超过5000字
546	Desc *string `json:"Desc,omitempty" name:"Desc"`
547
548	// 用户头像图片链接
549	HeadUrl *string `json:"HeadUrl,omitempty" name:"HeadUrl"`
550}
551