tencentcloud-sdk-tbp 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 63c301ec668aa6421760c59ded2e1a979662843c
4
+ data.tar.gz: 6b55e45d5c908c073de7acfb8e5d2a8e75e9e85c
5
+ SHA512:
6
+ metadata.gz: 75a6b954c9d5eb285a6e96bc96712b7a83c06f5c781f03ce2954e98776d41144206f9aecac123f507768c5b8109fc70f330153f355d454bbce9aaa7c9b35383b
7
+ data.tar.gz: 20c5d50c25a0ae1f91caa284a6b6ed64bdde025852f7ce07a87bac38c70c635324d80fd930517a2a3f42c44c8ba9eb90d7ca7c6fa49a7dd2ffa335768c34581a
data/lib/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.200
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tencentcloud-sdk-common'
4
+
5
+ require_relative 'v20190627/client'
6
+ require_relative 'v20190627/models'
7
+
8
+ require_relative 'v20190311/client'
9
+ require_relative 'v20190311/models'
10
+
11
+ module TencentCloud
12
+ module Tbp
13
+ end
14
+ end
@@ -0,0 +1,132 @@
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 Tbp
21
+ module V20190311
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2019-03-11'
26
+ api_endpoint = 'tbp.tencentcloudapi.com'
27
+ sdk_version = 'TBP_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 创建机器人
33
+
34
+ # @param request: Request instance for CreateBot.
35
+ # @type request: :class:`Tencentcloud::tbp::V20190311::CreateBotRequest`
36
+ # @rtype: :class:`Tencentcloud::tbp::V20190311::CreateBotResponse`
37
+ def CreateBot(request)
38
+ body = send_request('CreateBot', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = CreateBotResponse.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
+
58
+ # @param request: Request instance for Reset.
59
+ # @type request: :class:`Tencentcloud::tbp::V20190311::ResetRequest`
60
+ # @rtype: :class:`Tencentcloud::tbp::V20190311::ResetResponse`
61
+ def Reset(request)
62
+ body = send_request('Reset', request.serialize)
63
+ response = JSON.parse(body)
64
+ if response['Response'].key?('Error') == false
65
+ model = ResetResponse.new
66
+ model.deserialize(response['Response'])
67
+ model
68
+ else
69
+ code = response['Response']['Error']['Code']
70
+ message = response['Response']['Error']['Message']
71
+ reqid = response['Response']['RequestId']
72
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
73
+ end
74
+ rescue TencentCloud::Common::TencentCloudSDKException => e
75
+ raise e
76
+ rescue StandardError => e
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
78
+ end
79
+
80
+ # 接收调用侧的文本输入,返回应答文本。已废弃,推荐使用最新版TextProcess接口。
81
+
82
+ # @param request: Request instance for TextProcess.
83
+ # @type request: :class:`Tencentcloud::tbp::V20190311::TextProcessRequest`
84
+ # @rtype: :class:`Tencentcloud::tbp::V20190311::TextProcessResponse`
85
+ def TextProcess(request)
86
+ body = send_request('TextProcess', request.serialize)
87
+ response = JSON.parse(body)
88
+ if response['Response'].key?('Error') == false
89
+ model = TextProcessResponse.new
90
+ model.deserialize(response['Response'])
91
+ model
92
+ else
93
+ code = response['Response']['Error']['Code']
94
+ message = response['Response']['Error']['Message']
95
+ reqid = response['Response']['RequestId']
96
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
97
+ end
98
+ rescue TencentCloud::Common::TencentCloudSDKException => e
99
+ raise e
100
+ rescue StandardError => e
101
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
102
+ end
103
+
104
+ # 会话重置接口。已废弃,推荐使用最新版TextReset接口。
105
+
106
+ # @param request: Request instance for TextReset.
107
+ # @type request: :class:`Tencentcloud::tbp::V20190311::TextResetRequest`
108
+ # @rtype: :class:`Tencentcloud::tbp::V20190311::TextResetResponse`
109
+ def TextReset(request)
110
+ body = send_request('TextReset', request.serialize)
111
+ response = JSON.parse(body)
112
+ if response['Response'].key?('Error') == false
113
+ model = TextResetResponse.new
114
+ model.deserialize(response['Response'])
115
+ model
116
+ else
117
+ code = response['Response']['Error']['Code']
118
+ message = response['Response']['Error']['Message']
119
+ reqid = response['Response']['RequestId']
120
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
121
+ end
122
+ rescue TencentCloud::Common::TencentCloudSDKException => e
123
+ raise e
124
+ rescue StandardError => e
125
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
126
+ end
127
+
128
+
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,356 @@
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
+ module TencentCloud
18
+ module Tbp
19
+ module V20190311
20
+ # CreateBot请求参数结构体
21
+ class CreateBotRequest < TencentCloud::Common::AbstractModel
22
+ # @param BotName: 机器人名称
23
+ # @type BotName: String
24
+ # @param BotCnName: 机器人中文名称
25
+ # @type BotCnName: String
26
+
27
+ attr_accessor :BotName, :BotCnName
28
+
29
+ def initialize(botname=nil, botcnname=nil)
30
+ @BotName = botname
31
+ @BotCnName = botcnname
32
+ end
33
+
34
+ def deserialize(params)
35
+ @BotName = params['BotName']
36
+ @BotCnName = params['BotCnName']
37
+ end
38
+ end
39
+
40
+ # CreateBot返回参数结构体
41
+ class CreateBotResponse < TencentCloud::Common::AbstractModel
42
+ # @param TaskRequestId: 任务ID
43
+ # @type TaskRequestId: String
44
+ # @param Msg: 任务信息
45
+ # @type Msg: String
46
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
47
+ # @type RequestId: String
48
+
49
+ attr_accessor :TaskRequestId, :Msg, :RequestId
50
+
51
+ def initialize(taskrequestid=nil, msg=nil, requestid=nil)
52
+ @TaskRequestId = taskrequestid
53
+ @Msg = msg
54
+ @RequestId = requestid
55
+ end
56
+
57
+ def deserialize(params)
58
+ @TaskRequestId = params['TaskRequestId']
59
+ @Msg = params['Msg']
60
+ @RequestId = params['RequestId']
61
+ end
62
+ end
63
+
64
+ # Reset请求参数结构体
65
+ class ResetRequest < TencentCloud::Common::AbstractModel
66
+ # @param BotId: 机器人标识
67
+ # @type BotId: String
68
+ # @param UserId: 子账户id,每个终端对应一个
69
+ # @type UserId: String
70
+ # @param BotVersion: 机器人版本号。BotVersion/BotEnv二选一:二者均填,仅BotVersion有效;二者均不填,默认BotEnv=dev
71
+ # @type BotVersion: String
72
+ # @param BotEnv: 机器人环境{dev:测试;release:线上}。BotVersion/BotEnv二选一:二者均填,仅BotVersion有效;二者均不填,默认BotEnv=dev
73
+ # @type BotEnv: String
74
+
75
+ attr_accessor :BotId, :UserId, :BotVersion, :BotEnv
76
+
77
+ def initialize(botid=nil, userid=nil, botversion=nil, botenv=nil)
78
+ @BotId = botid
79
+ @UserId = userid
80
+ @BotVersion = botversion
81
+ @BotEnv = botenv
82
+ end
83
+
84
+ def deserialize(params)
85
+ @BotId = params['BotId']
86
+ @UserId = params['UserId']
87
+ @BotVersion = params['BotVersion']
88
+ @BotEnv = params['BotEnv']
89
+ end
90
+ end
91
+
92
+ # Reset返回参数结构体
93
+ class ResetResponse < TencentCloud::Common::AbstractModel
94
+ # @param DialogStatus: 当前会话状态。取值:"start"/"continue"/"complete"
95
+ # 注意:此字段可能返回 null,表示取不到有效值。
96
+ # @type DialogStatus: String
97
+ # @param BotName: 匹配到的机器人名称
98
+ # 注意:此字段可能返回 null,表示取不到有效值。
99
+ # @type BotName: String
100
+ # @param IntentName: 匹配到的意图名称
101
+ # 注意:此字段可能返回 null,表示取不到有效值。
102
+ # @type IntentName: String
103
+ # @param ResponseText: 机器人回答
104
+ # @type ResponseText: String
105
+ # @param SlotInfoList: 语义解析的槽位结果列表
106
+ # 注意:此字段可能返回 null,表示取不到有效值。
107
+ # @type SlotInfoList: Array
108
+ # @param SessionAttributes: 透传字段
109
+ # 注意:此字段可能返回 null,表示取不到有效值。
110
+ # @type SessionAttributes: String
111
+ # @param Question: 用户说法。该说法是用户原生说法或ASR识别结果,未经过语义优化
112
+ # 注意:此字段可能返回 null,表示取不到有效值。
113
+ # @type Question: String
114
+ # @param WaveUrl: tts合成pcm音频存储链接。仅当请求参数NeedTts=true时返回
115
+ # 注意:此字段可能返回 null,表示取不到有效值。
116
+ # @type WaveUrl: String
117
+ # @param WaveData: tts合成的pcm音频。二进制数组经过base64编码(暂时不返回)
118
+ # 注意:此字段可能返回 null,表示取不到有效值。
119
+ # @type WaveData: String
120
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
121
+ # @type RequestId: String
122
+
123
+ attr_accessor :DialogStatus, :BotName, :IntentName, :ResponseText, :SlotInfoList, :SessionAttributes, :Question, :WaveUrl, :WaveData, :RequestId
124
+
125
+ def initialize(dialogstatus=nil, botname=nil, intentname=nil, responsetext=nil, slotinfolist=nil, sessionattributes=nil, question=nil, waveurl=nil, wavedata=nil, requestid=nil)
126
+ @DialogStatus = dialogstatus
127
+ @BotName = botname
128
+ @IntentName = intentname
129
+ @ResponseText = responsetext
130
+ @SlotInfoList = slotinfolist
131
+ @SessionAttributes = sessionattributes
132
+ @Question = question
133
+ @WaveUrl = waveurl
134
+ @WaveData = wavedata
135
+ @RequestId = requestid
136
+ end
137
+
138
+ def deserialize(params)
139
+ @DialogStatus = params['DialogStatus']
140
+ @BotName = params['BotName']
141
+ @IntentName = params['IntentName']
142
+ @ResponseText = params['ResponseText']
143
+ unless params['SlotInfoList'].nil?
144
+ @SlotInfoList = []
145
+ params['SlotInfoList'].each do |i|
146
+ slotinfo_tmp = SlotInfo.new
147
+ slotinfo_tmp.deserialize(i)
148
+ @SlotInfoList << slotinfo_tmp
149
+ end
150
+ end
151
+ @SessionAttributes = params['SessionAttributes']
152
+ @Question = params['Question']
153
+ @WaveUrl = params['WaveUrl']
154
+ @WaveData = params['WaveData']
155
+ @RequestId = params['RequestId']
156
+ end
157
+ end
158
+
159
+ # 槽位信息
160
+ class SlotInfo < TencentCloud::Common::AbstractModel
161
+ # @param SlotName: 槽位名称
162
+ # 注意:此字段可能返回 null,表示取不到有效值。
163
+ # @type SlotName: String
164
+ # @param SlotValue: 槽位值
165
+ # 注意:此字段可能返回 null,表示取不到有效值。
166
+ # @type SlotValue: String
167
+
168
+ attr_accessor :SlotName, :SlotValue
169
+
170
+ def initialize(slotname=nil, slotvalue=nil)
171
+ @SlotName = slotname
172
+ @SlotValue = slotvalue
173
+ end
174
+
175
+ def deserialize(params)
176
+ @SlotName = params['SlotName']
177
+ @SlotValue = params['SlotValue']
178
+ end
179
+ end
180
+
181
+ # TextProcess请求参数结构体
182
+ class TextProcessRequest < TencentCloud::Common::AbstractModel
183
+ # @param BotId: 机器人标识,用于定义抽象机器人。
184
+ # @type BotId: String
185
+ # @param TerminalId: 终端标识,每个终端(或线程)对应一个,区分并发多用户。
186
+ # @type TerminalId: String
187
+ # @param InputText: 请求的文本。
188
+ # @type InputText: String
189
+ # @param BotEnv: 机器人版本,取值"dev"或"release",{调试版本:dev;线上版本:release}。
190
+ # @type BotEnv: String
191
+ # @param SessionAttributes: 透传字段,透传给用户自定义的WebService服务。
192
+ # @type SessionAttributes: String
193
+
194
+ attr_accessor :BotId, :TerminalId, :InputText, :BotEnv, :SessionAttributes
195
+
196
+ def initialize(botid=nil, terminalid=nil, inputtext=nil, botenv=nil, sessionattributes=nil)
197
+ @BotId = botid
198
+ @TerminalId = terminalid
199
+ @InputText = inputtext
200
+ @BotEnv = botenv
201
+ @SessionAttributes = sessionattributes
202
+ end
203
+
204
+ def deserialize(params)
205
+ @BotId = params['BotId']
206
+ @TerminalId = params['TerminalId']
207
+ @InputText = params['InputText']
208
+ @BotEnv = params['BotEnv']
209
+ @SessionAttributes = params['SessionAttributes']
210
+ end
211
+ end
212
+
213
+ # TextProcess返回参数结构体
214
+ class TextProcessResponse < TencentCloud::Common::AbstractModel
215
+ # @param DialogStatus: 当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
216
+ # 注意:此字段可能返回 null,表示取不到有效值。
217
+ # @type DialogStatus: String
218
+ # @param BotName: 匹配到的机器人名称。
219
+ # 注意:此字段可能返回 null,表示取不到有效值。
220
+ # @type BotName: String
221
+ # @param IntentName: 匹配到的意图名称。
222
+ # 注意:此字段可能返回 null,表示取不到有效值。
223
+ # @type IntentName: String
224
+ # @param SlotInfoList: 槽位信息。
225
+ # 注意:此字段可能返回 null,表示取不到有效值。
226
+ # @type SlotInfoList: Array
227
+ # @param InputText: 原始的用户说法。
228
+ # 注意:此字段可能返回 null,表示取不到有效值。
229
+ # @type InputText: String
230
+ # @param SessionAttributes: 透传字段,由用户自定义的WebService服务返回。
231
+ # 注意:此字段可能返回 null,表示取不到有效值。
232
+ # @type SessionAttributes: String
233
+ # @param ResponseText: 机器人对话的应答文本。
234
+ # 注意:此字段可能返回 null,表示取不到有效值。
235
+ # @type ResponseText: String
236
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
237
+ # @type RequestId: String
238
+
239
+ attr_accessor :DialogStatus, :BotName, :IntentName, :SlotInfoList, :InputText, :SessionAttributes, :ResponseText, :RequestId
240
+
241
+ def initialize(dialogstatus=nil, botname=nil, intentname=nil, slotinfolist=nil, inputtext=nil, sessionattributes=nil, responsetext=nil, requestid=nil)
242
+ @DialogStatus = dialogstatus
243
+ @BotName = botname
244
+ @IntentName = intentname
245
+ @SlotInfoList = slotinfolist
246
+ @InputText = inputtext
247
+ @SessionAttributes = sessionattributes
248
+ @ResponseText = responsetext
249
+ @RequestId = requestid
250
+ end
251
+
252
+ def deserialize(params)
253
+ @DialogStatus = params['DialogStatus']
254
+ @BotName = params['BotName']
255
+ @IntentName = params['IntentName']
256
+ unless params['SlotInfoList'].nil?
257
+ @SlotInfoList = []
258
+ params['SlotInfoList'].each do |i|
259
+ slotinfo_tmp = SlotInfo.new
260
+ slotinfo_tmp.deserialize(i)
261
+ @SlotInfoList << slotinfo_tmp
262
+ end
263
+ end
264
+ @InputText = params['InputText']
265
+ @SessionAttributes = params['SessionAttributes']
266
+ @ResponseText = params['ResponseText']
267
+ @RequestId = params['RequestId']
268
+ end
269
+ end
270
+
271
+ # TextReset请求参数结构体
272
+ class TextResetRequest < TencentCloud::Common::AbstractModel
273
+ # @param BotId: 机器人标识,用于定义抽象机器人。
274
+ # @type BotId: String
275
+ # @param TerminalId: 终端标识,每个终端(或线程)对应一个,区分并发多用户。
276
+ # @type TerminalId: String
277
+ # @param BotEnv: 机器人版本,取值"dev"或"release",{调试版本:dev;线上版本:release}。
278
+ # @type BotEnv: String
279
+
280
+ attr_accessor :BotId, :TerminalId, :BotEnv
281
+
282
+ def initialize(botid=nil, terminalid=nil, botenv=nil)
283
+ @BotId = botid
284
+ @TerminalId = terminalid
285
+ @BotEnv = botenv
286
+ end
287
+
288
+ def deserialize(params)
289
+ @BotId = params['BotId']
290
+ @TerminalId = params['TerminalId']
291
+ @BotEnv = params['BotEnv']
292
+ end
293
+ end
294
+
295
+ # TextReset返回参数结构体
296
+ class TextResetResponse < TencentCloud::Common::AbstractModel
297
+ # @param DialogStatus: 当前会话状态,取值:"START"/"COUTINUE"/"COMPLETE"。
298
+ # 注意:此字段可能返回 null,表示取不到有效值。
299
+ # @type DialogStatus: String
300
+ # @param BotName: 匹配到的机器人名称。
301
+ # 注意:此字段可能返回 null,表示取不到有效值。
302
+ # @type BotName: String
303
+ # @param IntentName: 匹配到的意图名称。
304
+ # 注意:此字段可能返回 null,表示取不到有效值。
305
+ # @type IntentName: String
306
+ # @param SlotInfoList: 槽位信息。
307
+ # 注意:此字段可能返回 null,表示取不到有效值。
308
+ # @type SlotInfoList: Array
309
+ # @param InputText: 原始的用户说法。
310
+ # 注意:此字段可能返回 null,表示取不到有效值。
311
+ # @type InputText: String
312
+ # @param SessionAttributes: 透传字段,由用户自定义的WebService服务返回。
313
+ # 注意:此字段可能返回 null,表示取不到有效值。
314
+ # @type SessionAttributes: String
315
+ # @param ResponseText: 机器人对话的应答文本。
316
+ # 注意:此字段可能返回 null,表示取不到有效值。
317
+ # @type ResponseText: String
318
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
319
+ # @type RequestId: String
320
+
321
+ attr_accessor :DialogStatus, :BotName, :IntentName, :SlotInfoList, :InputText, :SessionAttributes, :ResponseText, :RequestId
322
+
323
+ def initialize(dialogstatus=nil, botname=nil, intentname=nil, slotinfolist=nil, inputtext=nil, sessionattributes=nil, responsetext=nil, requestid=nil)
324
+ @DialogStatus = dialogstatus
325
+ @BotName = botname
326
+ @IntentName = intentname
327
+ @SlotInfoList = slotinfolist
328
+ @InputText = inputtext
329
+ @SessionAttributes = sessionattributes
330
+ @ResponseText = responsetext
331
+ @RequestId = requestid
332
+ end
333
+
334
+ def deserialize(params)
335
+ @DialogStatus = params['DialogStatus']
336
+ @BotName = params['BotName']
337
+ @IntentName = params['IntentName']
338
+ unless params['SlotInfoList'].nil?
339
+ @SlotInfoList = []
340
+ params['SlotInfoList'].each do |i|
341
+ slotinfo_tmp = SlotInfo.new
342
+ slotinfo_tmp.deserialize(i)
343
+ @SlotInfoList << slotinfo_tmp
344
+ end
345
+ end
346
+ @InputText = params['InputText']
347
+ @SessionAttributes = params['SessionAttributes']
348
+ @ResponseText = params['ResponseText']
349
+ @RequestId = params['RequestId']
350
+ end
351
+ end
352
+
353
+ end
354
+ end
355
+ end
356
+
@@ -0,0 +1,84 @@
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 Tbp
21
+ module V20190627
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2019-06-27'
26
+ api_endpoint = 'tbp.tencentcloudapi.com'
27
+ sdk_version = 'TBP_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 接收调用侧的文本输入,返回应答文本。
33
+
34
+ # @param request: Request instance for TextProcess.
35
+ # @type request: :class:`Tencentcloud::tbp::V20190627::TextProcessRequest`
36
+ # @rtype: :class:`Tencentcloud::tbp::V20190627::TextProcessResponse`
37
+ def TextProcess(request)
38
+ body = send_request('TextProcess', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = TextProcessResponse.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
+
58
+ # @param request: Request instance for TextReset.
59
+ # @type request: :class:`Tencentcloud::tbp::V20190627::TextResetRequest`
60
+ # @rtype: :class:`Tencentcloud::tbp::V20190627::TextResetResponse`
61
+ def TextReset(request)
62
+ body = send_request('TextReset', request.serialize)
63
+ response = JSON.parse(body)
64
+ if response['Response'].key?('Error') == false
65
+ model = TextResetResponse.new
66
+ model.deserialize(response['Response'])
67
+ model
68
+ else
69
+ code = response['Response']['Error']['Code']
70
+ message = response['Response']['Error']['Message']
71
+ reqid = response['Response']['RequestId']
72
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
73
+ end
74
+ rescue TencentCloud::Common::TencentCloudSDKException => e
75
+ raise e
76
+ rescue StandardError => e
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
78
+ end
79
+
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,299 @@
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
+ module TencentCloud
18
+ module Tbp
19
+ module V20190627
20
+ # Group是消息组的具体定义,当前包含ContentType、Url、Content三个字段。其中,具体的ContentType字段定义,参考互联网MIME类型标准。
21
+ class Group < TencentCloud::Common::AbstractModel
22
+ # @param ContentType: 消息类型参考互联网MIME类型标准,当前仅支持"text/plain"。
23
+ # @type ContentType: String
24
+ # @param Url: 返回内容以链接形式提供。
25
+ # 注意:此字段可能返回 null,表示取不到有效值。
26
+ # @type Url: String
27
+ # @param Content: 普通文本。
28
+ # 注意:此字段可能返回 null,表示取不到有效值。
29
+ # @type Content: String
30
+
31
+ attr_accessor :ContentType, :Url, :Content
32
+
33
+ def initialize(contenttype=nil, url=nil, content=nil)
34
+ @ContentType = contenttype
35
+ @Url = url
36
+ @Content = content
37
+ end
38
+
39
+ def deserialize(params)
40
+ @ContentType = params['ContentType']
41
+ @Url = params['Url']
42
+ @Content = params['Content']
43
+ end
44
+ end
45
+
46
+ # 从TBP-RTS服务v1.3版本起,机器人以消息组列表的形式响应,消息组列表GroupList包含多组消息,用户根据需要对部分或全部消息组进行组合使用。
47
+ class ResponseMessage < TencentCloud::Common::AbstractModel
48
+ # @param GroupList: 消息组列表。
49
+ # 注意:此字段可能返回 null,表示取不到有效值。
50
+ # @type GroupList: Array
51
+
52
+ attr_accessor :GroupList
53
+
54
+ def initialize(grouplist=nil)
55
+ @GroupList = grouplist
56
+ end
57
+
58
+ def deserialize(params)
59
+ unless params['GroupList'].nil?
60
+ @GroupList = []
61
+ params['GroupList'].each do |i|
62
+ group_tmp = Group.new
63
+ group_tmp.deserialize(i)
64
+ @GroupList << group_tmp
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ # 槽位信息
71
+ class SlotInfo < TencentCloud::Common::AbstractModel
72
+ # @param SlotName: 槽位名称
73
+ # 注意:此字段可能返回 null,表示取不到有效值。
74
+ # @type SlotName: String
75
+ # @param SlotValue: 槽位值
76
+ # 注意:此字段可能返回 null,表示取不到有效值。
77
+ # @type SlotValue: String
78
+
79
+ attr_accessor :SlotName, :SlotValue
80
+
81
+ def initialize(slotname=nil, slotvalue=nil)
82
+ @SlotName = slotname
83
+ @SlotValue = slotvalue
84
+ end
85
+
86
+ def deserialize(params)
87
+ @SlotName = params['SlotName']
88
+ @SlotValue = params['SlotValue']
89
+ end
90
+ end
91
+
92
+ # TextProcess请求参数结构体
93
+ class TextProcessRequest < TencentCloud::Common::AbstractModel
94
+ # @param BotId: 机器人标识,用于定义抽象机器人。
95
+ # @type BotId: String
96
+ # @param BotEnv: 机器人版本,取值"dev"或"release",{调试版本:dev;线上版本:release}。
97
+ # @type BotEnv: String
98
+ # @param TerminalId: 终端标识,每个终端(或线程)对应一个,区分并发多用户。
99
+ # @type TerminalId: String
100
+ # @param InputText: 请求的文本。
101
+ # @type InputText: String
102
+ # @param SessionAttributes: 透传字段,透传给用户自定义的WebService服务。
103
+ # @type SessionAttributes: String
104
+ # @param PlatformType: 平台类型,{小程序:MiniProgram;小微:XiaoWei;公众号:OfficialAccount;企业微信: WXWork}。
105
+ # @type PlatformType: String
106
+ # @param PlatformId: 当PlatformType为微信公众号或企业微信时,传递对应微信公众号或企业微信的唯一标识
107
+ # @type PlatformId: String
108
+
109
+ attr_accessor :BotId, :BotEnv, :TerminalId, :InputText, :SessionAttributes, :PlatformType, :PlatformId
110
+
111
+ def initialize(botid=nil, botenv=nil, terminalid=nil, inputtext=nil, sessionattributes=nil, platformtype=nil, platformid=nil)
112
+ @BotId = botid
113
+ @BotEnv = botenv
114
+ @TerminalId = terminalid
115
+ @InputText = inputtext
116
+ @SessionAttributes = sessionattributes
117
+ @PlatformType = platformtype
118
+ @PlatformId = platformid
119
+ end
120
+
121
+ def deserialize(params)
122
+ @BotId = params['BotId']
123
+ @BotEnv = params['BotEnv']
124
+ @TerminalId = params['TerminalId']
125
+ @InputText = params['InputText']
126
+ @SessionAttributes = params['SessionAttributes']
127
+ @PlatformType = params['PlatformType']
128
+ @PlatformId = params['PlatformId']
129
+ end
130
+ end
131
+
132
+ # TextProcess返回参数结构体
133
+ class TextProcessResponse < TencentCloud::Common::AbstractModel
134
+ # @param DialogStatus: 当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
135
+ # 注意:此字段可能返回 null,表示取不到有效值。
136
+ # @type DialogStatus: String
137
+ # @param BotName: 匹配到的机器人名称。
138
+ # 注意:此字段可能返回 null,表示取不到有效值。
139
+ # @type BotName: String
140
+ # @param IntentName: 匹配到的意图名称。
141
+ # 注意:此字段可能返回 null,表示取不到有效值。
142
+ # @type IntentName: String
143
+ # @param SlotInfoList: 槽位信息。
144
+ # 注意:此字段可能返回 null,表示取不到有效值。
145
+ # @type SlotInfoList: Array
146
+ # @param InputText: 原始的用户说法。
147
+ # 注意:此字段可能返回 null,表示取不到有效值。
148
+ # @type InputText: String
149
+ # @param ResponseMessage: 机器人应答。
150
+ # 注意:此字段可能返回 null,表示取不到有效值。
151
+ # @type ResponseMessage: :class:`Tencentcloud::Tbp.v20190627.models.ResponseMessage`
152
+ # @param SessionAttributes: 透传字段,由用户自定义的WebService服务返回。
153
+ # 注意:此字段可能返回 null,表示取不到有效值。
154
+ # @type SessionAttributes: String
155
+ # @param ResultType: 结果类型 {中间逻辑出错:0; 任务型机器人:1; 问答型机器人:2; 闲聊型机器人:3; 未匹配上,返回预设兜底话术:5; 未匹配上,返回相似问题列表:6}。
156
+ # 注意:此字段可能返回 null,表示取不到有效值。
157
+ # @type ResultType: String
158
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
159
+ # @type RequestId: String
160
+
161
+ attr_accessor :DialogStatus, :BotName, :IntentName, :SlotInfoList, :InputText, :ResponseMessage, :SessionAttributes, :ResultType, :RequestId
162
+
163
+ def initialize(dialogstatus=nil, botname=nil, intentname=nil, slotinfolist=nil, inputtext=nil, responsemessage=nil, sessionattributes=nil, resulttype=nil, requestid=nil)
164
+ @DialogStatus = dialogstatus
165
+ @BotName = botname
166
+ @IntentName = intentname
167
+ @SlotInfoList = slotinfolist
168
+ @InputText = inputtext
169
+ @ResponseMessage = responsemessage
170
+ @SessionAttributes = sessionattributes
171
+ @ResultType = resulttype
172
+ @RequestId = requestid
173
+ end
174
+
175
+ def deserialize(params)
176
+ @DialogStatus = params['DialogStatus']
177
+ @BotName = params['BotName']
178
+ @IntentName = params['IntentName']
179
+ unless params['SlotInfoList'].nil?
180
+ @SlotInfoList = []
181
+ params['SlotInfoList'].each do |i|
182
+ slotinfo_tmp = SlotInfo.new
183
+ slotinfo_tmp.deserialize(i)
184
+ @SlotInfoList << slotinfo_tmp
185
+ end
186
+ end
187
+ @InputText = params['InputText']
188
+ unless params['ResponseMessage'].nil?
189
+ @ResponseMessage = ResponseMessage.new
190
+ @ResponseMessage.deserialize(params['ResponseMessage'])
191
+ end
192
+ @SessionAttributes = params['SessionAttributes']
193
+ @ResultType = params['ResultType']
194
+ @RequestId = params['RequestId']
195
+ end
196
+ end
197
+
198
+ # TextReset请求参数结构体
199
+ class TextResetRequest < TencentCloud::Common::AbstractModel
200
+ # @param BotId: 机器人标识,用于定义抽象机器人。
201
+ # @type BotId: String
202
+ # @param BotEnv: 机器人版本,取值"dev"或"release",{调试版本:dev;线上版本:release}。
203
+ # @type BotEnv: String
204
+ # @param TerminalId: 终端标识,每个终端(或线程)对应一个,区分并发多用户。
205
+ # @type TerminalId: String
206
+ # @param PlatformType: 平台类型,{小程序:MiniProgram;小微:XiaoWei;公众号:OfficialAccount;企业微信: WXWork}。
207
+ # @type PlatformType: String
208
+ # @param PlatformId: 当PlatformType为微信公众号或企业微信时,传递对应微信公众号或企业微信的唯一标识
209
+ # @type PlatformId: String
210
+
211
+ attr_accessor :BotId, :BotEnv, :TerminalId, :PlatformType, :PlatformId
212
+
213
+ def initialize(botid=nil, botenv=nil, terminalid=nil, platformtype=nil, platformid=nil)
214
+ @BotId = botid
215
+ @BotEnv = botenv
216
+ @TerminalId = terminalid
217
+ @PlatformType = platformtype
218
+ @PlatformId = platformid
219
+ end
220
+
221
+ def deserialize(params)
222
+ @BotId = params['BotId']
223
+ @BotEnv = params['BotEnv']
224
+ @TerminalId = params['TerminalId']
225
+ @PlatformType = params['PlatformType']
226
+ @PlatformId = params['PlatformId']
227
+ end
228
+ end
229
+
230
+ # TextReset返回参数结构体
231
+ class TextResetResponse < TencentCloud::Common::AbstractModel
232
+ # @param DialogStatus: 当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
233
+ # 注意:此字段可能返回 null,表示取不到有效值。
234
+ # @type DialogStatus: String
235
+ # @param BotName: 匹配到的机器人名称。
236
+ # 注意:此字段可能返回 null,表示取不到有效值。
237
+ # @type BotName: String
238
+ # @param IntentName: 匹配到的意图名称。
239
+ # 注意:此字段可能返回 null,表示取不到有效值。
240
+ # @type IntentName: String
241
+ # @param SlotInfoList: 槽位信息。
242
+ # 注意:此字段可能返回 null,表示取不到有效值。
243
+ # @type SlotInfoList: Array
244
+ # @param InputText: 原始的用户说法。
245
+ # 注意:此字段可能返回 null,表示取不到有效值。
246
+ # @type InputText: String
247
+ # @param ResponseMessage: 机器人应答。
248
+ # 注意:此字段可能返回 null,表示取不到有效值。
249
+ # @type ResponseMessage: :class:`Tencentcloud::Tbp.v20190627.models.ResponseMessage`
250
+ # @param SessionAttributes: 透传字段,由用户自定义的WebService服务返回。
251
+ # 注意:此字段可能返回 null,表示取不到有效值。
252
+ # @type SessionAttributes: String
253
+ # @param ResultType: 结果类型 {中间逻辑出错:0; 任务型机器人:1; 问答型机器人:2; 闲聊型机器人:3; 未匹配上,返回预设兜底话术:5; 未匹配上,返回相似问题列表:6}。
254
+ # 注意:此字段可能返回 null,表示取不到有效值。
255
+ # @type ResultType: String
256
+ # @param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
257
+ # @type RequestId: String
258
+
259
+ attr_accessor :DialogStatus, :BotName, :IntentName, :SlotInfoList, :InputText, :ResponseMessage, :SessionAttributes, :ResultType, :RequestId
260
+
261
+ def initialize(dialogstatus=nil, botname=nil, intentname=nil, slotinfolist=nil, inputtext=nil, responsemessage=nil, sessionattributes=nil, resulttype=nil, requestid=nil)
262
+ @DialogStatus = dialogstatus
263
+ @BotName = botname
264
+ @IntentName = intentname
265
+ @SlotInfoList = slotinfolist
266
+ @InputText = inputtext
267
+ @ResponseMessage = responsemessage
268
+ @SessionAttributes = sessionattributes
269
+ @ResultType = resulttype
270
+ @RequestId = requestid
271
+ end
272
+
273
+ def deserialize(params)
274
+ @DialogStatus = params['DialogStatus']
275
+ @BotName = params['BotName']
276
+ @IntentName = params['IntentName']
277
+ unless params['SlotInfoList'].nil?
278
+ @SlotInfoList = []
279
+ params['SlotInfoList'].each do |i|
280
+ slotinfo_tmp = SlotInfo.new
281
+ slotinfo_tmp.deserialize(i)
282
+ @SlotInfoList << slotinfo_tmp
283
+ end
284
+ end
285
+ @InputText = params['InputText']
286
+ unless params['ResponseMessage'].nil?
287
+ @ResponseMessage = ResponseMessage.new
288
+ @ResponseMessage.deserialize(params['ResponseMessage'])
289
+ end
290
+ @SessionAttributes = params['SessionAttributes']
291
+ @ResultType = params['ResultType']
292
+ @RequestId = params['RequestId']
293
+ end
294
+ end
295
+
296
+ end
297
+ end
298
+ end
299
+
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tencentcloud-sdk-tbp
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.200
5
+ platform: ruby
6
+ authors:
7
+ - Tencent Cloud
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tencentcloud-sdk-common
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: Tencent Cloud Ruby SDK is the official software development kit, which
28
+ allows Ruby developers to write software that makes use of Tencent Cloud service
29
+ TBP.
30
+ email:
31
+ - tencentcloudapi@tencent.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/VERSION
37
+ - lib/tencentcloud-sdk-tbp.rb
38
+ - lib/v20190311/client.rb
39
+ - lib/v20190311/models.rb
40
+ - lib/v20190627/client.rb
41
+ - lib/v20190627/models.rb
42
+ homepage: https://github.com/TencentCloud/tencentcloud-sdk-ruby
43
+ licenses:
44
+ - Apache-2.0
45
+ metadata:
46
+ source_code_uri: https://github.com/TencentCloud/tencentcloud-sdk-ruby/tencentcloud-sdk-tbp
47
+ changelog_uri: https://github.com/TencentCloud/tencentcloud-sdk-ruby/blob/master/CHANGELOG.md
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.6.14
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Tencent Cloud SDK for Ruby - TBP
68
+ test_files: []