tencentcloud-sdk-tmt 1.0.311 → 1.0.314
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 +4 -4
- data/lib/VERSION +1 -1
- data/lib/v20180321/client.rb +50 -0
- data/lib/v20180321/models.rb +184 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dc72fd8ccfad06c0204a4f1d550fd7b51bb5fde
|
4
|
+
data.tar.gz: 0d0dbc70f98f3a7c3f0d77b3e46b1e0c97788829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1700326f06c6a952019085c1ee3e8d377dda2129c99944df2bd147d2365298b5c2646850b0263d021efe2080a4688b91786dbd0a3529a42948c83d51f3899d2
|
7
|
+
data.tar.gz: 14508859282986048d89ab3a0e68ed8102ad064dcfc7b47c148a2a2755cd4fe6f4d85db5ed3b3aa21278521311bbdc4e2721e44fe4c057a5bed53e28c2670036
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.314
|
data/lib/v20180321/client.rb
CHANGED
@@ -29,6 +29,56 @@ module TencentCloud
|
|
29
29
|
end
|
30
30
|
|
31
31
|
|
32
|
+
# 提交文档原文内容,输出任务ID, 支持原文为单一语种文档(如出现多语言文档,仅支持以选定的源语言相关内容翻译),文件格式有pdf、docx、pptx、xlsx,支持的文本格式有txt、xml、html、markdown、properties。
|
33
|
+
|
34
|
+
# @param request: Request instance for FileTranslate.
|
35
|
+
# @type request: :class:`Tencentcloud::tmt::V20180321::FileTranslateRequest`
|
36
|
+
# @rtype: :class:`Tencentcloud::tmt::V20180321::FileTranslateResponse`
|
37
|
+
def FileTranslate(request)
|
38
|
+
body = send_request('FileTranslate', request.serialize)
|
39
|
+
response = JSON.parse(body)
|
40
|
+
if response['Response'].key?('Error') == false
|
41
|
+
model = FileTranslateResponse.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
|
+
# 在调用文档翻译请求接口后,有回调和轮询两种方式获取识别结果。
|
57
|
+
# •当采用回调方式时,翻译完成后会将结果通过 POST 请求的形式通知到用户在请求时填写的回调 URL,具体请参见文档翻译结果回调 。
|
58
|
+
# • 当采用轮询方式时,需要主动提交任务ID来轮询识别结果,共有任务成功、等待、执行中和失败四种结果,具体信息请参见参数说明。
|
59
|
+
|
60
|
+
# @param request: Request instance for GetFileTranslate.
|
61
|
+
# @type request: :class:`Tencentcloud::tmt::V20180321::GetFileTranslateRequest`
|
62
|
+
# @rtype: :class:`Tencentcloud::tmt::V20180321::GetFileTranslateResponse`
|
63
|
+
def GetFileTranslate(request)
|
64
|
+
body = send_request('GetFileTranslate', request.serialize)
|
65
|
+
response = JSON.parse(body)
|
66
|
+
if response['Response'].key?('Error') == false
|
67
|
+
model = GetFileTranslateResponse.new
|
68
|
+
model.deserialize(response['Response'])
|
69
|
+
model
|
70
|
+
else
|
71
|
+
code = response['Response']['Error']['Code']
|
72
|
+
message = response['Response']['Error']['Message']
|
73
|
+
reqid = response['Response']['RequestId']
|
74
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
|
75
|
+
end
|
76
|
+
rescue TencentCloud::Common::TencentCloudSDKException => e
|
77
|
+
raise e
|
78
|
+
rescue StandardError => e
|
79
|
+
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
|
80
|
+
end
|
81
|
+
|
32
82
|
# 提供13种语言的图片翻译服务,可自动识别图片中的文本内容并翻译成目标语言,识别后的文本按行翻译,后续会提供可按段落翻译的版本。<br />
|
33
83
|
# 提示:对于一般开发者,我们建议优先使用SDK接入简化开发。SDK使用介绍请直接查看 5. 开发者资源 部分。
|
34
84
|
|
data/lib/v20180321/models.rb
CHANGED
@@ -17,6 +17,174 @@
|
|
17
17
|
module TencentCloud
|
18
18
|
module Tmt
|
19
19
|
module V20180321
|
20
|
+
# FileTranslate请求参数结构体
|
21
|
+
class FileTranslateRequest < TencentCloud::Common::AbstractModel
|
22
|
+
# @param Source: 源语言,支持
|
23
|
+
# zh:简体中文
|
24
|
+
# zh-HK:繁体中文
|
25
|
+
# zh-TW : 繁体中文
|
26
|
+
# zh-TR: 繁体中文
|
27
|
+
# en :英语
|
28
|
+
# ar:阿拉伯语
|
29
|
+
# de:德语
|
30
|
+
# es:西班牙语
|
31
|
+
# fr:法语
|
32
|
+
# it:意大利语
|
33
|
+
# ja:日语
|
34
|
+
# pt:葡萄牙语
|
35
|
+
# ru:俄语
|
36
|
+
# ko:韩语
|
37
|
+
# km:高棉语
|
38
|
+
# lo:老挝语
|
39
|
+
# @type Source: String
|
40
|
+
# @param Target: 目标语言,各源语言的目标语言支持列表如下
|
41
|
+
# zh(简体中文): en (英语)、 ar (阿拉伯语)、 de (德语)、 es(西班牙语) 、fr(法语)、 it(意大利语) 、 ja (日语)、 pt (葡萄牙语)、 ru(俄语)、 ko(韩语)、 km(高棉语)、 lo(老挝语)
|
42
|
+
# zh-HK(繁体中文) :en (英语)、 ar (阿拉伯语)、 de (德语)、 es(西班牙语) 、fr(法语)、 it(意大利语) 、 ja (日语)、 pt (葡萄牙语)、 ru(俄语)、 ko(韩语)、 km(高棉语)、 lo(老挝语)
|
43
|
+
# zh-TW(繁体中文):en (英语)、 ar (阿拉伯语)、 de (德语)、 es(西班牙语) 、fr(法语)、 it(意大利语) 、 ja (日语)、 pt (葡萄牙语)、 ru(俄语)、 ko(韩语)、 km(高棉语)、 lo(老挝语)
|
44
|
+
# zh-TR 繁体中文 : en (英语)、 ar (阿拉伯语)、 de (德语)、 es(西班牙语) 、fr(法语)、 it(意大利语) 、 ja (日语)、 pt (葡萄牙语)、 ru(俄语)、 ko(韩语)、 km(高棉语)、 lo(老挝语)
|
45
|
+
# en (英语) :zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、 zh-TR(繁体中文)、 ar (阿拉伯语)、 de (德语)、 es(西班牙语) 、fr(法语)、 it(意大利语) 、 ja (日语)、 pt (葡萄牙语)、 ru(俄语)、 ko(韩语)、 km(高棉语)、 lo(老挝语)
|
46
|
+
# ar(阿拉伯语) :zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
47
|
+
# de(德语 ):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
48
|
+
# es(西班牙语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
49
|
+
# fr(法语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
50
|
+
# it(意大利语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
51
|
+
# ja(日语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
52
|
+
# pt(葡萄牙语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
53
|
+
# ru(俄语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
54
|
+
# ko(韩语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
55
|
+
# km(高棉语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
56
|
+
# lo(老挝语):zh(简体中文)、zh-HK(繁体中文)、 zh-TW(繁体中文)、zh-TR(繁体中文)
|
57
|
+
# @type Target: String
|
58
|
+
# @param DocumentType: 文档类型:可支持以下几种(pdf,docx,pptx,xlsx,txt,xml,html,markdown,properties)
|
59
|
+
# @type DocumentType: String
|
60
|
+
# @param SourceType: 数据来源,0:url,1:直接传文件编码后数据
|
61
|
+
# @type SourceType: Integer
|
62
|
+
# @param Url: 需要翻译文件url
|
63
|
+
# @type Url: String
|
64
|
+
# @param BasicDocumentType: 原始文档类型
|
65
|
+
# @type BasicDocumentType: String
|
66
|
+
# @param CallbackUrl: 回调url
|
67
|
+
# @type CallbackUrl: String
|
68
|
+
# @param Data: 文件数据,当SourceType 值为1时必须填写,为0可不写。要base64编码(采用python语言时注意读取文件应该为string而不是byte,以byte格式读取后要decode()。编码后的数据不可带有回车换行符)。数据要小于5MB。
|
69
|
+
# @type Data: String
|
70
|
+
|
71
|
+
attr_accessor :Source, :Target, :DocumentType, :SourceType, :Url, :BasicDocumentType, :CallbackUrl, :Data
|
72
|
+
|
73
|
+
def initialize(source=nil, target=nil, documenttype=nil, sourcetype=nil, url=nil, basicdocumenttype=nil, callbackurl=nil, data=nil)
|
74
|
+
@Source = source
|
75
|
+
@Target = target
|
76
|
+
@DocumentType = documenttype
|
77
|
+
@SourceType = sourcetype
|
78
|
+
@Url = url
|
79
|
+
@BasicDocumentType = basicdocumenttype
|
80
|
+
@CallbackUrl = callbackurl
|
81
|
+
@Data = data
|
82
|
+
end
|
83
|
+
|
84
|
+
def deserialize(params)
|
85
|
+
@Source = params['Source']
|
86
|
+
@Target = params['Target']
|
87
|
+
@DocumentType = params['DocumentType']
|
88
|
+
@SourceType = params['SourceType']
|
89
|
+
@Url = params['Url']
|
90
|
+
@BasicDocumentType = params['BasicDocumentType']
|
91
|
+
@CallbackUrl = params['CallbackUrl']
|
92
|
+
@Data = params['Data']
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# FileTranslate返回参数结构体
|
97
|
+
class FileTranslateResponse < TencentCloud::Common::AbstractModel
|
98
|
+
# @param Data: 文件翻译的请求返回结果,包含结果查询需要的TaskId
|
99
|
+
# @type Data: :class:`Tencentcloud::Tmt.v20180321.models.Task`
|
100
|
+
# @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
|
101
|
+
# @type RequestId: String
|
102
|
+
|
103
|
+
attr_accessor :Data, :RequestId
|
104
|
+
|
105
|
+
def initialize(data=nil, requestid=nil)
|
106
|
+
@Data = data
|
107
|
+
@RequestId = requestid
|
108
|
+
end
|
109
|
+
|
110
|
+
def deserialize(params)
|
111
|
+
unless params['Data'].nil?
|
112
|
+
@Data = Task.new
|
113
|
+
@Data.deserialize(params['Data'])
|
114
|
+
end
|
115
|
+
@RequestId = params['RequestId']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# 查询文件翻译任务
|
120
|
+
class GetFileTranslateData < TencentCloud::Common::AbstractModel
|
121
|
+
# @param TaskId: 任务ID
|
122
|
+
# @type TaskId: String
|
123
|
+
# @param Status: 状态
|
124
|
+
# @type Status: String
|
125
|
+
# @param FileData: 文件数据
|
126
|
+
# 注意:此字段可能返回 null,表示取不到有效值。
|
127
|
+
# @type FileData: String
|
128
|
+
# @param Message: 错误提示
|
129
|
+
# 注意:此字段可能返回 null,表示取不到有效值。
|
130
|
+
# @type Message: String
|
131
|
+
|
132
|
+
attr_accessor :TaskId, :Status, :FileData, :Message
|
133
|
+
|
134
|
+
def initialize(taskid=nil, status=nil, filedata=nil, message=nil)
|
135
|
+
@TaskId = taskid
|
136
|
+
@Status = status
|
137
|
+
@FileData = filedata
|
138
|
+
@Message = message
|
139
|
+
end
|
140
|
+
|
141
|
+
def deserialize(params)
|
142
|
+
@TaskId = params['TaskId']
|
143
|
+
@Status = params['Status']
|
144
|
+
@FileData = params['FileData']
|
145
|
+
@Message = params['Message']
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# GetFileTranslate请求参数结构体
|
150
|
+
class GetFileTranslateRequest < TencentCloud::Common::AbstractModel
|
151
|
+
# @param TaskId: 任务ID
|
152
|
+
# @type TaskId: String
|
153
|
+
|
154
|
+
attr_accessor :TaskId
|
155
|
+
|
156
|
+
def initialize(taskid=nil)
|
157
|
+
@TaskId = taskid
|
158
|
+
end
|
159
|
+
|
160
|
+
def deserialize(params)
|
161
|
+
@TaskId = params['TaskId']
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# GetFileTranslate返回参数结构体
|
166
|
+
class GetFileTranslateResponse < TencentCloud::Common::AbstractModel
|
167
|
+
# @param Data: 任务id
|
168
|
+
# @type Data: :class:`Tencentcloud::Tmt.v20180321.models.GetFileTranslateData`
|
169
|
+
# @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
|
170
|
+
# @type RequestId: String
|
171
|
+
|
172
|
+
attr_accessor :Data, :RequestId
|
173
|
+
|
174
|
+
def initialize(data=nil, requestid=nil)
|
175
|
+
@Data = data
|
176
|
+
@RequestId = requestid
|
177
|
+
end
|
178
|
+
|
179
|
+
def deserialize(params)
|
180
|
+
unless params['Data'].nil?
|
181
|
+
@Data = GetFileTranslateData.new
|
182
|
+
@Data.deserialize(params['Data'])
|
183
|
+
end
|
184
|
+
@RequestId = params['RequestId']
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
20
188
|
# 图片翻译结果
|
21
189
|
class ImageRecord < TencentCloud::Common::AbstractModel
|
22
190
|
# @param Value: 图片翻译结果
|
@@ -302,6 +470,22 @@ module TencentCloud
|
|
302
470
|
end
|
303
471
|
end
|
304
472
|
|
473
|
+
# 文件翻译请求的返回数据
|
474
|
+
class Task < TencentCloud::Common::AbstractModel
|
475
|
+
# @param TaskId: 任务ID,可通过此ID在轮询接口获取识别状态与结果。注意:TaskId数据类型为字符串类型
|
476
|
+
# @type TaskId: String
|
477
|
+
|
478
|
+
attr_accessor :TaskId
|
479
|
+
|
480
|
+
def initialize(taskid=nil)
|
481
|
+
@TaskId = taskid
|
482
|
+
end
|
483
|
+
|
484
|
+
def deserialize(params)
|
485
|
+
@TaskId = params['TaskId']
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
305
489
|
# TextTranslateBatch请求参数结构体
|
306
490
|
class TextTranslateBatchRequest < TencentCloud::Common::AbstractModel
|
307
491
|
# @param Source: 源语言,支持:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tencentcloud-sdk-tmt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.314
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tencent Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tencentcloud-sdk-common
|