google-cloud-dialogflow-v2 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/dialogflow/v2/agents/client.rb +33 -10
- data/lib/google/cloud/dialogflow/v2/agents/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +33 -10
- data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/v2/contexts/client.rb +29 -7
- data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +29 -7
- data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +62 -38
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +32 -6
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +32 -6
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +35 -10
- data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -10
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/v2/conversations/client.rb +30 -10
- data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +30 -10
- data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/documents/client.rb +35 -9
- data/lib/google/cloud/dialogflow/v2/documents/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
- data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +78 -50
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +29 -3
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +34 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +94 -62
- data/lib/google/cloud/dialogflow/v2/environments/client.rb +30 -7
- data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +30 -7
- data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +62 -38
- data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +28 -3
- data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +28 -3
- data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +30 -14
- data/lib/google/cloud/dialogflow/v2/generators/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/generators/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/intents/operations.rb +9 -5
- data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
- data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +40 -28
- data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +70 -44
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/participants/client.rb +29 -11
- data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +29 -10
- data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +86 -56
- data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +54 -32
- data/lib/google/cloud/dialogflow/v2/sessions/client.rb +28 -3
- data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +28 -2
- data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +22 -8
- data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
- data/lib/google/cloud/dialogflow/v2/versions/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +29 -6
- data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +54 -32
- metadata +4 -4
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the list_environments REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "list_environments",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dialogflow::V2::ListEnvironmentsResponse.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "get_environment",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Dialogflow::V2::Environment.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -163,16 +179,18 @@ module Google
|
|
163
179
|
|
164
180
|
response = @client_stub.make_http_request(
|
165
181
|
verb,
|
166
|
-
uri:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "create_environment",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Cloud::Dialogflow::V2::Environment.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -201,16 +219,18 @@ module Google
|
|
201
219
|
|
202
220
|
response = @client_stub.make_http_request(
|
203
221
|
verb,
|
204
|
-
uri:
|
205
|
-
body:
|
206
|
-
params:
|
222
|
+
uri: uri,
|
223
|
+
body: body || "",
|
224
|
+
params: query_string_params,
|
225
|
+
method_name: "update_environment",
|
207
226
|
options: options
|
208
227
|
)
|
209
228
|
operation = ::Gapic::Rest::TransportOperation.new response
|
210
229
|
result = ::Google::Cloud::Dialogflow::V2::Environment.decode_json response.body, ignore_unknown_fields: true
|
211
|
-
|
212
|
-
|
213
|
-
|
230
|
+
catch :response do
|
231
|
+
yield result, operation if block_given?
|
232
|
+
result
|
233
|
+
end
|
214
234
|
end
|
215
235
|
|
216
236
|
##
|
@@ -239,16 +259,18 @@ module Google
|
|
239
259
|
|
240
260
|
response = @client_stub.make_http_request(
|
241
261
|
verb,
|
242
|
-
uri:
|
243
|
-
body:
|
244
|
-
params:
|
262
|
+
uri: uri,
|
263
|
+
body: body || "",
|
264
|
+
params: query_string_params,
|
265
|
+
method_name: "delete_environment",
|
245
266
|
options: options
|
246
267
|
)
|
247
268
|
operation = ::Gapic::Rest::TransportOperation.new response
|
248
269
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
249
|
-
|
250
|
-
|
251
|
-
|
270
|
+
catch :response do
|
271
|
+
yield result, operation if block_given?
|
272
|
+
result
|
273
|
+
end
|
252
274
|
end
|
253
275
|
|
254
276
|
##
|
@@ -277,16 +299,18 @@ module Google
|
|
277
299
|
|
278
300
|
response = @client_stub.make_http_request(
|
279
301
|
verb,
|
280
|
-
uri:
|
281
|
-
body:
|
282
|
-
params:
|
302
|
+
uri: uri,
|
303
|
+
body: body || "",
|
304
|
+
params: query_string_params,
|
305
|
+
method_name: "get_environment_history",
|
283
306
|
options: options
|
284
307
|
)
|
285
308
|
operation = ::Gapic::Rest::TransportOperation.new response
|
286
309
|
result = ::Google::Cloud::Dialogflow::V2::EnvironmentHistory.decode_json response.body, ignore_unknown_fields: true
|
287
|
-
|
288
|
-
|
289
|
-
|
310
|
+
catch :response do
|
311
|
+
yield result, operation if block_given?
|
312
|
+
result
|
313
|
+
end
|
290
314
|
end
|
291
315
|
|
292
316
|
##
|
@@ -163,14 +163,26 @@ module Google
|
|
163
163
|
universe_domain: @config.universe_domain,
|
164
164
|
channel_args: @config.channel_args,
|
165
165
|
interceptors: @config.interceptors,
|
166
|
-
channel_pool_config: @config.channel_pool
|
166
|
+
channel_pool_config: @config.channel_pool,
|
167
|
+
logger: @config.logger
|
167
168
|
)
|
168
169
|
|
170
|
+
@fulfillments_stub.stub_logger&.info do |entry|
|
171
|
+
entry.set_system_name
|
172
|
+
entry.set_service
|
173
|
+
entry.message = "Created client for #{entry.service}"
|
174
|
+
entry.set_credentials_fields credentials
|
175
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
176
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
177
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
178
|
+
end
|
179
|
+
|
169
180
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
170
181
|
config.credentials = credentials
|
171
182
|
config.quota_project = @quota_project_id
|
172
183
|
config.endpoint = @fulfillments_stub.endpoint
|
173
184
|
config.universe_domain = @fulfillments_stub.universe_domain
|
185
|
+
config.logger = @fulfillments_stub.logger if config.respond_to? :logger=
|
174
186
|
end
|
175
187
|
end
|
176
188
|
|
@@ -181,6 +193,15 @@ module Google
|
|
181
193
|
#
|
182
194
|
attr_reader :location_client
|
183
195
|
|
196
|
+
##
|
197
|
+
# The logger used for request/response debug logging.
|
198
|
+
#
|
199
|
+
# @return [Logger]
|
200
|
+
#
|
201
|
+
def logger
|
202
|
+
@fulfillments_stub.logger
|
203
|
+
end
|
204
|
+
|
184
205
|
# Service calls
|
185
206
|
|
186
207
|
##
|
@@ -264,7 +285,6 @@ module Google
|
|
264
285
|
|
265
286
|
@fulfillments_stub.call_rpc :get_fulfillment, request, options: options do |response, operation|
|
266
287
|
yield response, operation if block_given?
|
267
|
-
return response
|
268
288
|
end
|
269
289
|
rescue ::GRPC::BadStatus => e
|
270
290
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -353,7 +373,6 @@ module Google
|
|
353
373
|
|
354
374
|
@fulfillments_stub.call_rpc :update_fulfillment, request, options: options do |response, operation|
|
355
375
|
yield response, operation if block_given?
|
356
|
-
return response
|
357
376
|
end
|
358
377
|
rescue ::GRPC::BadStatus => e
|
359
378
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -442,6 +461,11 @@ module Google
|
|
442
461
|
# default endpoint URL. The default value of nil uses the environment
|
443
462
|
# universe (usually the default "googleapis.com" universe).
|
444
463
|
# @return [::String,nil]
|
464
|
+
# @!attribute [rw] logger
|
465
|
+
# A custom logger to use for request/response debug logging, or the value
|
466
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
467
|
+
# explicitly disable logging.
|
468
|
+
# @return [::Logger,:default,nil]
|
445
469
|
#
|
446
470
|
class Configuration
|
447
471
|
extend ::Gapic::Config
|
@@ -466,6 +490,7 @@ module Google
|
|
466
490
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
467
491
|
config_attr :quota_project, nil, ::String, nil
|
468
492
|
config_attr :universe_domain, nil, ::String, nil
|
493
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
469
494
|
|
470
495
|
# @private
|
471
496
|
def initialize parent_config = nil
|
@@ -156,15 +156,27 @@ module Google
|
|
156
156
|
endpoint: @config.endpoint,
|
157
157
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
158
158
|
universe_domain: @config.universe_domain,
|
159
|
-
credentials: credentials
|
159
|
+
credentials: credentials,
|
160
|
+
logger: @config.logger
|
160
161
|
)
|
161
162
|
|
163
|
+
@fulfillments_stub.logger(stub: true)&.info do |entry|
|
164
|
+
entry.set_system_name
|
165
|
+
entry.set_service
|
166
|
+
entry.message = "Created client for #{entry.service}"
|
167
|
+
entry.set_credentials_fields credentials
|
168
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
169
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
170
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
171
|
+
end
|
172
|
+
|
162
173
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
163
174
|
config.credentials = credentials
|
164
175
|
config.quota_project = @quota_project_id
|
165
176
|
config.endpoint = @fulfillments_stub.endpoint
|
166
177
|
config.universe_domain = @fulfillments_stub.universe_domain
|
167
178
|
config.bindings_override = @config.bindings_override
|
179
|
+
config.logger = @fulfillments_stub.logger if config.respond_to? :logger=
|
168
180
|
end
|
169
181
|
end
|
170
182
|
|
@@ -175,6 +187,15 @@ module Google
|
|
175
187
|
#
|
176
188
|
attr_reader :location_client
|
177
189
|
|
190
|
+
##
|
191
|
+
# The logger used for request/response debug logging.
|
192
|
+
#
|
193
|
+
# @return [Logger]
|
194
|
+
#
|
195
|
+
def logger
|
196
|
+
@fulfillments_stub.logger
|
197
|
+
end
|
198
|
+
|
178
199
|
# Service calls
|
179
200
|
|
180
201
|
##
|
@@ -251,7 +272,6 @@ module Google
|
|
251
272
|
|
252
273
|
@fulfillments_stub.get_fulfillment request, options do |result, operation|
|
253
274
|
yield result, operation if block_given?
|
254
|
-
return result
|
255
275
|
end
|
256
276
|
rescue ::Gapic::Rest::Error => e
|
257
277
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -333,7 +353,6 @@ module Google
|
|
333
353
|
|
334
354
|
@fulfillments_stub.update_fulfillment request, options do |result, operation|
|
335
355
|
yield result, operation if block_given?
|
336
|
-
return result
|
337
356
|
end
|
338
357
|
rescue ::Gapic::Rest::Error => e
|
339
358
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -413,6 +432,11 @@ module Google
|
|
413
432
|
# default endpoint URL. The default value of nil uses the environment
|
414
433
|
# universe (usually the default "googleapis.com" universe).
|
415
434
|
# @return [::String,nil]
|
435
|
+
# @!attribute [rw] logger
|
436
|
+
# A custom logger to use for request/response debug logging, or the value
|
437
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
438
|
+
# explicitly disable logging.
|
439
|
+
# @return [::Logger,:default,nil]
|
416
440
|
#
|
417
441
|
class Configuration
|
418
442
|
extend ::Gapic::Config
|
@@ -441,6 +465,7 @@ module Google
|
|
441
465
|
# by the host service.
|
442
466
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
443
467
|
config_attr :bindings_override, {}, ::Hash, nil
|
468
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
444
469
|
|
445
470
|
# @private
|
446
471
|
def initialize parent_config = nil
|
@@ -30,7 +30,8 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
|
33
|
+
# @private
|
34
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
|
34
35
|
# These require statements are intentionally placed here to initialize
|
35
36
|
# the REST modules only when it's required.
|
36
37
|
require "gapic/rest"
|
@@ -40,7 +41,9 @@ module Google
|
|
40
41
|
universe_domain: universe_domain,
|
41
42
|
credentials: credentials,
|
42
43
|
numeric_enums: true,
|
43
|
-
|
44
|
+
service_name: self.class,
|
45
|
+
raise_faraday_errors: false,
|
46
|
+
logger: logger
|
44
47
|
end
|
45
48
|
|
46
49
|
##
|
@@ -61,6 +64,15 @@ module Google
|
|
61
64
|
@client_stub.endpoint
|
62
65
|
end
|
63
66
|
|
67
|
+
##
|
68
|
+
# The logger used for request/response debug logging.
|
69
|
+
#
|
70
|
+
# @return [Logger]
|
71
|
+
#
|
72
|
+
def logger stub: false
|
73
|
+
stub ? @client_stub.stub_logger : @client_stub.logger
|
74
|
+
end
|
75
|
+
|
64
76
|
##
|
65
77
|
# Baseline implementation for the get_fulfillment REST call
|
66
78
|
#
|
@@ -87,16 +99,18 @@ module Google
|
|
87
99
|
|
88
100
|
response = @client_stub.make_http_request(
|
89
101
|
verb,
|
90
|
-
uri:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "get_fulfillment",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Cloud::Dialogflow::V2::Fulfillment.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
catch :response do
|
111
|
+
yield result, operation if block_given?
|
112
|
+
result
|
113
|
+
end
|
100
114
|
end
|
101
115
|
|
102
116
|
##
|
@@ -125,16 +139,18 @@ module Google
|
|
125
139
|
|
126
140
|
response = @client_stub.make_http_request(
|
127
141
|
verb,
|
128
|
-
uri:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "update_fulfillment",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Cloud::Dialogflow::V2::Fulfillment.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -167,14 +167,26 @@ module Google
|
|
167
167
|
universe_domain: @config.universe_domain,
|
168
168
|
channel_args: @config.channel_args,
|
169
169
|
interceptors: @config.interceptors,
|
170
|
-
channel_pool_config: @config.channel_pool
|
170
|
+
channel_pool_config: @config.channel_pool,
|
171
|
+
logger: @config.logger
|
171
172
|
)
|
172
173
|
|
174
|
+
@generators_stub.stub_logger&.info do |entry|
|
175
|
+
entry.set_system_name
|
176
|
+
entry.set_service
|
177
|
+
entry.message = "Created client for #{entry.service}"
|
178
|
+
entry.set_credentials_fields credentials
|
179
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
180
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
181
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
182
|
+
end
|
183
|
+
|
173
184
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
174
185
|
config.credentials = credentials
|
175
186
|
config.quota_project = @quota_project_id
|
176
187
|
config.endpoint = @generators_stub.endpoint
|
177
188
|
config.universe_domain = @generators_stub.universe_domain
|
189
|
+
config.logger = @generators_stub.logger if config.respond_to? :logger=
|
178
190
|
end
|
179
191
|
end
|
180
192
|
|
@@ -185,6 +197,15 @@ module Google
|
|
185
197
|
#
|
186
198
|
attr_reader :location_client
|
187
199
|
|
200
|
+
##
|
201
|
+
# The logger used for request/response debug logging.
|
202
|
+
#
|
203
|
+
# @return [Logger]
|
204
|
+
#
|
205
|
+
def logger
|
206
|
+
@generators_stub.logger
|
207
|
+
end
|
208
|
+
|
188
209
|
# Service calls
|
189
210
|
|
190
211
|
##
|
@@ -281,7 +302,6 @@ module Google
|
|
281
302
|
|
282
303
|
@generators_stub.call_rpc :create_generator, request, options: options do |response, operation|
|
283
304
|
yield response, operation if block_given?
|
284
|
-
return response
|
285
305
|
end
|
286
306
|
rescue ::GRPC::BadStatus => e
|
287
307
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -368,7 +388,6 @@ module Google
|
|
368
388
|
|
369
389
|
@generators_stub.call_rpc :get_generator, request, options: options do |response, operation|
|
370
390
|
yield response, operation if block_given?
|
371
|
-
return response
|
372
391
|
end
|
373
392
|
rescue ::GRPC::BadStatus => e
|
374
393
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -465,7 +484,7 @@ module Google
|
|
465
484
|
@generators_stub.call_rpc :list_generators, request, options: options do |response, operation|
|
466
485
|
response = ::Gapic::PagedEnumerable.new @generators_stub, :list_generators, request, response, operation, options
|
467
486
|
yield response, operation if block_given?
|
468
|
-
|
487
|
+
throw :response, response
|
469
488
|
end
|
470
489
|
rescue ::GRPC::BadStatus => e
|
471
490
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -552,7 +571,6 @@ module Google
|
|
552
571
|
|
553
572
|
@generators_stub.call_rpc :delete_generator, request, options: options do |response, operation|
|
554
573
|
yield response, operation if block_given?
|
555
|
-
return response
|
556
574
|
end
|
557
575
|
rescue ::GRPC::BadStatus => e
|
558
576
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -641,7 +659,6 @@ module Google
|
|
641
659
|
|
642
660
|
@generators_stub.call_rpc :update_generator, request, options: options do |response, operation|
|
643
661
|
yield response, operation if block_given?
|
644
|
-
return response
|
645
662
|
end
|
646
663
|
rescue ::GRPC::BadStatus => e
|
647
664
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -730,6 +747,11 @@ module Google
|
|
730
747
|
# default endpoint URL. The default value of nil uses the environment
|
731
748
|
# universe (usually the default "googleapis.com" universe).
|
732
749
|
# @return [::String,nil]
|
750
|
+
# @!attribute [rw] logger
|
751
|
+
# A custom logger to use for request/response debug logging, or the value
|
752
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
753
|
+
# explicitly disable logging.
|
754
|
+
# @return [::Logger,:default,nil]
|
733
755
|
#
|
734
756
|
class Configuration
|
735
757
|
extend ::Gapic::Config
|
@@ -754,6 +776,7 @@ module Google
|
|
754
776
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
755
777
|
config_attr :quota_project, nil, ::String, nil
|
756
778
|
config_attr :universe_domain, nil, ::String, nil
|
779
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
757
780
|
|
758
781
|
# @private
|
759
782
|
def initialize parent_config = nil
|
@@ -160,15 +160,27 @@ module Google
|
|
160
160
|
endpoint: @config.endpoint,
|
161
161
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
162
162
|
universe_domain: @config.universe_domain,
|
163
|
-
credentials: credentials
|
163
|
+
credentials: credentials,
|
164
|
+
logger: @config.logger
|
164
165
|
)
|
165
166
|
|
167
|
+
@generators_stub.logger(stub: true)&.info do |entry|
|
168
|
+
entry.set_system_name
|
169
|
+
entry.set_service
|
170
|
+
entry.message = "Created client for #{entry.service}"
|
171
|
+
entry.set_credentials_fields credentials
|
172
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
173
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
174
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
175
|
+
end
|
176
|
+
|
166
177
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
167
178
|
config.credentials = credentials
|
168
179
|
config.quota_project = @quota_project_id
|
169
180
|
config.endpoint = @generators_stub.endpoint
|
170
181
|
config.universe_domain = @generators_stub.universe_domain
|
171
182
|
config.bindings_override = @config.bindings_override
|
183
|
+
config.logger = @generators_stub.logger if config.respond_to? :logger=
|
172
184
|
end
|
173
185
|
end
|
174
186
|
|
@@ -179,6 +191,15 @@ module Google
|
|
179
191
|
#
|
180
192
|
attr_reader :location_client
|
181
193
|
|
194
|
+
##
|
195
|
+
# The logger used for request/response debug logging.
|
196
|
+
#
|
197
|
+
# @return [Logger]
|
198
|
+
#
|
199
|
+
def logger
|
200
|
+
@generators_stub.logger
|
201
|
+
end
|
202
|
+
|
182
203
|
# Service calls
|
183
204
|
|
184
205
|
##
|
@@ -268,7 +289,6 @@ module Google
|
|
268
289
|
|
269
290
|
@generators_stub.create_generator request, options do |result, operation|
|
270
291
|
yield result, operation if block_given?
|
271
|
-
return result
|
272
292
|
end
|
273
293
|
rescue ::Gapic::Rest::Error => e
|
274
294
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -348,7 +368,6 @@ module Google
|
|
348
368
|
|
349
369
|
@generators_stub.get_generator request, options do |result, operation|
|
350
370
|
yield result, operation if block_given?
|
351
|
-
return result
|
352
371
|
end
|
353
372
|
rescue ::Gapic::Rest::Error => e
|
354
373
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -438,7 +457,7 @@ module Google
|
|
438
457
|
@generators_stub.list_generators request, options do |result, operation|
|
439
458
|
result = ::Gapic::Rest::PagedEnumerable.new @generators_stub, :list_generators, "generators", request, result, options
|
440
459
|
yield result, operation if block_given?
|
441
|
-
|
460
|
+
throw :response, result
|
442
461
|
end
|
443
462
|
rescue ::Gapic::Rest::Error => e
|
444
463
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -518,7 +537,6 @@ module Google
|
|
518
537
|
|
519
538
|
@generators_stub.delete_generator request, options do |result, operation|
|
520
539
|
yield result, operation if block_given?
|
521
|
-
return result
|
522
540
|
end
|
523
541
|
rescue ::Gapic::Rest::Error => e
|
524
542
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -600,7 +618,6 @@ module Google
|
|
600
618
|
|
601
619
|
@generators_stub.update_generator request, options do |result, operation|
|
602
620
|
yield result, operation if block_given?
|
603
|
-
return result
|
604
621
|
end
|
605
622
|
rescue ::Gapic::Rest::Error => e
|
606
623
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -680,6 +697,11 @@ module Google
|
|
680
697
|
# default endpoint URL. The default value of nil uses the environment
|
681
698
|
# universe (usually the default "googleapis.com" universe).
|
682
699
|
# @return [::String,nil]
|
700
|
+
# @!attribute [rw] logger
|
701
|
+
# A custom logger to use for request/response debug logging, or the value
|
702
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
703
|
+
# explicitly disable logging.
|
704
|
+
# @return [::Logger,:default,nil]
|
683
705
|
#
|
684
706
|
class Configuration
|
685
707
|
extend ::Gapic::Config
|
@@ -708,6 +730,7 @@ module Google
|
|
708
730
|
# by the host service.
|
709
731
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
710
732
|
config_attr :bindings_override, {}, ::Hash, nil
|
733
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
711
734
|
|
712
735
|
# @private
|
713
736
|
def initialize parent_config = nil
|