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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/dialogflow/v2/agents/client.rb +33 -10
  4. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +9 -5
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +33 -10
  6. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +40 -28
  7. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +86 -56
  8. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +29 -3
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +29 -3
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +30 -14
  11. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +29 -7
  12. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +29 -7
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +62 -38
  14. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +32 -6
  15. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +9 -5
  16. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +32 -6
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +40 -28
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +54 -32
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +35 -10
  20. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +9 -5
  21. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -10
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +40 -28
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +31 -8
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +9 -5
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +31 -8
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +40 -28
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +70 -44
  29. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +30 -10
  30. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +30 -10
  31. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +86 -56
  32. data/lib/google/cloud/dialogflow/v2/documents/client.rb +35 -9
  33. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +9 -5
  34. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
  35. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +40 -28
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +78 -50
  37. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +29 -3
  38. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +9 -5
  39. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +29 -3
  40. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +40 -28
  41. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/service_stub.rb +30 -14
  42. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +34 -11
  43. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +9 -5
  44. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
  45. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +40 -28
  46. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +94 -62
  47. data/lib/google/cloud/dialogflow/v2/environments/client.rb +30 -7
  48. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +30 -7
  49. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +62 -38
  50. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +28 -3
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +28 -3
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +30 -14
  53. data/lib/google/cloud/dialogflow/v2/generators/client.rb +29 -6
  54. data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +29 -6
  55. data/lib/google/cloud/dialogflow/v2/generators/rest/service_stub.rb +54 -32
  56. data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
  57. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +9 -5
  58. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
  59. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +40 -28
  60. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +70 -44
  61. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +29 -6
  62. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +29 -6
  63. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +54 -32
  64. data/lib/google/cloud/dialogflow/v2/participants/client.rb +29 -11
  65. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +29 -10
  66. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +86 -56
  67. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +29 -6
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +29 -6
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +54 -32
  70. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +28 -3
  71. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +28 -2
  72. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +22 -8
  73. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  74. data/lib/google/cloud/dialogflow/v2/versions/client.rb +29 -6
  75. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +29 -6
  76. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +54 -32
  77. metadata +4 -4
@@ -170,14 +170,26 @@ module Google
170
170
  universe_domain: @config.universe_domain,
171
171
  channel_args: @config.channel_args,
172
172
  interceptors: @config.interceptors,
173
- channel_pool_config: @config.channel_pool
173
+ channel_pool_config: @config.channel_pool,
174
+ logger: @config.logger
174
175
  )
175
176
 
177
+ @participants_stub.stub_logger&.info do |entry|
178
+ entry.set_system_name
179
+ entry.set_service
180
+ entry.message = "Created client for #{entry.service}"
181
+ entry.set_credentials_fields credentials
182
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
183
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
184
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
185
+ end
186
+
176
187
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
177
188
  config.credentials = credentials
178
189
  config.quota_project = @quota_project_id
179
190
  config.endpoint = @participants_stub.endpoint
180
191
  config.universe_domain = @participants_stub.universe_domain
192
+ config.logger = @participants_stub.logger if config.respond_to? :logger=
181
193
  end
182
194
  end
183
195
 
@@ -188,6 +200,15 @@ module Google
188
200
  #
189
201
  attr_reader :location_client
190
202
 
203
+ ##
204
+ # The logger used for request/response debug logging.
205
+ #
206
+ # @return [Logger]
207
+ #
208
+ def logger
209
+ @participants_stub.logger
210
+ end
211
+
191
212
  # Service calls
192
213
 
193
214
  ##
@@ -274,7 +295,6 @@ module Google
274
295
 
275
296
  @participants_stub.call_rpc :create_participant, request, options: options do |response, operation|
276
297
  yield response, operation if block_given?
277
- return response
278
298
  end
279
299
  rescue ::GRPC::BadStatus => e
280
300
  raise ::Google::Cloud::Error.from_error(e)
@@ -362,7 +382,6 @@ module Google
362
382
 
363
383
  @participants_stub.call_rpc :get_participant, request, options: options do |response, operation|
364
384
  yield response, operation if block_given?
365
- return response
366
385
  end
367
386
  rescue ::GRPC::BadStatus => e
368
387
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,7 +479,7 @@ module Google
460
479
  @participants_stub.call_rpc :list_participants, request, options: options do |response, operation|
461
480
  response = ::Gapic::PagedEnumerable.new @participants_stub, :list_participants, request, response, operation, options
462
481
  yield response, operation if block_given?
463
- return response
482
+ throw :response, response
464
483
  end
465
484
  rescue ::GRPC::BadStatus => e
466
485
  raise ::Google::Cloud::Error.from_error(e)
@@ -548,7 +567,6 @@ module Google
548
567
 
549
568
  @participants_stub.call_rpc :update_participant, request, options: options do |response, operation|
550
569
  yield response, operation if block_given?
551
- return response
552
570
  end
553
571
  rescue ::GRPC::BadStatus => e
554
572
  raise ::Google::Cloud::Error.from_error(e)
@@ -668,7 +686,6 @@ module Google
668
686
 
669
687
  @participants_stub.call_rpc :analyze_content, request, options: options do |response, operation|
670
688
  yield response, operation if block_given?
671
- return response
672
689
  end
673
690
  rescue ::GRPC::BadStatus => e
674
691
  raise ::Google::Cloud::Error.from_error(e)
@@ -761,7 +778,6 @@ module Google
761
778
 
762
779
  @participants_stub.call_rpc :streaming_analyze_content, request, options: options do |response, operation|
763
780
  yield response, operation if block_given?
764
- return response
765
781
  end
766
782
  rescue ::GRPC::BadStatus => e
767
783
  raise ::Google::Cloud::Error.from_error(e)
@@ -863,7 +879,6 @@ module Google
863
879
 
864
880
  @participants_stub.call_rpc :suggest_articles, request, options: options do |response, operation|
865
881
  yield response, operation if block_given?
866
- return response
867
882
  end
868
883
  rescue ::GRPC::BadStatus => e
869
884
  raise ::Google::Cloud::Error.from_error(e)
@@ -964,7 +979,6 @@ module Google
964
979
 
965
980
  @participants_stub.call_rpc :suggest_faq_answers, request, options: options do |response, operation|
966
981
  yield response, operation if block_given?
967
- return response
968
982
  end
969
983
  rescue ::GRPC::BadStatus => e
970
984
  raise ::Google::Cloud::Error.from_error(e)
@@ -1067,7 +1081,6 @@ module Google
1067
1081
 
1068
1082
  @participants_stub.call_rpc :suggest_smart_replies, request, options: options do |response, operation|
1069
1083
  yield response, operation if block_given?
1070
- return response
1071
1084
  end
1072
1085
  rescue ::GRPC::BadStatus => e
1073
1086
  raise ::Google::Cloud::Error.from_error(e)
@@ -1170,7 +1183,6 @@ module Google
1170
1183
 
1171
1184
  @participants_stub.call_rpc :suggest_knowledge_assist, request, options: options do |response, operation|
1172
1185
  yield response, operation if block_given?
1173
- return response
1174
1186
  end
1175
1187
  rescue ::GRPC::BadStatus => e
1176
1188
  raise ::Google::Cloud::Error.from_error(e)
@@ -1259,6 +1271,11 @@ module Google
1259
1271
  # default endpoint URL. The default value of nil uses the environment
1260
1272
  # universe (usually the default "googleapis.com" universe).
1261
1273
  # @return [::String,nil]
1274
+ # @!attribute [rw] logger
1275
+ # A custom logger to use for request/response debug logging, or the value
1276
+ # `:default` (the default) to construct a default logger, or `nil` to
1277
+ # explicitly disable logging.
1278
+ # @return [::Logger,:default,nil]
1262
1279
  #
1263
1280
  class Configuration
1264
1281
  extend ::Gapic::Config
@@ -1283,6 +1300,7 @@ module Google
1283
1300
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1284
1301
  config_attr :quota_project, nil, ::String, nil
1285
1302
  config_attr :universe_domain, nil, ::String, nil
1303
+ config_attr :logger, :default, ::Logger, nil, :default
1286
1304
 
1287
1305
  # @private
1288
1306
  def initialize parent_config = nil
@@ -161,15 +161,27 @@ module Google
161
161
  endpoint: @config.endpoint,
162
162
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
163
  universe_domain: @config.universe_domain,
164
- credentials: credentials
164
+ credentials: credentials,
165
+ logger: @config.logger
165
166
  )
166
167
 
168
+ @participants_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+
167
178
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
168
179
  config.credentials = credentials
169
180
  config.quota_project = @quota_project_id
170
181
  config.endpoint = @participants_stub.endpoint
171
182
  config.universe_domain = @participants_stub.universe_domain
172
183
  config.bindings_override = @config.bindings_override
184
+ config.logger = @participants_stub.logger if config.respond_to? :logger=
173
185
  end
174
186
  end
175
187
 
@@ -180,6 +192,15 @@ module Google
180
192
  #
181
193
  attr_reader :location_client
182
194
 
195
+ ##
196
+ # The logger used for request/response debug logging.
197
+ #
198
+ # @return [Logger]
199
+ #
200
+ def logger
201
+ @participants_stub.logger
202
+ end
203
+
183
204
  # Service calls
184
205
 
185
206
  ##
@@ -259,7 +280,6 @@ module Google
259
280
 
260
281
  @participants_stub.create_participant request, options do |result, operation|
261
282
  yield result, operation if block_given?
262
- return result
263
283
  end
264
284
  rescue ::Gapic::Rest::Error => e
265
285
  raise ::Google::Cloud::Error.from_error(e)
@@ -340,7 +360,6 @@ module Google
340
360
 
341
361
  @participants_stub.get_participant request, options do |result, operation|
342
362
  yield result, operation if block_given?
343
- return result
344
363
  end
345
364
  rescue ::Gapic::Rest::Error => e
346
365
  raise ::Google::Cloud::Error.from_error(e)
@@ -431,7 +450,7 @@ module Google
431
450
  @participants_stub.list_participants request, options do |result, operation|
432
451
  result = ::Gapic::Rest::PagedEnumerable.new @participants_stub, :list_participants, "participants", request, result, options
433
452
  yield result, operation if block_given?
434
- return result
453
+ throw :response, result
435
454
  end
436
455
  rescue ::Gapic::Rest::Error => e
437
456
  raise ::Google::Cloud::Error.from_error(e)
@@ -512,7 +531,6 @@ module Google
512
531
 
513
532
  @participants_stub.update_participant request, options do |result, operation|
514
533
  yield result, operation if block_given?
515
- return result
516
534
  end
517
535
  rescue ::Gapic::Rest::Error => e
518
536
  raise ::Google::Cloud::Error.from_error(e)
@@ -625,7 +643,6 @@ module Google
625
643
 
626
644
  @participants_stub.analyze_content request, options do |result, operation|
627
645
  yield result, operation if block_given?
628
- return result
629
646
  end
630
647
  rescue ::Gapic::Rest::Error => e
631
648
  raise ::Google::Cloud::Error.from_error(e)
@@ -720,7 +737,6 @@ module Google
720
737
 
721
738
  @participants_stub.suggest_articles request, options do |result, operation|
722
739
  yield result, operation if block_given?
723
- return result
724
740
  end
725
741
  rescue ::Gapic::Rest::Error => e
726
742
  raise ::Google::Cloud::Error.from_error(e)
@@ -814,7 +830,6 @@ module Google
814
830
 
815
831
  @participants_stub.suggest_faq_answers request, options do |result, operation|
816
832
  yield result, operation if block_given?
817
- return result
818
833
  end
819
834
  rescue ::Gapic::Rest::Error => e
820
835
  raise ::Google::Cloud::Error.from_error(e)
@@ -910,7 +925,6 @@ module Google
910
925
 
911
926
  @participants_stub.suggest_smart_replies request, options do |result, operation|
912
927
  yield result, operation if block_given?
913
- return result
914
928
  end
915
929
  rescue ::Gapic::Rest::Error => e
916
930
  raise ::Google::Cloud::Error.from_error(e)
@@ -1006,7 +1020,6 @@ module Google
1006
1020
 
1007
1021
  @participants_stub.suggest_knowledge_assist request, options do |result, operation|
1008
1022
  yield result, operation if block_given?
1009
- return result
1010
1023
  end
1011
1024
  rescue ::Gapic::Rest::Error => e
1012
1025
  raise ::Google::Cloud::Error.from_error(e)
@@ -1086,6 +1099,11 @@ module Google
1086
1099
  # default endpoint URL. The default value of nil uses the environment
1087
1100
  # universe (usually the default "googleapis.com" universe).
1088
1101
  # @return [::String,nil]
1102
+ # @!attribute [rw] logger
1103
+ # A custom logger to use for request/response debug logging, or the value
1104
+ # `:default` (the default) to construct a default logger, or `nil` to
1105
+ # explicitly disable logging.
1106
+ # @return [::Logger,:default,nil]
1089
1107
  #
1090
1108
  class Configuration
1091
1109
  extend ::Gapic::Config
@@ -1114,6 +1132,7 @@ module Google
1114
1132
  # by the host service.
1115
1133
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1116
1134
  config_attr :bindings_override, {}, ::Hash, nil
1135
+ config_attr :logger, :default, ::Logger, nil, :default
1117
1136
 
1118
1137
  # @private
1119
1138
  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
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
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
- raise_faraday_errors: false
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 create_participant 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: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "create_participant",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dialogflow::V2::Participant.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
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: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "get_participant",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dialogflow::V2::Participant.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
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: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "list_participants",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dialogflow::V2::ListParticipantsResponse.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
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: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "update_participant",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Dialogflow::V2::Participant.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
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: uri,
243
- body: body || "",
244
- params: query_string_params,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "analyze_content",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Dialogflow::V2::AnalyzeContentResponse.decode_json response.body, ignore_unknown_fields: true
249
-
250
- yield result, operation if block_given?
251
- result
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: uri,
281
- body: body || "",
282
- params: query_string_params,
302
+ uri: uri,
303
+ body: body || "",
304
+ params: query_string_params,
305
+ method_name: "suggest_articles",
283
306
  options: options
284
307
  )
285
308
  operation = ::Gapic::Rest::TransportOperation.new response
286
309
  result = ::Google::Cloud::Dialogflow::V2::SuggestArticlesResponse.decode_json response.body, ignore_unknown_fields: true
287
-
288
- yield result, operation if block_given?
289
- result
310
+ catch :response do
311
+ yield result, operation if block_given?
312
+ result
313
+ end
290
314
  end
291
315
 
292
316
  ##
@@ -315,16 +339,18 @@ module Google
315
339
 
316
340
  response = @client_stub.make_http_request(
317
341
  verb,
318
- uri: uri,
319
- body: body || "",
320
- params: query_string_params,
342
+ uri: uri,
343
+ body: body || "",
344
+ params: query_string_params,
345
+ method_name: "suggest_faq_answers",
321
346
  options: options
322
347
  )
323
348
  operation = ::Gapic::Rest::TransportOperation.new response
324
349
  result = ::Google::Cloud::Dialogflow::V2::SuggestFaqAnswersResponse.decode_json response.body, ignore_unknown_fields: true
325
-
326
- yield result, operation if block_given?
327
- result
350
+ catch :response do
351
+ yield result, operation if block_given?
352
+ result
353
+ end
328
354
  end
329
355
 
330
356
  ##
@@ -353,16 +379,18 @@ module Google
353
379
 
354
380
  response = @client_stub.make_http_request(
355
381
  verb,
356
- uri: uri,
357
- body: body || "",
358
- params: query_string_params,
382
+ uri: uri,
383
+ body: body || "",
384
+ params: query_string_params,
385
+ method_name: "suggest_smart_replies",
359
386
  options: options
360
387
  )
361
388
  operation = ::Gapic::Rest::TransportOperation.new response
362
389
  result = ::Google::Cloud::Dialogflow::V2::SuggestSmartRepliesResponse.decode_json response.body, ignore_unknown_fields: true
363
-
364
- yield result, operation if block_given?
365
- result
390
+ catch :response do
391
+ yield result, operation if block_given?
392
+ result
393
+ end
366
394
  end
367
395
 
368
396
  ##
@@ -391,16 +419,18 @@ module Google
391
419
 
392
420
  response = @client_stub.make_http_request(
393
421
  verb,
394
- uri: uri,
395
- body: body || "",
396
- params: query_string_params,
422
+ uri: uri,
423
+ body: body || "",
424
+ params: query_string_params,
425
+ method_name: "suggest_knowledge_assist",
397
426
  options: options
398
427
  )
399
428
  operation = ::Gapic::Rest::TransportOperation.new response
400
429
  result = ::Google::Cloud::Dialogflow::V2::SuggestKnowledgeAssistResponse.decode_json response.body, ignore_unknown_fields: true
401
-
402
- yield result, operation if block_given?
403
- result
430
+ catch :response do
431
+ yield result, operation if block_given?
432
+ result
433
+ end
404
434
  end
405
435
 
406
436
  ##
@@ -164,14 +164,26 @@ module Google
164
164
  universe_domain: @config.universe_domain,
165
165
  channel_args: @config.channel_args,
166
166
  interceptors: @config.interceptors,
167
- channel_pool_config: @config.channel_pool
167
+ channel_pool_config: @config.channel_pool,
168
+ logger: @config.logger
168
169
  )
169
170
 
171
+ @session_entity_types_stub.stub_logger&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
180
+
170
181
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
171
182
  config.credentials = credentials
172
183
  config.quota_project = @quota_project_id
173
184
  config.endpoint = @session_entity_types_stub.endpoint
174
185
  config.universe_domain = @session_entity_types_stub.universe_domain
186
+ config.logger = @session_entity_types_stub.logger if config.respond_to? :logger=
175
187
  end
176
188
  end
177
189
 
@@ -182,6 +194,15 @@ module Google
182
194
  #
183
195
  attr_reader :location_client
184
196
 
197
+ ##
198
+ # The logger used for request/response debug logging.
199
+ #
200
+ # @return [Logger]
201
+ #
202
+ def logger
203
+ @session_entity_types_stub.logger
204
+ end
205
+
185
206
  # Service calls
186
207
 
187
208
  ##
@@ -283,7 +304,7 @@ module Google
283
304
  @session_entity_types_stub.call_rpc :list_session_entity_types, request, options: options do |response, operation|
284
305
  response = ::Gapic::PagedEnumerable.new @session_entity_types_stub, :list_session_entity_types, request, response, operation, options
285
306
  yield response, operation if block_given?
286
- return response
307
+ throw :response, response
287
308
  end
288
309
  rescue ::GRPC::BadStatus => e
289
310
  raise ::Google::Cloud::Error.from_error(e)
@@ -379,7 +400,6 @@ module Google
379
400
 
380
401
  @session_entity_types_stub.call_rpc :get_session_entity_type, request, options: options do |response, operation|
381
402
  yield response, operation if block_given?
382
- return response
383
403
  end
384
404
  rescue ::GRPC::BadStatus => e
385
405
  raise ::Google::Cloud::Error.from_error(e)
@@ -479,7 +499,6 @@ module Google
479
499
 
480
500
  @session_entity_types_stub.call_rpc :create_session_entity_type, request, options: options do |response, operation|
481
501
  yield response, operation if block_given?
482
- return response
483
502
  end
484
503
  rescue ::GRPC::BadStatus => e
485
504
  raise ::Google::Cloud::Error.from_error(e)
@@ -571,7 +590,6 @@ module Google
571
590
 
572
591
  @session_entity_types_stub.call_rpc :update_session_entity_type, request, options: options do |response, operation|
573
592
  yield response, operation if block_given?
574
- return response
575
593
  end
576
594
  rescue ::GRPC::BadStatus => e
577
595
  raise ::Google::Cloud::Error.from_error(e)
@@ -667,7 +685,6 @@ module Google
667
685
 
668
686
  @session_entity_types_stub.call_rpc :delete_session_entity_type, request, options: options do |response, operation|
669
687
  yield response, operation if block_given?
670
- return response
671
688
  end
672
689
  rescue ::GRPC::BadStatus => e
673
690
  raise ::Google::Cloud::Error.from_error(e)
@@ -756,6 +773,11 @@ module Google
756
773
  # default endpoint URL. The default value of nil uses the environment
757
774
  # universe (usually the default "googleapis.com" universe).
758
775
  # @return [::String,nil]
776
+ # @!attribute [rw] logger
777
+ # A custom logger to use for request/response debug logging, or the value
778
+ # `:default` (the default) to construct a default logger, or `nil` to
779
+ # explicitly disable logging.
780
+ # @return [::Logger,:default,nil]
759
781
  #
760
782
  class Configuration
761
783
  extend ::Gapic::Config
@@ -780,6 +802,7 @@ module Google
780
802
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
781
803
  config_attr :quota_project, nil, ::String, nil
782
804
  config_attr :universe_domain, nil, ::String, nil
805
+ config_attr :logger, :default, ::Logger, nil, :default
783
806
 
784
807
  # @private
785
808
  def initialize parent_config = nil