tencentcloud-sdk-ams 1.0.200
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/VERSION +1 -0
- data/lib/tencentcloud-sdk-ams.rb +14 -0
- data/lib/v20200608/client.rb +231 -0
- data/lib/v20200608/models.rb +1503 -0
- data/lib/v20201229/client.rb +192 -0
- data/lib/v20201229/models.rb +1055 -0
- metadata +68 -0
@@ -0,0 +1,192 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'json'
|
18
|
+
|
19
|
+
module TencentCloud
|
20
|
+
module Ams
|
21
|
+
module V20201229
|
22
|
+
class Client < TencentCloud::Common::AbstractClient
|
23
|
+
|
24
|
+
def initialize(credential, region, profile = nil)
|
25
|
+
api_version = '2020-12-29'
|
26
|
+
api_endpoint = 'ams.tencentcloudapi.com'
|
27
|
+
sdk_version = 'AMS_' + File.read(File.expand_path('../VERSION', __dir__)).strip
|
28
|
+
super(credential, region, api_version, api_endpoint, sdk_version, profile)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# 可使用该接口取消审核任务。请求成功后,接口返回RequestId则说明取消成功。<br>默认接口请求频率限制:**20次/秒**。
|
33
|
+
|
34
|
+
# @param request: Request instance for CancelTask.
|
35
|
+
# @type request: :class:`Tencentcloud::ams::V20201229::CancelTaskRequest`
|
36
|
+
# @rtype: :class:`Tencentcloud::ams::V20201229::CancelTaskResponse`
|
37
|
+
def CancelTask(request)
|
38
|
+
body = send_request('CancelTask', request.serialize)
|
39
|
+
response = JSON.parse(body)
|
40
|
+
if response['Response'].key?('Error') == false
|
41
|
+
model = CancelTaskResponse.new
|
42
|
+
model.deserialize(response['Response'])
|
43
|
+
model
|
44
|
+
else
|
45
|
+
code = response['Response']['Error']['Code']
|
46
|
+
message = response['Response']['Error']['Message']
|
47
|
+
reqid = response['Response']['RequestId']
|
48
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
49
|
+
end
|
50
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
51
|
+
raise e
|
52
|
+
rescue StandardError => e
|
53
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
54
|
+
end
|
55
|
+
|
56
|
+
# 本接口(CreateAudioModerationSyncTask) 用于提交短音频内容进行智能审核任务,使用前请您登录控制台开通音频内容安全服务。
|
57
|
+
|
58
|
+
# 功能使用说明:
|
59
|
+
# 前往“内容安全控制台-音频内容安全”开启使用音频内容安全服务,首次开通可获得10小时免费调用时长;
|
60
|
+
|
61
|
+
# 接口限制:
|
62
|
+
# - 音频文件大小支持:文件 < 5M;
|
63
|
+
# - 音频文件时长小于60s,超过60s音频调用则报错;
|
64
|
+
# - 音频码率类型支持:8Kbps - 16Kbps;
|
65
|
+
# - 音频文件支持格式:wav、mp3;
|
66
|
+
# - 接口仅限音频文件传入,视频文件传入请调用长音频异步接口;
|
67
|
+
# - 接口默认QPS为10,默认接口请求频率限制20次/秒,如需要更高的并发或请求频率,请工单咨询;
|
68
|
+
# - 接口超时为5s,每一次请求超过该时长会报错;
|
69
|
+
|
70
|
+
# @param request: Request instance for CreateAudioModerationSyncTask.
|
71
|
+
# @type request: :class:`Tencentcloud::ams::V20201229::CreateAudioModerationSyncTaskRequest`
|
72
|
+
# @rtype: :class:`Tencentcloud::ams::V20201229::CreateAudioModerationSyncTaskResponse`
|
73
|
+
def CreateAudioModerationSyncTask(request)
|
74
|
+
body = send_request('CreateAudioModerationSyncTask', request.serialize)
|
75
|
+
response = JSON.parse(body)
|
76
|
+
if response['Response'].key?('Error') == false
|
77
|
+
model = CreateAudioModerationSyncTaskResponse.new
|
78
|
+
model.deserialize(response['Response'])
|
79
|
+
model
|
80
|
+
else
|
81
|
+
code = response['Response']['Error']['Code']
|
82
|
+
message = response['Response']['Error']['Message']
|
83
|
+
reqid = response['Response']['RequestId']
|
84
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
85
|
+
end
|
86
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
87
|
+
raise e
|
88
|
+
rescue StandardError => e
|
89
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
90
|
+
end
|
91
|
+
|
92
|
+
# 本接口(Audio Moderation)用于提交音频内容(包括音频文件或流地址)进行智能审核任务,使用前请您使用腾讯云主账号登录控制台[开通音频内容安全服务](https://console.cloud.tencent.com/cms/audio/package)并调整好对应的业务配置。<br>
|
93
|
+
|
94
|
+
# ### 功能使用说明:
|
95
|
+
# - 前往“[内容安全控制台-音频内容安全](https://console.cloud.tencent.com/cms/audio/package)”开启使用音频内容安全服务,首次开通可获得**10小时**免费调用时长,有效期为1个月。
|
96
|
+
# - 默认接口请求频率限制:**20次/秒**;对于异步审核任务(点播音频),超出频率限制的请求会自动排入待审核队列,对于同步审核任务(直播音频),超出频率限制将会报错。
|
97
|
+
|
98
|
+
# ### 接口功能说明:
|
99
|
+
# - 支持对音频流或音频文件进行检测,判断其中是否包含违规内容;
|
100
|
+
# - 支持设置回调地址 Callback 获取检测结果(对于已在审核的任务,最长回调时间为用户配置的**切片时长 + 2s**),或通过接口(查询音频检测结果)主动轮询获取检测结果;
|
101
|
+
# - 支持识别违规内容,包括:低俗、谩骂、色情、涉政、广告等场景;
|
102
|
+
# - 支持批量提交检测任务,检测任务列表**最多支持10个**。
|
103
|
+
|
104
|
+
# ### 音频文件调用说明:
|
105
|
+
# - 音频文件大小支持:**文件 < 500M**;
|
106
|
+
# - 音频文件时长支持:**< 1小时**;
|
107
|
+
# - 音频码率类型支持:128 Kbps - 256 Kbps ;
|
108
|
+
# - 音频文件支持格式:wav、mp3、aac、flac、amr、3gp、 m4a、wma、ogg、ape;
|
109
|
+
# - (**当输入为视频文件时**)支持分离视频文件音轨,并对音频内容进行独立审核。
|
110
|
+
|
111
|
+
# ### 音频流调用说明:
|
112
|
+
# - 音频流时长支持:**< 3小时**;
|
113
|
+
# - 音频码率类型支持:128 Kbps - 256 Kbps ;
|
114
|
+
# - 音频流支持的传输协议:RTMP、HTTP、HTTPS;
|
115
|
+
# - 音频流格式支持的类型:rtp、srtp、rtmp、rtmps、mmsh、 mmst、hls、http、tcp、https、m3u8;
|
116
|
+
# - (**当输入为视频流时**)支持提取视频流音轨,并对音频内容进行独立审核。
|
117
|
+
|
118
|
+
# @param request: Request instance for CreateAudioModerationTask.
|
119
|
+
# @type request: :class:`Tencentcloud::ams::V20201229::CreateAudioModerationTaskRequest`
|
120
|
+
# @rtype: :class:`Tencentcloud::ams::V20201229::CreateAudioModerationTaskResponse`
|
121
|
+
def CreateAudioModerationTask(request)
|
122
|
+
body = send_request('CreateAudioModerationTask', request.serialize)
|
123
|
+
response = JSON.parse(body)
|
124
|
+
if response['Response'].key?('Error') == false
|
125
|
+
model = CreateAudioModerationTaskResponse.new
|
126
|
+
model.deserialize(response['Response'])
|
127
|
+
model
|
128
|
+
else
|
129
|
+
code = response['Response']['Error']['Code']
|
130
|
+
message = response['Response']['Error']['Message']
|
131
|
+
reqid = response['Response']['RequestId']
|
132
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
133
|
+
end
|
134
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
135
|
+
raise e
|
136
|
+
rescue StandardError => e
|
137
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
138
|
+
end
|
139
|
+
|
140
|
+
# 通过该接口可查看音频审核任务的详情信息,包括任务状态、检测结果、音频文件识别出的对应文本内容、检测结果所对应的恶意标签及推荐的后续操作等,具体输出内容可查看输出参数示例。<br>默认接口请求频率限制:**100次/秒**。
|
141
|
+
|
142
|
+
# @param request: Request instance for DescribeTaskDetail.
|
143
|
+
# @type request: :class:`Tencentcloud::ams::V20201229::DescribeTaskDetailRequest`
|
144
|
+
# @rtype: :class:`Tencentcloud::ams::V20201229::DescribeTaskDetailResponse`
|
145
|
+
def DescribeTaskDetail(request)
|
146
|
+
body = send_request('DescribeTaskDetail', request.serialize)
|
147
|
+
response = JSON.parse(body)
|
148
|
+
if response['Response'].key?('Error') == false
|
149
|
+
model = DescribeTaskDetailResponse.new
|
150
|
+
model.deserialize(response['Response'])
|
151
|
+
model
|
152
|
+
else
|
153
|
+
code = response['Response']['Error']['Code']
|
154
|
+
message = response['Response']['Error']['Message']
|
155
|
+
reqid = response['Response']['RequestId']
|
156
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
157
|
+
end
|
158
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
159
|
+
raise e
|
160
|
+
rescue StandardError => e
|
161
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
162
|
+
end
|
163
|
+
|
164
|
+
# 通过该接口可查看审核任务列表;您也可根据多种业务信息(业务类型、审核结果、任务状态等)筛选审核任务列表。任务列表输出内容包括当前查询的任务总量、任务名称、任务状态、音频审核类型、基于检测结果的恶意标签及其后续操作等,具体输出内容可查看输出参数示例。<br>默认接口请求频率限制:**20次/秒**。
|
165
|
+
|
166
|
+
# @param request: Request instance for DescribeTasks.
|
167
|
+
# @type request: :class:`Tencentcloud::ams::V20201229::DescribeTasksRequest`
|
168
|
+
# @rtype: :class:`Tencentcloud::ams::V20201229::DescribeTasksResponse`
|
169
|
+
def DescribeTasks(request)
|
170
|
+
body = send_request('DescribeTasks', request.serialize)
|
171
|
+
response = JSON.parse(body)
|
172
|
+
if response['Response'].key?('Error') == false
|
173
|
+
model = DescribeTasksResponse.new
|
174
|
+
model.deserialize(response['Response'])
|
175
|
+
model
|
176
|
+
else
|
177
|
+
code = response['Response']['Error']['Code']
|
178
|
+
message = response['Response']['Error']['Message']
|
179
|
+
reqid = response['Response']['RequestId']
|
180
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
181
|
+
end
|
182
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
183
|
+
raise e
|
184
|
+
rescue StandardError => e
|
185
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|