google-cloud-dialogflow-v2 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) 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 +12 -15
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +33 -10
  6. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +43 -38
  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 +12 -15
  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 +43 -38
  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 +12 -15
  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 +43 -38
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +86 -56
  24. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +6 -2
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +37 -10
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +12 -15
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +37 -10
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +43 -38
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +70 -44
  30. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +30 -10
  31. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +30 -10
  32. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +86 -56
  33. data/lib/google/cloud/dialogflow/v2/documents/client.rb +35 -9
  34. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +12 -15
  35. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -9
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +43 -38
  37. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +78 -50
  38. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/client.rb +29 -3
  39. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/operations.rb +12 -15
  40. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/client.rb +29 -3
  41. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/operations.rb +43 -38
  42. data/lib/google/cloud/dialogflow/v2/encryption_spec_service/rest/service_stub.rb +30 -14
  43. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +34 -11
  44. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +12 -15
  45. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +34 -11
  46. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +43 -38
  47. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +94 -62
  48. data/lib/google/cloud/dialogflow/v2/environments/client.rb +30 -7
  49. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +30 -7
  50. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +62 -38
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +28 -3
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +28 -3
  53. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +30 -14
  54. data/lib/google/cloud/dialogflow/v2/generators/client.rb +29 -6
  55. data/lib/google/cloud/dialogflow/v2/generators/rest/client.rb +29 -6
  56. data/lib/google/cloud/dialogflow/v2/generators/rest/service_stub.rb +54 -32
  57. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +1 -1
  58. data/lib/google/cloud/dialogflow/v2/intents/client.rb +31 -8
  59. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +12 -15
  60. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +31 -8
  61. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +43 -38
  62. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +70 -44
  63. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +29 -6
  64. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +29 -6
  65. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +54 -32
  66. data/lib/google/cloud/dialogflow/v2/participants/client.rb +29 -11
  67. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +29 -10
  68. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +86 -56
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +29 -6
  70. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +29 -6
  71. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +54 -32
  72. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +28 -3
  73. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +28 -2
  74. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +22 -8
  75. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  76. data/lib/google/cloud/dialogflow/v2/versions/client.rb +29 -6
  77. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +29 -6
  78. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +54 -32
  79. data/proto_docs/google/api/client.rb +19 -0
  80. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +3 -2
  81. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +2 -2
  82. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +10 -6
  83. data/proto_docs/google/cloud/dialogflow/v2/conversation_dataset.rb +2 -2
  84. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +7 -4
  85. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +1 -1
  86. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +10 -8
  87. data/proto_docs/google/cloud/dialogflow/v2/session.rb +12 -10
  88. data/proto_docs/google/longrunning/operations.rb +19 -14
  89. metadata +5 -5
@@ -157,15 +157,27 @@ module Google
157
157
  endpoint: @config.endpoint,
158
158
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
159
  universe_domain: @config.universe_domain,
160
- credentials: credentials
160
+ credentials: credentials,
161
+ logger: @config.logger
161
162
  )
162
163
 
164
+ @knowledge_bases_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+
163
174
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
164
175
  config.credentials = credentials
165
176
  config.quota_project = @quota_project_id
166
177
  config.endpoint = @knowledge_bases_stub.endpoint
167
178
  config.universe_domain = @knowledge_bases_stub.universe_domain
168
179
  config.bindings_override = @config.bindings_override
180
+ config.logger = @knowledge_bases_stub.logger if config.respond_to? :logger=
169
181
  end
170
182
  end
171
183
 
@@ -176,6 +188,15 @@ module Google
176
188
  #
177
189
  attr_reader :location_client
178
190
 
191
+ ##
192
+ # The logger used for request/response debug logging.
193
+ #
194
+ # @return [Logger]
195
+ #
196
+ def logger
197
+ @knowledge_bases_stub.logger
198
+ end
199
+
179
200
  # Service calls
180
201
 
181
202
  ##
@@ -289,7 +310,7 @@ module Google
289
310
  @knowledge_bases_stub.list_knowledge_bases request, options do |result, operation|
290
311
  result = ::Gapic::Rest::PagedEnumerable.new @knowledge_bases_stub, :list_knowledge_bases, "knowledge_bases", request, result, options
291
312
  yield result, operation if block_given?
292
- return result
313
+ throw :response, result
293
314
  end
294
315
  rescue ::Gapic::Rest::Error => e
295
316
  raise ::Google::Cloud::Error.from_error(e)
@@ -370,7 +391,6 @@ module Google
370
391
 
371
392
  @knowledge_bases_stub.get_knowledge_base request, options do |result, operation|
372
393
  yield result, operation if block_given?
373
- return result
374
394
  end
375
395
  rescue ::Gapic::Rest::Error => e
376
396
  raise ::Google::Cloud::Error.from_error(e)
@@ -452,7 +472,6 @@ module Google
452
472
 
453
473
  @knowledge_bases_stub.create_knowledge_base request, options do |result, operation|
454
474
  yield result, operation if block_given?
455
- return result
456
475
  end
457
476
  rescue ::Gapic::Rest::Error => e
458
477
  raise ::Google::Cloud::Error.from_error(e)
@@ -536,7 +555,6 @@ module Google
536
555
 
537
556
  @knowledge_bases_stub.delete_knowledge_base request, options do |result, operation|
538
557
  yield result, operation if block_given?
539
- return result
540
558
  end
541
559
  rescue ::Gapic::Rest::Error => e
542
560
  raise ::Google::Cloud::Error.from_error(e)
@@ -619,7 +637,6 @@ module Google
619
637
 
620
638
  @knowledge_bases_stub.update_knowledge_base request, options do |result, operation|
621
639
  yield result, operation if block_given?
622
- return result
623
640
  end
624
641
  rescue ::Gapic::Rest::Error => e
625
642
  raise ::Google::Cloud::Error.from_error(e)
@@ -699,6 +716,11 @@ module Google
699
716
  # default endpoint URL. The default value of nil uses the environment
700
717
  # universe (usually the default "googleapis.com" universe).
701
718
  # @return [::String,nil]
719
+ # @!attribute [rw] logger
720
+ # A custom logger to use for request/response debug logging, or the value
721
+ # `:default` (the default) to construct a default logger, or `nil` to
722
+ # explicitly disable logging.
723
+ # @return [::Logger,:default,nil]
702
724
  #
703
725
  class Configuration
704
726
  extend ::Gapic::Config
@@ -727,6 +749,7 @@ module Google
727
749
  # by the host service.
728
750
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
729
751
  config_attr :bindings_override, {}, ::Hash, nil
752
+ config_attr :logger, :default, ::Logger, nil, :default
730
753
 
731
754
  # @private
732
755
  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 list_knowledge_bases 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: "list_knowledge_bases",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dialogflow::V2::ListKnowledgeBasesResponse.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_knowledge_base",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dialogflow::V2::KnowledgeBase.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: "create_knowledge_base",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dialogflow::V2::KnowledgeBase.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: "delete_knowledge_base",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Protobuf::Empty.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: "update_knowledge_base",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Cloud::Dialogflow::V2::KnowledgeBase.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
  ##
@@ -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