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
@@ -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
+ @versions_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 = @versions_stub.endpoint
166
177
  config.universe_domain = @versions_stub.universe_domain
167
178
  config.bindings_override = @config.bindings_override
179
+ config.logger = @versions_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
+ @versions_stub.logger
197
+ end
198
+
178
199
  # Service calls
179
200
 
180
201
  ##
@@ -264,7 +285,7 @@ module Google
264
285
  @versions_stub.list_versions request, options do |result, operation|
265
286
  result = ::Gapic::Rest::PagedEnumerable.new @versions_stub, :list_versions, "versions", request, result, options
266
287
  yield result, operation if block_given?
267
- return result
288
+ throw :response, result
268
289
  end
269
290
  rescue ::Gapic::Rest::Error => e
270
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -348,7 +369,6 @@ module Google
348
369
 
349
370
  @versions_stub.get_version request, options do |result, operation|
350
371
  yield result, operation if block_given?
351
- return result
352
372
  end
353
373
  rescue ::Gapic::Rest::Error => e
354
374
  raise ::Google::Cloud::Error.from_error(e)
@@ -435,7 +455,6 @@ module Google
435
455
 
436
456
  @versions_stub.create_version request, options do |result, operation|
437
457
  yield result, operation if block_given?
438
- return result
439
458
  end
440
459
  rescue ::Gapic::Rest::Error => e
441
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -525,7 +544,6 @@ module Google
525
544
 
526
545
  @versions_stub.update_version request, options do |result, operation|
527
546
  yield result, operation if block_given?
528
- return result
529
547
  end
530
548
  rescue ::Gapic::Rest::Error => e
531
549
  raise ::Google::Cloud::Error.from_error(e)
@@ -609,7 +627,6 @@ module Google
609
627
 
610
628
  @versions_stub.delete_version request, options do |result, operation|
611
629
  yield result, operation if block_given?
612
- return result
613
630
  end
614
631
  rescue ::Gapic::Rest::Error => e
615
632
  raise ::Google::Cloud::Error.from_error(e)
@@ -689,6 +706,11 @@ module Google
689
706
  # default endpoint URL. The default value of nil uses the environment
690
707
  # universe (usually the default "googleapis.com" universe).
691
708
  # @return [::String,nil]
709
+ # @!attribute [rw] logger
710
+ # A custom logger to use for request/response debug logging, or the value
711
+ # `:default` (the default) to construct a default logger, or `nil` to
712
+ # explicitly disable logging.
713
+ # @return [::Logger,:default,nil]
692
714
  #
693
715
  class Configuration
694
716
  extend ::Gapic::Config
@@ -717,6 +739,7 @@ module Google
717
739
  # by the host service.
718
740
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
719
741
  config_attr :bindings_override, {}, ::Hash, nil
742
+ config_attr :logger, :default, ::Logger, nil, :default
720
743
 
721
744
  # @private
722
745
  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_versions 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_versions",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Dialogflow::V2::ListVersionsResponse.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_version",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Dialogflow::V2::Version.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_version",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::Dialogflow::V2::Version.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_version",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::Dialogflow::V2::Version.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: "delete_version",
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
- 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
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-dialogflow-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.1
19
+ version: 0.24.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.21.1
29
+ version: 0.24.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a