tccli 3.0.1135.1__py2.py3-none-any.whl → 3.0.1137.1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/command.py +4 -1
  3. tccli/help_command.py +4 -1
  4. tccli/services/__init__.py +3 -0
  5. tccli/services/asr/asr_client.py +53 -0
  6. tccli/services/asr/v20190614/api.json +193 -1
  7. tccli/services/asr/v20190614/examples.json +8 -0
  8. tccli/services/batch/v20170312/api.json +8 -5
  9. tccli/services/batch/v20170312/examples.json +1 -1
  10. tccli/services/cdb/v20170320/api.json +3 -3
  11. tccli/services/ckafka/v20190819/api.json +1 -1
  12. tccli/services/cls/v20201016/api.json +93 -0
  13. tccli/services/cwp/cwp_client.py +0 -53
  14. tccli/services/cwp/v20180228/api.json +0 -43
  15. tccli/services/cwp/v20180228/examples.json +0 -8
  16. tccli/services/cynosdb/v20190107/api.json +10 -0
  17. tccli/services/dlc/dlc_client.py +53 -0
  18. tccli/services/dlc/v20210125/api.json +157 -23
  19. tccli/services/dlc/v20210125/examples.json +14 -6
  20. tccli/services/dsgc/v20190723/api.json +35 -35
  21. tccli/services/dts/v20211206/api.json +3 -3
  22. tccli/services/eiam/v20210420/api.json +4 -4
  23. tccli/services/eiam/v20210420/examples.json +4 -4
  24. tccli/services/ess/v20201111/api.json +1 -1
  25. tccli/services/essbasic/v20210526/api.json +4 -4
  26. tccli/services/faceid/v20180301/api.json +1 -1
  27. tccli/services/ioa/ioa_client.py +159 -0
  28. tccli/services/ioa/v20220601/api.json +897 -80
  29. tccli/services/ioa/v20220601/examples.json +24 -0
  30. tccli/services/iotexplorer/iotexplorer_client.py +231 -19
  31. tccli/services/iotexplorer/v20190423/api.json +332 -0
  32. tccli/services/iotexplorer/v20190423/examples.json +32 -0
  33. tccli/services/lighthouse/v20200324/api.json +14 -14
  34. tccli/services/lighthouse/v20200324/examples.json +7 -7
  35. tccli/services/live/v20180801/api.json +12 -6
  36. tccli/services/lke/lke_client.py +175 -16
  37. tccli/services/lke/v20231130/api.json +429 -4
  38. tccli/services/lke/v20231130/examples.json +24 -0
  39. tccli/services/ocr/v20181119/api.json +3 -3
  40. tccli/services/partners/v20180321/api.json +26 -16
  41. tccli/services/tcr/v20190924/api.json +57 -35
  42. tccli/services/tcr/v20190924/examples.json +4 -4
  43. tccli/services/tcss/v20201101/api.json +123 -13
  44. tccli/services/tcss/v20201101/examples.json +3 -3
  45. tccli/services/tdmq/tdmq_client.py +53 -0
  46. tccli/services/tdmq/v20200217/api.json +301 -0
  47. tccli/services/tdmq/v20200217/examples.json +8 -0
  48. tccli/services/tem/v20210701/api.json +8 -5
  49. tccli/services/tem/v20210701/examples.json +2 -2
  50. tccli/services/tke/v20180525/api.json +13 -3
  51. tccli/services/trocket/trocket_client.py +65 -12
  52. tccli/services/trocket/v20230308/api.json +196 -0
  53. tccli/services/trocket/v20230308/examples.json +8 -0
  54. tccli/services/trtc/v20190722/api.json +45 -63
  55. tccli/services/tsi/__init__.py +4 -0
  56. tccli/services/tsi/tsi_client.py +301 -0
  57. tccli/services/tsi/v20210325/api.json +373 -0
  58. tccli/services/tsi/v20210325/examples.json +29 -0
  59. tccli/services/tts/v20190823/api.json +2 -2
  60. tccli/services/vpc/v20170312/api.json +36 -16
  61. tccli/services/vpc/v20170312/examples.json +9 -3
  62. tccli/services/waf/v20180125/api.json +70 -0
  63. tccli/services/waf/v20180125/examples.json +8 -0
  64. tccli/services/waf/waf_client.py +53 -0
  65. tccli/services/wedata/v20210820/api.json +377 -0
  66. tccli/services/wedata/v20210820/examples.json +8 -0
  67. tccli/services/wedata/wedata_client.py +61 -8
  68. {tccli-3.0.1135.1.dist-info → tccli-3.0.1137.1.dist-info}/METADATA +2 -2
  69. {tccli-3.0.1135.1.dist-info → tccli-3.0.1137.1.dist-info}/RECORD +72 -68
  70. {tccli-3.0.1135.1.dist-info → tccli-3.0.1137.1.dist-info}/WHEEL +0 -0
  71. {tccli-3.0.1135.1.dist-info → tccli-3.0.1137.1.dist-info}/entry_points.txt +0 -0
  72. {tccli-3.0.1135.1.dist-info → tccli-3.0.1137.1.dist-info}/license_files/LICENSE +0 -0
@@ -0,0 +1,301 @@
1
+ # -*- coding: utf-8 -*-
2
+ import os
3
+ import sys
4
+ import six
5
+ import json
6
+ import tccli.options_define as OptionsDefine
7
+ import tccli.format_output as FormatOutput
8
+ from tccli import __version__
9
+ from tccli.utils import Utils
10
+ from tccli.exceptions import ConfigurationError, ClientError, ParamError
11
+ from tencentcloud.common import credential
12
+ from tencentcloud.common.profile.http_profile import HttpProfile
13
+ from tencentcloud.common.profile.client_profile import ClientProfile
14
+ from tencentcloud.tsi.v20210325 import tsi_client as tsi_client_v20210325
15
+ from tencentcloud.tsi.v20210325 import models as models_v20210325
16
+
17
+ from jmespath import search
18
+ import time
19
+
20
+ def doTongChuanRecognize(args, parsed_globals):
21
+ g_param = parse_global_arg(parsed_globals)
22
+
23
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
24
+ cred = credential.CVMRoleCredential()
25
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
26
+ cred = credential.STSAssumeRoleCredential(
27
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
28
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
29
+ )
30
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
31
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
32
+ else:
33
+ cred = credential.Credential(
34
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
35
+ )
36
+ http_profile = HttpProfile(
37
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
38
+ reqMethod="POST",
39
+ endpoint=g_param[OptionsDefine.Endpoint],
40
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
41
+ )
42
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
43
+ if g_param[OptionsDefine.Language]:
44
+ profile.language = g_param[OptionsDefine.Language]
45
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
46
+ client = mod.TsiClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.TongChuanRecognizeRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.TongChuanRecognize(model)
54
+ result = rsp.to_json_string()
55
+ try:
56
+ json_obj = json.loads(result)
57
+ except TypeError as e:
58
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
59
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
60
+ break
61
+ cur_time = time.time()
62
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
63
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
64
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
65
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
66
+ else:
67
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
68
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
69
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
70
+
71
+
72
+ def doTongChuanDisplay(args, parsed_globals):
73
+ g_param = parse_global_arg(parsed_globals)
74
+
75
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
76
+ cred = credential.CVMRoleCredential()
77
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
78
+ cred = credential.STSAssumeRoleCredential(
79
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
80
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
81
+ )
82
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
83
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
84
+ else:
85
+ cred = credential.Credential(
86
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
87
+ )
88
+ http_profile = HttpProfile(
89
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
90
+ reqMethod="POST",
91
+ endpoint=g_param[OptionsDefine.Endpoint],
92
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
93
+ )
94
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
95
+ if g_param[OptionsDefine.Language]:
96
+ profile.language = g_param[OptionsDefine.Language]
97
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
98
+ client = mod.TsiClient(cred, g_param[OptionsDefine.Region], profile)
99
+ client._sdkVersion += ("_CLI_" + __version__)
100
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
+ model = models.TongChuanDisplayRequest()
102
+ model.from_json_string(json.dumps(args))
103
+ start_time = time.time()
104
+ while True:
105
+ rsp = client.TongChuanDisplay(model)
106
+ result = rsp.to_json_string()
107
+ try:
108
+ json_obj = json.loads(result)
109
+ except TypeError as e:
110
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
111
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
112
+ break
113
+ cur_time = time.time()
114
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
115
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
116
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
117
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
118
+ else:
119
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
120
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
121
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
122
+
123
+
124
+ def doTongChuanSync(args, parsed_globals):
125
+ g_param = parse_global_arg(parsed_globals)
126
+
127
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
128
+ cred = credential.CVMRoleCredential()
129
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
130
+ cred = credential.STSAssumeRoleCredential(
131
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
132
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
133
+ )
134
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
135
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
136
+ else:
137
+ cred = credential.Credential(
138
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
139
+ )
140
+ http_profile = HttpProfile(
141
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
142
+ reqMethod="POST",
143
+ endpoint=g_param[OptionsDefine.Endpoint],
144
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
145
+ )
146
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
147
+ if g_param[OptionsDefine.Language]:
148
+ profile.language = g_param[OptionsDefine.Language]
149
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
150
+ client = mod.TsiClient(cred, g_param[OptionsDefine.Region], profile)
151
+ client._sdkVersion += ("_CLI_" + __version__)
152
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
153
+ model = models.TongChuanSyncRequest()
154
+ model.from_json_string(json.dumps(args))
155
+ start_time = time.time()
156
+ while True:
157
+ rsp = client.TongChuanSync(model)
158
+ result = rsp.to_json_string()
159
+ try:
160
+ json_obj = json.loads(result)
161
+ except TypeError as e:
162
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
163
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
164
+ break
165
+ cur_time = time.time()
166
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
167
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
168
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
169
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
170
+ else:
171
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
172
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
173
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
174
+
175
+
176
+ CLIENT_MAP = {
177
+ "v20210325": tsi_client_v20210325,
178
+
179
+ }
180
+
181
+ MODELS_MAP = {
182
+ "v20210325": models_v20210325,
183
+
184
+ }
185
+
186
+ ACTION_MAP = {
187
+ "TongChuanRecognize": doTongChuanRecognize,
188
+ "TongChuanDisplay": doTongChuanDisplay,
189
+ "TongChuanSync": doTongChuanSync,
190
+
191
+ }
192
+
193
+ AVAILABLE_VERSION_LIST = [
194
+ "v20210325",
195
+
196
+ ]
197
+
198
+
199
+ def action_caller():
200
+ return ACTION_MAP
201
+
202
+
203
+ def parse_global_arg(parsed_globals):
204
+ g_param = parsed_globals
205
+
206
+ is_exist_profile = True
207
+ if not parsed_globals["profile"]:
208
+ is_exist_profile = False
209
+ g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
210
+
211
+ configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
212
+ is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
213
+ is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
214
+
215
+ conf = {}
216
+ cred = {}
217
+
218
+ if is_conf_exist:
219
+ conf = Utils.load_json_msg(conf_path)
220
+ if is_cred_exist:
221
+ cred = Utils.load_json_msg(cred_path)
222
+
223
+ if not (isinstance(conf, dict) and isinstance(cred, dict)):
224
+ raise ConfigurationError(
225
+ "file: %s or %s is not json format"
226
+ % (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
227
+
228
+ if OptionsDefine.Token not in cred:
229
+ cred[OptionsDefine.Token] = None
230
+
231
+ if not is_exist_profile:
232
+ if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
233
+ cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
234
+ cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
235
+ cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
236
+
237
+ if os.environ.get(OptionsDefine.ENV_REGION):
238
+ conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
239
+
240
+ if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
241
+ cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
242
+ cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
243
+
244
+ for param in g_param.keys():
245
+ if g_param[param] is None:
246
+ if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
247
+ if param in cred:
248
+ g_param[param] = cred[param]
249
+ elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
250
+ or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
251
+ raise ConfigurationError("%s is invalid" % param)
252
+ elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
253
+ if param in conf[OptionsDefine.SysParam]:
254
+ g_param[param] = conf[OptionsDefine.SysParam][param]
255
+ elif param != OptionsDefine.Language:
256
+ raise ConfigurationError("%s is invalid" % param)
257
+ elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
258
+ if param.replace('_', '-') in cred:
259
+ g_param[param] = cred[param.replace('_', '-')]
260
+
261
+ try:
262
+ if g_param[OptionsDefine.ServiceVersion]:
263
+ g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
264
+ else:
265
+ version = conf["tsi"][OptionsDefine.Version]
266
+ g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
267
+
268
+ if g_param[OptionsDefine.Endpoint] is None:
269
+ g_param[OptionsDefine.Endpoint] = conf["tsi"][OptionsDefine.Endpoint]
270
+ g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
271
+ except Exception as err:
272
+ raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
273
+
274
+ if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
275
+ raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
276
+
277
+ if g_param[OptionsDefine.Waiter]:
278
+ param = eval(g_param[OptionsDefine.Waiter])
279
+ if 'expr' not in param:
280
+ raise Exception('`expr` in `--waiter` must be defined')
281
+ if 'to' not in param:
282
+ raise Exception('`to` in `--waiter` must be defined')
283
+ if 'timeout' not in param:
284
+ if 'waiter' in conf and 'timeout' in conf['waiter']:
285
+ param['timeout'] = conf['waiter']['timeout']
286
+ else:
287
+ param['timeout'] = 180
288
+ if 'interval' not in param:
289
+ if 'waiter' in conf and 'interval' in conf['waiter']:
290
+ param['interval'] = conf['waiter']['interval']
291
+ else:
292
+ param['interval'] = 5
293
+ param['interval'] = min(param['interval'], param['timeout'])
294
+ g_param['OptionsDefine.WaiterInfo'] = param
295
+
296
+ if six.PY2:
297
+ for key, value in g_param.items():
298
+ if isinstance(value, six.text_type):
299
+ g_param[key] = value.encode('utf-8')
300
+ return g_param
301
+
@@ -0,0 +1,373 @@
1
+ {
2
+ "actions": {
3
+ "TongChuanDisplay": {
4
+ "document": "获取同传结果。",
5
+ "input": "TongChuanDisplayRequest",
6
+ "name": "同传查询结果",
7
+ "output": "TongChuanDisplayResponse",
8
+ "status": "online"
9
+ },
10
+ "TongChuanRecognize": {
11
+ "document": "本接口提供上传音频,将音频进行语音识别并翻译成文本的服务,目前开放中英互译的同传服务。 待识别和翻译的音频文件格式是 pcm,pcm采样率要求16kHz、位深16bit、单声道、每个分片时长200ms~500ms,音频内语音清晰。",
12
+ "input": "TongChuanRecognizeRequest",
13
+ "name": "同传上传音频",
14
+ "output": "TongChuanRecognizeResponse",
15
+ "status": "online"
16
+ },
17
+ "TongChuanSync": {
18
+ "document": "本接口提供上传音频,将音频进行语音识别并翻译成文本的服务,目前开放中英互译的同传服务。 待识别和翻译的音频文件格式是 pcm,pcm采样率要求16kHz、位深16bit、单声道、每个分片时长200ms~500ms,音频内语音清晰。",
19
+ "input": "TongChuanSyncRequest",
20
+ "name": "同传上传音频并查询结果",
21
+ "output": "TongChuanSyncResponse",
22
+ "status": "online"
23
+ }
24
+ },
25
+ "metadata": {
26
+ "apiVersion": "2021-03-25",
27
+ "api_brief": "介绍如何使用API对腾讯同传进行操作,包括上传音频、查询同传结果等。",
28
+ "serviceNameCN": "腾讯同传系统",
29
+ "serviceShortName": "tsi"
30
+ },
31
+ "objects": {
32
+ "DisplayInfo": {
33
+ "document": "同传结果数据",
34
+ "members": [
35
+ {
36
+ "disabled": false,
37
+ "document": "句子 ID",
38
+ "example": "xxx",
39
+ "member": "string",
40
+ "name": "SeId",
41
+ "output_required": true,
42
+ "type": "string",
43
+ "value_allowed_null": false
44
+ },
45
+ {
46
+ "disabled": false,
47
+ "document": "句子版本号",
48
+ "example": "1",
49
+ "member": "uint64",
50
+ "name": "SeVer",
51
+ "output_required": true,
52
+ "type": "int",
53
+ "value_allowed_null": false
54
+ },
55
+ {
56
+ "disabled": false,
57
+ "document": "识别结果",
58
+ "example": "你好",
59
+ "member": "string",
60
+ "name": "SourceText",
61
+ "output_required": true,
62
+ "type": "string",
63
+ "value_allowed_null": false
64
+ },
65
+ {
66
+ "disabled": false,
67
+ "document": " 翻译结果",
68
+ "example": "Hello",
69
+ "member": "string",
70
+ "name": "TargetText",
71
+ "output_required": true,
72
+ "type": "string",
73
+ "value_allowed_null": false
74
+ },
75
+ {
76
+ "disabled": false,
77
+ "document": "句子开始时间",
78
+ "example": " 122",
79
+ "member": "uint64",
80
+ "name": "StartTime",
81
+ "output_required": true,
82
+ "type": "int",
83
+ "value_allowed_null": false
84
+ },
85
+ {
86
+ "disabled": false,
87
+ "document": "句子结束时间",
88
+ "example": "126",
89
+ "member": "uint64",
90
+ "name": "EndTime",
91
+ "output_required": true,
92
+ "type": "int",
93
+ "value_allowed_null": false
94
+ },
95
+ {
96
+ "disabled": false,
97
+ "document": " 当前句子是否已结束",
98
+ "example": "false",
99
+ "member": "bool",
100
+ "name": "IsEnd",
101
+ "output_required": true,
102
+ "type": "bool",
103
+ "value_allowed_null": false
104
+ }
105
+ ],
106
+ "usage": "out"
107
+ },
108
+ "TongChuanDisplayRequest": {
109
+ "document": "TongChuanDisplay请求参数结构体",
110
+ "members": [
111
+ {
112
+ "disabled": false,
113
+ "document": "一段完整的语音对应一个SessionUuid",
114
+ "example": "sid-1516105689129",
115
+ "member": "string",
116
+ "name": "SessionUuid",
117
+ "required": true,
118
+ "type": "string"
119
+ },
120
+ {
121
+ "disabled": false,
122
+ "document": "句子排序方式,1-由新到旧",
123
+ "example": "1",
124
+ "member": "uint64",
125
+ "name": "IsNew",
126
+ "required": true,
127
+ "type": "int"
128
+ },
129
+ {
130
+ "disabled": false,
131
+ "document": "最多返回几句,目前只支持 5 条数据",
132
+ "example": "5",
133
+ "member": "uint64",
134
+ "name": "SeMax",
135
+ "required": true,
136
+ "type": "int"
137
+ }
138
+ ],
139
+ "type": "object"
140
+ },
141
+ "TongChuanDisplayResponse": {
142
+ "document": "TongChuanDisplay返回参数结构体",
143
+ "members": [
144
+ {
145
+ "disabled": false,
146
+ "document": "同传结果数组",
147
+ "example": "[]",
148
+ "member": "DisplayInfo",
149
+ "name": "List",
150
+ "output_required": true,
151
+ "type": "list",
152
+ "value_allowed_null": false
153
+ },
154
+ {
155
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
156
+ "member": "string",
157
+ "name": "RequestId",
158
+ "type": "string"
159
+ }
160
+ ],
161
+ "type": "object"
162
+ },
163
+ "TongChuanRecognizeRequest": {
164
+ "document": "TongChuanRecognize请求参数结构体",
165
+ "members": [
166
+ {
167
+ "disabled": false,
168
+ "document": "一段完整的语音对应一个SessionUuid",
169
+ "example": "sid-1516105689129",
170
+ "member": "string",
171
+ "name": "SessionUuid",
172
+ "required": true,
173
+ "type": "string"
174
+ },
175
+ {
176
+ "disabled": false,
177
+ "document": "音频中的语言类型,支持语言列表<li> zh : 中文 </li> <li> en : 英文 </li>",
178
+ "example": "zh",
179
+ "member": "string",
180
+ "name": "Source",
181
+ "required": true,
182
+ "type": "string"
183
+ },
184
+ {
185
+ "disabled": false,
186
+ "document": "翻译目标语言类型,支持的语言列表<li> zh : 中文 </li> <li> en : 英文 </li>",
187
+ "example": "en",
188
+ "member": "string",
189
+ "name": "Target",
190
+ "required": true,
191
+ "type": "string"
192
+ },
193
+ {
194
+ "disabled": false,
195
+ "document": "语音编码类型,1-pcm",
196
+ "example": "1",
197
+ "member": "uint64",
198
+ "name": "AudioFormat",
199
+ "required": true,
200
+ "type": "int"
201
+ },
202
+ {
203
+ "disabled": false,
204
+ "document": "语音分片的序号,从0开始",
205
+ "example": "0",
206
+ "member": "uint64",
207
+ "name": "Seq",
208
+ "required": true,
209
+ "type": "int"
210
+ },
211
+ {
212
+ "disabled": false,
213
+ "document": "语音开始的时间戳",
214
+ "example": "0",
215
+ "member": "uint64",
216
+ "name": "Utc",
217
+ "required": true,
218
+ "type": "int"
219
+ },
220
+ {
221
+ "disabled": false,
222
+ "document": "是否最后一片语音分片,0-否,1-是",
223
+ "example": "1",
224
+ "member": "uint64",
225
+ "name": "IsEnd",
226
+ "required": true,
227
+ "type": "int"
228
+ },
229
+ {
230
+ "disabled": false,
231
+ "document": "翻译时机,0 -不翻译 1 - 句子结束时翻译,2 - 句子实时翻译",
232
+ "example": "0",
233
+ "member": "uint64",
234
+ "name": "TranslateTime",
235
+ "required": true,
236
+ "type": "int"
237
+ },
238
+ {
239
+ "disabled": false,
240
+ "document": "语音分片内容进行 Base64 编码后的字符串。音频内容需包含有效并可识别的文本信息。",
241
+ "example": "OkolgkGSpWK==",
242
+ "member": "string",
243
+ "name": "Data",
244
+ "required": true,
245
+ "type": "string"
246
+ }
247
+ ],
248
+ "type": "object"
249
+ },
250
+ "TongChuanRecognizeResponse": {
251
+ "document": "TongChuanRecognize返回参数结构体",
252
+ "members": [
253
+ {
254
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
255
+ "member": "string",
256
+ "name": "RequestId",
257
+ "type": "string"
258
+ }
259
+ ],
260
+ "type": "object"
261
+ },
262
+ "TongChuanSyncRequest": {
263
+ "document": "TongChuanSync请求参数结构体",
264
+ "members": [
265
+ {
266
+ "disabled": false,
267
+ "document": "一段完整的语音对应一个SessionUuid",
268
+ "example": "sid-1516105689129",
269
+ "member": "string",
270
+ "name": "SessionUuid",
271
+ "required": true,
272
+ "type": "string"
273
+ },
274
+ {
275
+ "disabled": false,
276
+ "document": "音频中的语言类型,支持语言列表<li> zh : 中文 </li> <li> en : 英文 </li>",
277
+ "example": "zh",
278
+ "member": "string",
279
+ "name": "Source",
280
+ "required": true,
281
+ "type": "string"
282
+ },
283
+ {
284
+ "disabled": false,
285
+ "document": "翻译目标语言类型,支持的语言列表<li> zh : 中文 </li> <li> en : 英文 </li>",
286
+ "example": "en",
287
+ "member": "string",
288
+ "name": "Target",
289
+ "required": true,
290
+ "type": "string"
291
+ },
292
+ {
293
+ "disabled": false,
294
+ "document": "语音编码类型,1-pcm",
295
+ "example": "1",
296
+ "member": "uint64",
297
+ "name": "AudioFormat",
298
+ "required": true,
299
+ "type": "int"
300
+ },
301
+ {
302
+ "disabled": false,
303
+ "document": "语音分片的序号,从0开始",
304
+ "example": "0",
305
+ "member": "uint64",
306
+ "name": "Seq",
307
+ "required": true,
308
+ "type": "int"
309
+ },
310
+ {
311
+ "disabled": false,
312
+ "document": "语音开始的时间戳",
313
+ "example": "0",
314
+ "member": "uint64",
315
+ "name": "Utc",
316
+ "required": true,
317
+ "type": "int"
318
+ },
319
+ {
320
+ "disabled": false,
321
+ "document": "是否最后一片语音分片,0-否,1-是",
322
+ "example": "1",
323
+ "member": "uint64",
324
+ "name": "IsEnd",
325
+ "required": true,
326
+ "type": "int"
327
+ },
328
+ {
329
+ "disabled": false,
330
+ "document": "翻译时机,0 -不翻译 1 - 句子结束时翻译,2 - 句子实时翻译",
331
+ "example": "0",
332
+ "member": "uint64",
333
+ "name": "TranslateTime",
334
+ "required": true,
335
+ "type": "int"
336
+ },
337
+ {
338
+ "disabled": false,
339
+ "document": "语音分片内容进行 Base64 编码后的字符串。音频内容需包含有效并可识别的文本信息。",
340
+ "example": "OkolgkGSpWK==",
341
+ "member": "string",
342
+ "name": "Data",
343
+ "required": true,
344
+ "type": "string"
345
+ }
346
+ ],
347
+ "type": "object"
348
+ },
349
+ "TongChuanSyncResponse": {
350
+ "document": "TongChuanSync返回参数结构体",
351
+ "members": [
352
+ {
353
+ "disabled": false,
354
+ "document": "同传结果数组",
355
+ "example": "[]",
356
+ "member": "DisplayInfo",
357
+ "name": "List",
358
+ "output_required": true,
359
+ "type": "list",
360
+ "value_allowed_null": false
361
+ },
362
+ {
363
+ "document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
364
+ "member": "string",
365
+ "name": "RequestId",
366
+ "type": "string"
367
+ }
368
+ ],
369
+ "type": "object"
370
+ }
371
+ },
372
+ "version": "1.0"
373
+ }