google-cloud-dataqna-v1alpha 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/README.md +2 -2
  4. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/client.rb +1 -1
  5. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/credentials.rb +1 -1
  6. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/paths.rb +1 -1
  7. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/rest/client.rb +510 -0
  8. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/rest/service_stub.rb +143 -0
  9. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/rest.rb +117 -0
  10. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +7 -1
  11. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service_services_pb.rb +1 -1
  12. data/lib/google/cloud/dataqna/v1alpha/question_service/client.rb +1 -1
  13. data/lib/google/cloud/dataqna/v1alpha/question_service/credentials.rb +1 -1
  14. data/lib/google/cloud/dataqna/v1alpha/question_service/paths.rb +1 -1
  15. data/lib/google/cloud/dataqna/v1alpha/question_service/rest/client.rb +808 -0
  16. data/lib/google/cloud/dataqna/v1alpha/question_service/rest/service_stub.rb +389 -0
  17. data/lib/google/cloud/dataqna/v1alpha/question_service/rest.rb +66 -0
  18. data/lib/google/cloud/dataqna/v1alpha/question_service.rb +7 -1
  19. data/lib/google/cloud/dataqna/v1alpha/question_service_services_pb.rb +1 -1
  20. data/lib/google/cloud/dataqna/v1alpha/rest.rb +38 -0
  21. data/lib/google/cloud/dataqna/v1alpha/version.rb +1 -1
  22. data/lib/google/cloud/dataqna/v1alpha.rb +6 -1
  23. data/lib/google-cloud-dataqna-v1alpha.rb +1 -1
  24. data/proto_docs/README.md +1 -1
  25. data/proto_docs/google/api/client.rb +1 -1
  26. data/proto_docs/google/api/field_behavior.rb +1 -1
  27. data/proto_docs/google/api/launch_stage.rb +1 -1
  28. data/proto_docs/google/api/resource.rb +1 -1
  29. data/proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb +1 -1
  30. data/proto_docs/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +1 -1
  31. data/proto_docs/google/cloud/dataqna/v1alpha/question.rb +1 -1
  32. data/proto_docs/google/cloud/dataqna/v1alpha/question_service.rb +1 -1
  33. data/proto_docs/google/cloud/dataqna/v1alpha/user_feedback.rb +1 -1
  34. data/proto_docs/google/protobuf/any.rb +1 -1
  35. data/proto_docs/google/protobuf/duration.rb +1 -1
  36. data/proto_docs/google/protobuf/field_mask.rb +1 -1
  37. data/proto_docs/google/protobuf/timestamp.rb +8 -7
  38. data/proto_docs/google/rpc/status.rb +1 -1
  39. metadata +8 -1
@@ -0,0 +1,808 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dataqna/v1alpha/question_service_pb"
21
+ require "google/cloud/dataqna/v1alpha/question_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DataQnA
26
+ module V1alpha
27
+ module QuestionService
28
+ module Rest
29
+ ##
30
+ # REST client for the QuestionService service.
31
+ #
32
+ # Service to interpret natural language queries.
33
+ # The service allows to create `Question` resources that are interpreted and
34
+ # are filled with one or more interpretations if the question could be
35
+ # interpreted. Once a `Question` resource is created and has at least one
36
+ # interpretation, an interpretation can be chosen for execution, which
37
+ # triggers a query to the backend (for BigQuery, it will create a job).
38
+ # Upon successful execution of that interpretation, backend specific
39
+ # information will be returned so that the client can retrieve the results
40
+ # from the backend.
41
+ #
42
+ # The `Question` resources are named `projects/*/locations/*/questions/*`.
43
+ #
44
+ # The `Question` resource has a singletion sub-resource `UserFeedback` named
45
+ # `projects/*/locations/*/questions/*/userFeedback`, which allows access to
46
+ # user feedback.
47
+ #
48
+ class Client
49
+ # @private
50
+ API_VERSION = ""
51
+
52
+ # @private
53
+ DEFAULT_ENDPOINT_TEMPLATE = "dataqna.$UNIVERSE_DOMAIN$"
54
+
55
+ include Paths
56
+
57
+ # @private
58
+ attr_reader :question_service_stub
59
+
60
+ ##
61
+ # Configure the QuestionService Client class.
62
+ #
63
+ # See {::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client::Configuration}
64
+ # for a description of the configuration fields.
65
+ #
66
+ # @example
67
+ #
68
+ # # Modify the configuration for all QuestionService clients
69
+ # ::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.configure do |config|
70
+ # config.timeout = 10.0
71
+ # end
72
+ #
73
+ # @yield [config] Configure the Client client.
74
+ # @yieldparam config [Client::Configuration]
75
+ #
76
+ # @return [Client::Configuration]
77
+ #
78
+ def self.configure
79
+ @configure ||= begin
80
+ namespace = ["Google", "Cloud", "DataQnA", "V1alpha"]
81
+ parent_config = while namespace.any?
82
+ parent_name = namespace.join "::"
83
+ parent_const = const_get parent_name
84
+ break parent_const.configure if parent_const.respond_to? :configure
85
+ namespace.pop
86
+ end
87
+ default_config = Client::Configuration.new parent_config
88
+
89
+ default_config.timeout = 60.0
90
+ default_config.retry_policy = {
91
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
92
+ }
93
+
94
+ default_config.rpcs.create_question.timeout = 60.0
95
+
96
+ default_config.rpcs.execute_question.timeout = 60.0
97
+
98
+ default_config.rpcs.update_user_feedback.timeout = 60.0
99
+
100
+ default_config
101
+ end
102
+ yield @configure if block_given?
103
+ @configure
104
+ end
105
+
106
+ ##
107
+ # Configure the QuestionService Client instance.
108
+ #
109
+ # The configuration is set to the derived mode, meaning that values can be changed,
110
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
111
+ # should be made on {Client.configure}.
112
+ #
113
+ # See {::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client::Configuration}
114
+ # for a description of the configuration fields.
115
+ #
116
+ # @yield [config] Configure the Client client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ # @return [Client::Configuration]
120
+ #
121
+ def configure
122
+ yield @config if block_given?
123
+ @config
124
+ end
125
+
126
+ ##
127
+ # The effective universe domain
128
+ #
129
+ # @return [String]
130
+ #
131
+ def universe_domain
132
+ @question_service_stub.universe_domain
133
+ end
134
+
135
+ ##
136
+ # Create a new QuestionService REST client object.
137
+ #
138
+ # @example
139
+ #
140
+ # # Create a client using the default configuration
141
+ # client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new
142
+ #
143
+ # # Create a client using a custom configuration
144
+ # client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new do |config|
145
+ # config.timeout = 10.0
146
+ # end
147
+ #
148
+ # @yield [config] Configure the QuestionService client.
149
+ # @yieldparam config [Client::Configuration]
150
+ #
151
+ def initialize
152
+ # Create the configuration object
153
+ @config = Configuration.new Client.configure
154
+
155
+ # Yield the configuration if needed
156
+ yield @config if block_given?
157
+
158
+ # Create credentials
159
+ credentials = @config.credentials
160
+ # Use self-signed JWT if the endpoint is unchanged from default,
161
+ # but only if the default endpoint does not have a region prefix.
162
+ enable_self_signed_jwt = @config.endpoint.nil? ||
163
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
164
+ !@config.endpoint.split(".").first.include?("-"))
165
+ credentials ||= Credentials.default scope: @config.scope,
166
+ enable_self_signed_jwt: enable_self_signed_jwt
167
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
168
+ credentials = Credentials.new credentials, scope: @config.scope
169
+ end
170
+
171
+ @quota_project_id = @config.quota_project
172
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
173
+
174
+ @question_service_stub = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::ServiceStub.new(
175
+ endpoint: @config.endpoint,
176
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
177
+ universe_domain: @config.universe_domain,
178
+ credentials: credentials,
179
+ logger: @config.logger
180
+ )
181
+
182
+ @question_service_stub.logger(stub: true)&.info do |entry|
183
+ entry.set_system_name
184
+ entry.set_service
185
+ entry.message = "Created client for #{entry.service}"
186
+ entry.set_credentials_fields credentials
187
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
188
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
189
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
190
+ end
191
+ end
192
+
193
+ ##
194
+ # The logger used for request/response debug logging.
195
+ #
196
+ # @return [Logger]
197
+ #
198
+ def logger
199
+ @question_service_stub.logger
200
+ end
201
+
202
+ # Service calls
203
+
204
+ ##
205
+ # Gets a previously created question.
206
+ #
207
+ # @overload get_question(request, options = nil)
208
+ # Pass arguments to `get_question` via a request object, either of type
209
+ # {::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest} or an equivalent Hash.
210
+ #
211
+ # @param request [::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest, ::Hash]
212
+ # A request object representing the call parameters. Required. To specify no
213
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
214
+ # @param options [::Gapic::CallOptions, ::Hash]
215
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
216
+ #
217
+ # @overload get_question(name: nil, read_mask: nil)
218
+ # Pass arguments to `get_question` via keyword arguments. Note that at
219
+ # least one keyword argument is required. To specify no parameters, or to keep all
220
+ # the default parameter values, pass an empty Hash as a request object (see above).
221
+ #
222
+ # @param name [::String]
223
+ # Required. The unique identifier for the question.
224
+ # Example: `projects/foo/locations/bar/questions/1234`
225
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
226
+ # The list of fields to be retrieved.
227
+ # @yield [result, operation] Access the result along with the TransportOperation object
228
+ # @yieldparam result [::Google::Cloud::DataQnA::V1alpha::Question]
229
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
230
+ #
231
+ # @return [::Google::Cloud::DataQnA::V1alpha::Question]
232
+ #
233
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
234
+ #
235
+ # @example Basic example
236
+ # require "google/cloud/dataqna/v1alpha"
237
+ #
238
+ # # Create a client object. The client can be reused for multiple calls.
239
+ # client = Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new
240
+ #
241
+ # # Create a request. To set request fields, pass in keyword arguments.
242
+ # request = Google::Cloud::DataQnA::V1alpha::GetQuestionRequest.new
243
+ #
244
+ # # Call the get_question method.
245
+ # result = client.get_question request
246
+ #
247
+ # # The returned object is of type Google::Cloud::DataQnA::V1alpha::Question.
248
+ # p result
249
+ #
250
+ def get_question request, options = nil
251
+ raise ::ArgumentError, "request must be provided" if request.nil?
252
+
253
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest
254
+
255
+ # Converts hash and nil to an options object
256
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
257
+
258
+ # Customize the options with defaults
259
+ call_metadata = @config.rpcs.get_question.metadata.to_h
260
+
261
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
262
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
263
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
264
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION,
265
+ transports_version_send: [:rest]
266
+
267
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
268
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
269
+
270
+ options.apply_defaults timeout: @config.rpcs.get_question.timeout,
271
+ metadata: call_metadata,
272
+ retry_policy: @config.rpcs.get_question.retry_policy
273
+
274
+ options.apply_defaults timeout: @config.timeout,
275
+ metadata: @config.metadata,
276
+ retry_policy: @config.retry_policy
277
+
278
+ @question_service_stub.get_question request, options do |result, operation|
279
+ yield result, operation if block_given?
280
+ end
281
+ rescue ::Gapic::Rest::Error => e
282
+ raise ::Google::Cloud::Error.from_error(e)
283
+ end
284
+
285
+ ##
286
+ # Creates a question.
287
+ #
288
+ # @overload create_question(request, options = nil)
289
+ # Pass arguments to `create_question` via a request object, either of type
290
+ # {::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest} or an equivalent Hash.
291
+ #
292
+ # @param request [::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest, ::Hash]
293
+ # A request object representing the call parameters. Required. To specify no
294
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
295
+ # @param options [::Gapic::CallOptions, ::Hash]
296
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
297
+ #
298
+ # @overload create_question(parent: nil, question: nil)
299
+ # Pass arguments to `create_question` via keyword arguments. Note that at
300
+ # least one keyword argument is required. To specify no parameters, or to keep all
301
+ # the default parameter values, pass an empty Hash as a request object (see above).
302
+ #
303
+ # @param parent [::String]
304
+ # Required. The name of the project this data source reference belongs to.
305
+ # Example: `projects/foo/locations/bar`
306
+ # @param question [::Google::Cloud::DataQnA::V1alpha::Question, ::Hash]
307
+ # Required. The question to create.
308
+ # @yield [result, operation] Access the result along with the TransportOperation object
309
+ # @yieldparam result [::Google::Cloud::DataQnA::V1alpha::Question]
310
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
311
+ #
312
+ # @return [::Google::Cloud::DataQnA::V1alpha::Question]
313
+ #
314
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
315
+ #
316
+ # @example Basic example
317
+ # require "google/cloud/dataqna/v1alpha"
318
+ #
319
+ # # Create a client object. The client can be reused for multiple calls.
320
+ # client = Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new
321
+ #
322
+ # # Create a request. To set request fields, pass in keyword arguments.
323
+ # request = Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest.new
324
+ #
325
+ # # Call the create_question method.
326
+ # result = client.create_question request
327
+ #
328
+ # # The returned object is of type Google::Cloud::DataQnA::V1alpha::Question.
329
+ # p result
330
+ #
331
+ def create_question request, options = nil
332
+ raise ::ArgumentError, "request must be provided" if request.nil?
333
+
334
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest
335
+
336
+ # Converts hash and nil to an options object
337
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
338
+
339
+ # Customize the options with defaults
340
+ call_metadata = @config.rpcs.create_question.metadata.to_h
341
+
342
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
343
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
344
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
345
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION,
346
+ transports_version_send: [:rest]
347
+
348
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
349
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
+
351
+ options.apply_defaults timeout: @config.rpcs.create_question.timeout,
352
+ metadata: call_metadata,
353
+ retry_policy: @config.rpcs.create_question.retry_policy
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
357
+ retry_policy: @config.retry_policy
358
+
359
+ @question_service_stub.create_question request, options do |result, operation|
360
+ yield result, operation if block_given?
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Executes an interpretation.
368
+ #
369
+ # @overload execute_question(request, options = nil)
370
+ # Pass arguments to `execute_question` via a request object, either of type
371
+ # {::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
378
+ #
379
+ # @overload execute_question(name: nil, interpretation_index: nil)
380
+ # Pass arguments to `execute_question` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param name [::String]
385
+ # Required. The unique identifier for the question.
386
+ # Example: `projects/foo/locations/bar/questions/1234`
387
+ # @param interpretation_index [::Integer]
388
+ # Required. Index of the interpretation to execute.
389
+ # @yield [result, operation] Access the result along with the TransportOperation object
390
+ # @yieldparam result [::Google::Cloud::DataQnA::V1alpha::Question]
391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
392
+ #
393
+ # @return [::Google::Cloud::DataQnA::V1alpha::Question]
394
+ #
395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
396
+ #
397
+ # @example Basic example
398
+ # require "google/cloud/dataqna/v1alpha"
399
+ #
400
+ # # Create a client object. The client can be reused for multiple calls.
401
+ # client = Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new
402
+ #
403
+ # # Create a request. To set request fields, pass in keyword arguments.
404
+ # request = Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest.new
405
+ #
406
+ # # Call the execute_question method.
407
+ # result = client.execute_question request
408
+ #
409
+ # # The returned object is of type Google::Cloud::DataQnA::V1alpha::Question.
410
+ # p result
411
+ #
412
+ def execute_question request, options = nil
413
+ raise ::ArgumentError, "request must be provided" if request.nil?
414
+
415
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest
416
+
417
+ # Converts hash and nil to an options object
418
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
419
+
420
+ # Customize the options with defaults
421
+ call_metadata = @config.rpcs.execute_question.metadata.to_h
422
+
423
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
424
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
425
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
426
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION,
427
+ transports_version_send: [:rest]
428
+
429
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
430
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ options.apply_defaults timeout: @config.rpcs.execute_question.timeout,
433
+ metadata: call_metadata,
434
+ retry_policy: @config.rpcs.execute_question.retry_policy
435
+
436
+ options.apply_defaults timeout: @config.timeout,
437
+ metadata: @config.metadata,
438
+ retry_policy: @config.retry_policy
439
+
440
+ @question_service_stub.execute_question request, options do |result, operation|
441
+ yield result, operation if block_given?
442
+ end
443
+ rescue ::Gapic::Rest::Error => e
444
+ raise ::Google::Cloud::Error.from_error(e)
445
+ end
446
+
447
+ ##
448
+ # Gets previously created user feedback.
449
+ #
450
+ # @overload get_user_feedback(request, options = nil)
451
+ # Pass arguments to `get_user_feedback` via a request object, either of type
452
+ # {::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest, ::Hash]
455
+ # A request object representing the call parameters. Required. To specify no
456
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
457
+ # @param options [::Gapic::CallOptions, ::Hash]
458
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
459
+ #
460
+ # @overload get_user_feedback(name: nil)
461
+ # Pass arguments to `get_user_feedback` via keyword arguments. Note that at
462
+ # least one keyword argument is required. To specify no parameters, or to keep all
463
+ # the default parameter values, pass an empty Hash as a request object (see above).
464
+ #
465
+ # @param name [::String]
466
+ # Required. The unique identifier for the user feedback.
467
+ # User feedback is a singleton resource on a Question.
468
+ # Example: `projects/foo/locations/bar/questions/1234/userFeedback`
469
+ # @yield [result, operation] Access the result along with the TransportOperation object
470
+ # @yieldparam result [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
471
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
472
+ #
473
+ # @return [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
474
+ #
475
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
476
+ #
477
+ # @example Basic example
478
+ # require "google/cloud/dataqna/v1alpha"
479
+ #
480
+ # # Create a client object. The client can be reused for multiple calls.
481
+ # client = Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new
482
+ #
483
+ # # Create a request. To set request fields, pass in keyword arguments.
484
+ # request = Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest.new
485
+ #
486
+ # # Call the get_user_feedback method.
487
+ # result = client.get_user_feedback request
488
+ #
489
+ # # The returned object is of type Google::Cloud::DataQnA::V1alpha::UserFeedback.
490
+ # p result
491
+ #
492
+ def get_user_feedback request, options = nil
493
+ raise ::ArgumentError, "request must be provided" if request.nil?
494
+
495
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest
496
+
497
+ # Converts hash and nil to an options object
498
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
499
+
500
+ # Customize the options with defaults
501
+ call_metadata = @config.rpcs.get_user_feedback.metadata.to_h
502
+
503
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
504
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
505
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
506
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION,
507
+ transports_version_send: [:rest]
508
+
509
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
510
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
511
+
512
+ options.apply_defaults timeout: @config.rpcs.get_user_feedback.timeout,
513
+ metadata: call_metadata,
514
+ retry_policy: @config.rpcs.get_user_feedback.retry_policy
515
+
516
+ options.apply_defaults timeout: @config.timeout,
517
+ metadata: @config.metadata,
518
+ retry_policy: @config.retry_policy
519
+
520
+ @question_service_stub.get_user_feedback request, options do |result, operation|
521
+ yield result, operation if block_given?
522
+ end
523
+ rescue ::Gapic::Rest::Error => e
524
+ raise ::Google::Cloud::Error.from_error(e)
525
+ end
526
+
527
+ ##
528
+ # Updates user feedback. This creates user feedback if there was none before
529
+ # (upsert).
530
+ #
531
+ # @overload update_user_feedback(request, options = nil)
532
+ # Pass arguments to `update_user_feedback` via a request object, either of type
533
+ # {::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest} or an equivalent Hash.
534
+ #
535
+ # @param request [::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest, ::Hash]
536
+ # A request object representing the call parameters. Required. To specify no
537
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
538
+ # @param options [::Gapic::CallOptions, ::Hash]
539
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
540
+ #
541
+ # @overload update_user_feedback(user_feedback: nil, update_mask: nil)
542
+ # Pass arguments to `update_user_feedback` via keyword arguments. Note that at
543
+ # least one keyword argument is required. To specify no parameters, or to keep all
544
+ # the default parameter values, pass an empty Hash as a request object (see above).
545
+ #
546
+ # @param user_feedback [::Google::Cloud::DataQnA::V1alpha::UserFeedback, ::Hash]
547
+ # Required. The user feedback to update. This can be called even if there is no
548
+ # user feedback so far.
549
+ # The feedback's name field is used to identify the user feedback (and the
550
+ # corresponding question) to update.
551
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
552
+ # The list of fields to be updated.
553
+ # @yield [result, operation] Access the result along with the TransportOperation object
554
+ # @yieldparam result [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
555
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
556
+ #
557
+ # @return [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
558
+ #
559
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
560
+ #
561
+ # @example Basic example
562
+ # require "google/cloud/dataqna/v1alpha"
563
+ #
564
+ # # Create a client object. The client can be reused for multiple calls.
565
+ # client = Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new
566
+ #
567
+ # # Create a request. To set request fields, pass in keyword arguments.
568
+ # request = Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest.new
569
+ #
570
+ # # Call the update_user_feedback method.
571
+ # result = client.update_user_feedback request
572
+ #
573
+ # # The returned object is of type Google::Cloud::DataQnA::V1alpha::UserFeedback.
574
+ # p result
575
+ #
576
+ def update_user_feedback request, options = nil
577
+ raise ::ArgumentError, "request must be provided" if request.nil?
578
+
579
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest
580
+
581
+ # Converts hash and nil to an options object
582
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
583
+
584
+ # Customize the options with defaults
585
+ call_metadata = @config.rpcs.update_user_feedback.metadata.to_h
586
+
587
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
588
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
589
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
590
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION,
591
+ transports_version_send: [:rest]
592
+
593
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
594
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
595
+
596
+ options.apply_defaults timeout: @config.rpcs.update_user_feedback.timeout,
597
+ metadata: call_metadata,
598
+ retry_policy: @config.rpcs.update_user_feedback.retry_policy
599
+
600
+ options.apply_defaults timeout: @config.timeout,
601
+ metadata: @config.metadata,
602
+ retry_policy: @config.retry_policy
603
+
604
+ @question_service_stub.update_user_feedback request, options do |result, operation|
605
+ yield result, operation if block_given?
606
+ end
607
+ rescue ::Gapic::Rest::Error => e
608
+ raise ::Google::Cloud::Error.from_error(e)
609
+ end
610
+
611
+ ##
612
+ # Configuration class for the QuestionService REST API.
613
+ #
614
+ # This class represents the configuration for QuestionService REST,
615
+ # providing control over timeouts, retry behavior, logging, transport
616
+ # parameters, and other low-level controls. Certain parameters can also be
617
+ # applied individually to specific RPCs. See
618
+ # {::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client::Configuration::Rpcs}
619
+ # for a list of RPCs that can be configured independently.
620
+ #
621
+ # Configuration can be applied globally to all clients, or to a single client
622
+ # on construction.
623
+ #
624
+ # @example
625
+ #
626
+ # # Modify the global config, setting the timeout for
627
+ # # get_question to 20 seconds,
628
+ # # and all remaining timeouts to 10 seconds.
629
+ # ::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.configure do |config|
630
+ # config.timeout = 10.0
631
+ # config.rpcs.get_question.timeout = 20.0
632
+ # end
633
+ #
634
+ # # Apply the above configuration only to a new client.
635
+ # client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Rest::Client.new do |config|
636
+ # config.timeout = 10.0
637
+ # config.rpcs.get_question.timeout = 20.0
638
+ # end
639
+ #
640
+ # @!attribute [rw] endpoint
641
+ # A custom service endpoint, as a hostname or hostname:port. The default is
642
+ # nil, indicating to use the default endpoint in the current universe domain.
643
+ # @return [::String,nil]
644
+ # @!attribute [rw] credentials
645
+ # Credentials to send with calls. You may provide any of the following types:
646
+ # * (`String`) The path to a service account key file in JSON format
647
+ # * (`Hash`) A service account key as a Hash
648
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
649
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
650
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
651
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
652
+ # * (`nil`) indicating no credentials
653
+ #
654
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
655
+ # external source for authentication to Google Cloud, you must validate it before
656
+ # providing it to a Google API client library. Providing an unvalidated credential
657
+ # configuration to Google APIs can compromise the security of your systems and data.
658
+ # For more information, refer to [Validate credential configurations from external
659
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
660
+ # @return [::Object]
661
+ # @!attribute [rw] scope
662
+ # The OAuth scopes
663
+ # @return [::Array<::String>]
664
+ # @!attribute [rw] lib_name
665
+ # The library name as recorded in instrumentation and logging
666
+ # @return [::String]
667
+ # @!attribute [rw] lib_version
668
+ # The library version as recorded in instrumentation and logging
669
+ # @return [::String]
670
+ # @!attribute [rw] timeout
671
+ # The call timeout in seconds.
672
+ # @return [::Numeric]
673
+ # @!attribute [rw] metadata
674
+ # Additional headers to be sent with the call.
675
+ # @return [::Hash{::Symbol=>::String}]
676
+ # @!attribute [rw] retry_policy
677
+ # The retry policy. The value is a hash with the following keys:
678
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
679
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
680
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
681
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
682
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
683
+ # trigger a retry.
684
+ # @return [::Hash]
685
+ # @!attribute [rw] quota_project
686
+ # A separate project against which to charge quota.
687
+ # @return [::String]
688
+ # @!attribute [rw] universe_domain
689
+ # The universe domain within which to make requests. This determines the
690
+ # default endpoint URL. The default value of nil uses the environment
691
+ # universe (usually the default "googleapis.com" universe).
692
+ # @return [::String,nil]
693
+ # @!attribute [rw] logger
694
+ # A custom logger to use for request/response debug logging, or the value
695
+ # `:default` (the default) to construct a default logger, or `nil` to
696
+ # explicitly disable logging.
697
+ # @return [::Logger,:default,nil]
698
+ #
699
+ class Configuration
700
+ extend ::Gapic::Config
701
+
702
+ # @private
703
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
704
+ DEFAULT_ENDPOINT = "dataqna.googleapis.com"
705
+
706
+ config_attr :endpoint, nil, ::String, nil
707
+ config_attr :credentials, nil do |value|
708
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
709
+ allowed.any? { |klass| klass === value }
710
+ end
711
+ config_attr :scope, nil, ::String, ::Array, nil
712
+ config_attr :lib_name, nil, ::String, nil
713
+ config_attr :lib_version, nil, ::String, nil
714
+ config_attr :timeout, nil, ::Numeric, nil
715
+ config_attr :metadata, nil, ::Hash, nil
716
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
717
+ config_attr :quota_project, nil, ::String, nil
718
+ config_attr :universe_domain, nil, ::String, nil
719
+ config_attr :logger, :default, ::Logger, nil, :default
720
+
721
+ # @private
722
+ def initialize parent_config = nil
723
+ @parent_config = parent_config unless parent_config.nil?
724
+
725
+ yield self if block_given?
726
+ end
727
+
728
+ ##
729
+ # Configurations for individual RPCs
730
+ # @return [Rpcs]
731
+ #
732
+ def rpcs
733
+ @rpcs ||= begin
734
+ parent_rpcs = nil
735
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
736
+ Rpcs.new parent_rpcs
737
+ end
738
+ end
739
+
740
+ ##
741
+ # Configuration RPC class for the QuestionService API.
742
+ #
743
+ # Includes fields providing the configuration for each RPC in this service.
744
+ # Each configuration object is of type `Gapic::Config::Method` and includes
745
+ # the following configuration fields:
746
+ #
747
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
748
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
749
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
750
+ # include the following keys:
751
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
752
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
753
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
754
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
755
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
756
+ # trigger a retry.
757
+ #
758
+ class Rpcs
759
+ ##
760
+ # RPC-specific configuration for `get_question`
761
+ # @return [::Gapic::Config::Method]
762
+ #
763
+ attr_reader :get_question
764
+ ##
765
+ # RPC-specific configuration for `create_question`
766
+ # @return [::Gapic::Config::Method]
767
+ #
768
+ attr_reader :create_question
769
+ ##
770
+ # RPC-specific configuration for `execute_question`
771
+ # @return [::Gapic::Config::Method]
772
+ #
773
+ attr_reader :execute_question
774
+ ##
775
+ # RPC-specific configuration for `get_user_feedback`
776
+ # @return [::Gapic::Config::Method]
777
+ #
778
+ attr_reader :get_user_feedback
779
+ ##
780
+ # RPC-specific configuration for `update_user_feedback`
781
+ # @return [::Gapic::Config::Method]
782
+ #
783
+ attr_reader :update_user_feedback
784
+
785
+ # @private
786
+ def initialize parent_rpcs = nil
787
+ get_question_config = parent_rpcs.get_question if parent_rpcs.respond_to? :get_question
788
+ @get_question = ::Gapic::Config::Method.new get_question_config
789
+ create_question_config = parent_rpcs.create_question if parent_rpcs.respond_to? :create_question
790
+ @create_question = ::Gapic::Config::Method.new create_question_config
791
+ execute_question_config = parent_rpcs.execute_question if parent_rpcs.respond_to? :execute_question
792
+ @execute_question = ::Gapic::Config::Method.new execute_question_config
793
+ get_user_feedback_config = parent_rpcs.get_user_feedback if parent_rpcs.respond_to? :get_user_feedback
794
+ @get_user_feedback = ::Gapic::Config::Method.new get_user_feedback_config
795
+ update_user_feedback_config = parent_rpcs.update_user_feedback if parent_rpcs.respond_to? :update_user_feedback
796
+ @update_user_feedback = ::Gapic::Config::Method.new update_user_feedback_config
797
+
798
+ yield self if block_given?
799
+ end
800
+ end
801
+ end
802
+ end
803
+ end
804
+ end
805
+ end
806
+ end
807
+ end
808
+ end