# frozen_string_literal: true # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'json' module TencentCloud module Gme module V20180711 class Client < TencentCloud::Common::AbstractClient def initialize(credential, region, profile = nil) api_version = '2018-07-11' api_endpoint = 'gme.tencentcloudapi.com' sdk_version = 'GME_' + File.read(File.expand_path('../VERSION', __dir__)).strip super(credential, region, api_version, api_endpoint, sdk_version, profile) end # 用于创建年龄语音识别任务的接口,请求频率10次/秒。该接口目前通过白名单开放试用,如有需求,请提交工单申请。 # #
如果在提交语音检测任务时未设置 Callback 字段,则需要通过本接口获取检测结果
# @param request: Request instance for DescribeScanResultList. # @type request: :class:`Tencentcloud::gme::V20180711::DescribeScanResultListRequest` # @rtype: :class:`Tencentcloud::gme::V20180711::DescribeScanResultListResponse` def DescribeScanResultList(request) body = send_request('DescribeScanResultList', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeScanResultListResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 拉取用户在房间得进出时间 # @param request: Request instance for DescribeUserInAndOutTime. # @type request: :class:`Tencentcloud::gme::V20180711::DescribeUserInAndOutTimeRequest` # @rtype: :class:`Tencentcloud::gme::V20180711::DescribeUserInAndOutTimeResponse` def DescribeUserInAndOutTime(request) body = send_request('DescribeUserInAndOutTime', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeUserInAndOutTimeResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 本接口(ModifyAppStatus)用于修改应用总开关状态。 # @param request: Request instance for ModifyAppStatus. # @type request: :class:`Tencentcloud::gme::V20180711::ModifyAppStatusRequest` # @rtype: :class:`Tencentcloud::gme::V20180711::ModifyAppStatusResponse` def ModifyAppStatus(request) body = send_request('ModifyAppStatus', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = ModifyAppStatusResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 修改房间信息 # @param request: Request instance for ModifyRoomInfo. # @type request: :class:`Tencentcloud::gme::V20180711::ModifyRoomInfoRequest` # @rtype: :class:`Tencentcloud::gme::V20180711::ModifyRoomInfoResponse` def ModifyRoomInfo(request) body = send_request('ModifyRoomInfo', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = ModifyRoomInfoResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 本接口(ScanVoice)用于提交语音检测任务,检测任务列表最多支持100个。使用前请您登录[控制台 - 服务配置](https://console.cloud.tencent.com/gamegme/conf)开启语音分析服务。 # #提交语音检测任务时,需要指定 Scenes 场景参数,目前要求您设置 Scenes 参数值为:["default"];而在检测结果中,则包含请求时指定的场景,以及对应类型的检测结果。
#场景 | #描述 | #Label | #
---|---|---|
语音检测 | #语音检测的检测类型 | #
# normal:正常文本 #porn:色情 #abuse:谩骂 #ad :广告 #contraband :违禁 #customized:自定义词库。目前白名单开放,如有需要请联系我们。 # |
#
名称 | #类型 | #是否必需 | #描述 | #
---|---|---|---|
Signatue | #string | #是 | #签名,具体见签名生成说明 | #
{
# "Code": 0,
# "DataId": "1400000000_test_data_id",
# "ScanFinishTime": 1566720906,
# "HitFlag": true,
# "Live": false,
# "Msg": "",
# "ScanPiece": [{
# "DumpUrl": "",
# "HitFlag": true,
# "MainType": "abuse",
# "RoomId": "123",
# "OpenId": "xxx",
# "Info":"",
# "Offset": 0,
# "Duration": 3400,
# "PieceStartTime":1574684231,
# "ScanDetail": [{
# "EndTime": 1110,
# "KeyWord": "xxx",
# "Label": "abuse",
# "Rate": "90.00",
# "StartTime": 1110
# }, {
# "EndTime": 1380,
# "KeyWord": "xxx",
# "Label": "abuse",
# "Rate": "90.00",
# "StartTime": 930
# }, {
# "EndTime": 1560,
# "KeyWord": "xxx",
# "Label": "abuse",
# "Rate": "90.00",
# "StartTime": 930
# }, {
# "EndTime": 2820,
# "KeyWord": "xxx",
# "Label": "abuse",
# "Rate": "90.00",
# "StartTime": 2490
# }]
# }],
# "ScanStartTime": 1566720905,
# "Scenes": [
# "default"
# ],
# "Status": "Success",
# "TaskId": "xxx",
# "Url": "https://xxx/xxx.m4a"
# }
#
# @param request: Request instance for ScanVoice.
# @type request: :class:`Tencentcloud::gme::V20180711::ScanVoiceRequest`
# @rtype: :class:`Tencentcloud::gme::V20180711::ScanVoiceResponse`
def ScanVoice(request)
body = send_request('ScanVoice', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ScanVoiceResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 更新自定义送检房间号
# @param request: Request instance for UpdateScanRooms.
# @type request: :class:`Tencentcloud::gme::V20180711::UpdateScanRoomsRequest`
# @rtype: :class:`Tencentcloud::gme::V20180711::UpdateScanRoomsResponse`
def UpdateScanRooms(request)
body = send_request('UpdateScanRooms', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = UpdateScanRoomsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 更新自定义送检用户号
# @param request: Request instance for UpdateScanUsers.
# @type request: :class:`Tencentcloud::gme::V20180711::UpdateScanUsersRequest`
# @rtype: :class:`Tencentcloud::gme::V20180711::UpdateScanUsersResponse`
def UpdateScanUsers(request)
body = send_request('UpdateScanUsers', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = UpdateScanUsersResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 本接口用于识别涉黄等违规音频,成功会回调配置在应用的回调地址。回调示例如下:
# {"BizId":0,"FileId":"test_file_id","FileName":"test_file_name","FileUrl":"test_file_url","OpenId":"test_open_id","TimeStamp":"0000-00-00 00:00:00","Data":[{"Type":1,"Word":"xx"}]}
# Type表示过滤类型,1:色情,2:谩骂
# @param request: Request instance for VoiceFilter.
# @type request: :class:`Tencentcloud::gme::V20180711::VoiceFilterRequest`
# @rtype: :class:`Tencentcloud::gme::V20180711::VoiceFilterResponse`
def VoiceFilter(request)
body = send_request('VoiceFilter', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = VoiceFilterResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
end
end
end
end