google-cloud-dataqna-v1alpha 0.1.0

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 (36) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +139 -0
  6. data/lib/google-cloud-dataqna-v1alpha.rb +21 -0
  7. data/lib/google/cloud/dataqna/v1alpha.rb +39 -0
  8. data/lib/google/cloud/dataqna/v1alpha/annotated_string_pb.rb +40 -0
  9. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +114 -0
  10. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/client.rb +459 -0
  11. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/credentials.rb +51 -0
  12. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service/paths.rb +50 -0
  13. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service_pb.rb +56 -0
  14. data/lib/google/cloud/dataqna/v1alpha/auto_suggestion_service_services_pb.rb +111 -0
  15. data/lib/google/cloud/dataqna/v1alpha/question_pb.rb +155 -0
  16. data/lib/google/cloud/dataqna/v1alpha/question_service.rb +63 -0
  17. data/lib/google/cloud/dataqna/v1alpha/question_service/client.rb +712 -0
  18. data/lib/google/cloud/dataqna/v1alpha/question_service/credentials.rb +51 -0
  19. data/lib/google/cloud/dataqna/v1alpha/question_service/paths.rb +88 -0
  20. data/lib/google/cloud/dataqna/v1alpha/question_service_pb.rb +49 -0
  21. data/lib/google/cloud/dataqna/v1alpha/question_service_services_pb.rb +68 -0
  22. data/lib/google/cloud/dataqna/v1alpha/user_feedback_pb.rb +32 -0
  23. data/lib/google/cloud/dataqna/v1alpha/version.rb +28 -0
  24. data/proto_docs/README.md +4 -0
  25. data/proto_docs/google/api/field_behavior.rb +65 -0
  26. data/proto_docs/google/api/resource.rb +283 -0
  27. data/proto_docs/google/cloud/dataqna/v1alpha/annotated_string.rb +110 -0
  28. data/proto_docs/google/cloud/dataqna/v1alpha/auto_suggestion_service.rb +140 -0
  29. data/proto_docs/google/cloud/dataqna/v1alpha/question.rb +418 -0
  30. data/proto_docs/google/cloud/dataqna/v1alpha/question_service.rb +91 -0
  31. data/proto_docs/google/cloud/dataqna/v1alpha/user_feedback.rb +55 -0
  32. data/proto_docs/google/protobuf/any.rb +141 -0
  33. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  34. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  35. data/proto_docs/google/rpc/status.rb +46 -0
  36. metadata +219 -0
@@ -0,0 +1,712 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+
22
+ module Google
23
+ module Cloud
24
+ module DataQnA
25
+ module V1alpha
26
+ module QuestionService
27
+ ##
28
+ # Client for the QuestionService service.
29
+ #
30
+ # Service to interpret natural language queries.
31
+ # The service allows to create `Question` resources that are interpreted and
32
+ # are filled with one or more interpretations if the question could be
33
+ # interpreted. Once a `Question` resource is created and has at least one
34
+ # interpretation, an interpretation can be chosen for execution, which
35
+ # triggers a query to the backend (for BigQuery, it will create a job).
36
+ # Upon successful execution of that interpretation, backend specific
37
+ # information will be returned so that the client can retrieve the results
38
+ # from the backend.
39
+ #
40
+ # The `Question` resources are named `projects/*/locations/*/questions/*`.
41
+ #
42
+ # The `Question` resource has a singletion sub-resource `UserFeedback` named
43
+ # `projects/*/locations/*/questions/*/userFeedback`, which allows access to
44
+ # user feedback.
45
+ #
46
+ class Client
47
+ include Paths
48
+
49
+ # @private
50
+ attr_reader :question_service_stub
51
+
52
+ ##
53
+ # Configure the QuestionService Client class.
54
+ #
55
+ # See {::Google::Cloud::DataQnA::V1alpha::QuestionService::Client::Configuration}
56
+ # for a description of the configuration fields.
57
+ #
58
+ # ## Example
59
+ #
60
+ # To modify the configuration for all QuestionService clients:
61
+ #
62
+ # ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.configure do |config|
63
+ # config.timeout = 10.0
64
+ # end
65
+ #
66
+ # @yield [config] Configure the Client client.
67
+ # @yieldparam config [Client::Configuration]
68
+ #
69
+ # @return [Client::Configuration]
70
+ #
71
+ def self.configure
72
+ @configure ||= begin
73
+ namespace = ["Google", "Cloud", "DataQnA", "V1alpha"]
74
+ parent_config = while namespace.any?
75
+ parent_name = namespace.join "::"
76
+ parent_const = const_get parent_name
77
+ break parent_const.configure if parent_const&.respond_to? :configure
78
+ namespace.pop
79
+ end
80
+ default_config = Client::Configuration.new parent_config
81
+
82
+ default_config.timeout = 60.0
83
+ default_config.retry_policy = {
84
+ initial_delay: 1.0,
85
+ max_delay: 10.0,
86
+ multiplier: 1.3,
87
+ retry_codes: [14]
88
+ }
89
+
90
+ default_config.rpcs.create_question.timeout = 60.0
91
+
92
+ default_config.rpcs.execute_question.timeout = 60.0
93
+
94
+ default_config.rpcs.update_user_feedback.timeout = 60.0
95
+
96
+ default_config
97
+ end
98
+ yield @configure if block_given?
99
+ @configure
100
+ end
101
+
102
+ ##
103
+ # Configure the QuestionService Client instance.
104
+ #
105
+ # The configuration is set to the derived mode, meaning that values can be changed,
106
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
107
+ # should be made on {Client.configure}.
108
+ #
109
+ # See {::Google::Cloud::DataQnA::V1alpha::QuestionService::Client::Configuration}
110
+ # for a description of the configuration fields.
111
+ #
112
+ # @yield [config] Configure the Client client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ # @return [Client::Configuration]
116
+ #
117
+ def configure
118
+ yield @config if block_given?
119
+ @config
120
+ end
121
+
122
+ ##
123
+ # Create a new QuestionService client object.
124
+ #
125
+ # ## Examples
126
+ #
127
+ # To create a new QuestionService client with the default
128
+ # configuration:
129
+ #
130
+ # client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new
131
+ #
132
+ # To create a new QuestionService client with a custom
133
+ # configuration:
134
+ #
135
+ # client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
138
+ #
139
+ # @yield [config] Configure the QuestionService client.
140
+ # @yieldparam config [Client::Configuration]
141
+ #
142
+ def initialize
143
+ # These require statements are intentionally placed here to initialize
144
+ # the gRPC module only when it's required.
145
+ # See https://github.com/googleapis/toolkit/issues/446
146
+ require "gapic/grpc"
147
+ require "google/cloud/dataqna/v1alpha/question_service_services_pb"
148
+
149
+ # Create the configuration object
150
+ @config = Configuration.new Client.configure
151
+
152
+ # Yield the configuration if needed
153
+ yield @config if block_given?
154
+
155
+ # Create credentials
156
+ credentials = @config.credentials
157
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
158
+ # but only if the default endpoint does not have a region prefix.
159
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
160
+ @config.endpoint == Client.configure.endpoint &&
161
+ !@config.endpoint.split(".").first.include?("-")
162
+ credentials ||= Credentials.default scope: @config.scope,
163
+ enable_self_signed_jwt: enable_self_signed_jwt
164
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
165
+ credentials = Credentials.new credentials, scope: @config.scope
166
+ end
167
+ @quota_project_id = @config.quota_project
168
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
169
+
170
+ @question_service_stub = ::Gapic::ServiceStub.new(
171
+ ::Google::Cloud::DataQnA::V1alpha::QuestionService::Stub,
172
+ credentials: credentials,
173
+ endpoint: @config.endpoint,
174
+ channel_args: @config.channel_args,
175
+ interceptors: @config.interceptors
176
+ )
177
+ end
178
+
179
+ # Service calls
180
+
181
+ ##
182
+ # Gets a previously created question.
183
+ #
184
+ # @overload get_question(request, options = nil)
185
+ # Pass arguments to `get_question` via a request object, either of type
186
+ # {::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest} or an equivalent Hash.
187
+ #
188
+ # @param request [::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest, ::Hash]
189
+ # A request object representing the call parameters. Required. To specify no
190
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
191
+ # @param options [::Gapic::CallOptions, ::Hash]
192
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
193
+ #
194
+ # @overload get_question(name: nil, read_mask: nil)
195
+ # Pass arguments to `get_question` via keyword arguments. Note that at
196
+ # least one keyword argument is required. To specify no parameters, or to keep all
197
+ # the default parameter values, pass an empty Hash as a request object (see above).
198
+ #
199
+ # @param name [::String]
200
+ # Required. The unique identifier for the question.
201
+ # Example: `projects/foo/locations/bar/questions/1234`
202
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
203
+ # The list of fields to be retrieved.
204
+ #
205
+ # @yield [response, operation] Access the result along with the RPC operation
206
+ # @yieldparam response [::Google::Cloud::DataQnA::V1alpha::Question]
207
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
208
+ #
209
+ # @return [::Google::Cloud::DataQnA::V1alpha::Question]
210
+ #
211
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
212
+ #
213
+ def get_question request, options = nil
214
+ raise ::ArgumentError, "request must be provided" if request.nil?
215
+
216
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::GetQuestionRequest
217
+
218
+ # Converts hash and nil to an options object
219
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
220
+
221
+ # Customize the options with defaults
222
+ metadata = @config.rpcs.get_question.metadata.to_h
223
+
224
+ # Set x-goog-api-client and x-goog-user-project headers
225
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
226
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
227
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION
228
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
229
+
230
+ header_params = {
231
+ "name" => request.name
232
+ }
233
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
234
+ metadata[:"x-goog-request-params"] ||= request_params_header
235
+
236
+ options.apply_defaults timeout: @config.rpcs.get_question.timeout,
237
+ metadata: metadata,
238
+ retry_policy: @config.rpcs.get_question.retry_policy
239
+ options.apply_defaults metadata: @config.metadata,
240
+ retry_policy: @config.retry_policy
241
+
242
+ @question_service_stub.call_rpc :get_question, request, options: options do |response, operation|
243
+ yield response, operation if block_given?
244
+ return response
245
+ end
246
+ rescue ::GRPC::BadStatus => e
247
+ raise ::Google::Cloud::Error.from_error(e)
248
+ end
249
+
250
+ ##
251
+ # Creates a question.
252
+ #
253
+ # @overload create_question(request, options = nil)
254
+ # Pass arguments to `create_question` via a request object, either of type
255
+ # {::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest} or an equivalent Hash.
256
+ #
257
+ # @param request [::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest, ::Hash]
258
+ # A request object representing the call parameters. Required. To specify no
259
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
260
+ # @param options [::Gapic::CallOptions, ::Hash]
261
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
262
+ #
263
+ # @overload create_question(parent: nil, question: nil)
264
+ # Pass arguments to `create_question` via keyword arguments. Note that at
265
+ # least one keyword argument is required. To specify no parameters, or to keep all
266
+ # the default parameter values, pass an empty Hash as a request object (see above).
267
+ #
268
+ # @param parent [::String]
269
+ # Required. The name of the project this data source reference belongs to.
270
+ # Example: `projects/foo/locations/bar`
271
+ # @param question [::Google::Cloud::DataQnA::V1alpha::Question, ::Hash]
272
+ # Required. The question to create.
273
+ #
274
+ # @yield [response, operation] Access the result along with the RPC operation
275
+ # @yieldparam response [::Google::Cloud::DataQnA::V1alpha::Question]
276
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
277
+ #
278
+ # @return [::Google::Cloud::DataQnA::V1alpha::Question]
279
+ #
280
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
281
+ #
282
+ def create_question request, options = nil
283
+ raise ::ArgumentError, "request must be provided" if request.nil?
284
+
285
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::CreateQuestionRequest
286
+
287
+ # Converts hash and nil to an options object
288
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
289
+
290
+ # Customize the options with defaults
291
+ metadata = @config.rpcs.create_question.metadata.to_h
292
+
293
+ # Set x-goog-api-client and x-goog-user-project headers
294
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
295
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
296
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION
297
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
298
+
299
+ header_params = {
300
+ "parent" => request.parent
301
+ }
302
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
303
+ metadata[:"x-goog-request-params"] ||= request_params_header
304
+
305
+ options.apply_defaults timeout: @config.rpcs.create_question.timeout,
306
+ metadata: metadata,
307
+ retry_policy: @config.rpcs.create_question.retry_policy
308
+ options.apply_defaults metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @question_service_stub.call_rpc :create_question, request, options: options do |response, operation|
312
+ yield response, operation if block_given?
313
+ return response
314
+ end
315
+ rescue ::GRPC::BadStatus => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Executes an interpretation.
321
+ #
322
+ # @overload execute_question(request, options = nil)
323
+ # Pass arguments to `execute_question` via a request object, either of type
324
+ # {::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest} or an equivalent Hash.
325
+ #
326
+ # @param request [::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest, ::Hash]
327
+ # A request object representing the call parameters. Required. To specify no
328
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
329
+ # @param options [::Gapic::CallOptions, ::Hash]
330
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
331
+ #
332
+ # @overload execute_question(name: nil, interpretation_index: nil)
333
+ # Pass arguments to `execute_question` via keyword arguments. Note that at
334
+ # least one keyword argument is required. To specify no parameters, or to keep all
335
+ # the default parameter values, pass an empty Hash as a request object (see above).
336
+ #
337
+ # @param name [::String]
338
+ # Required. The unique identifier for the question.
339
+ # Example: `projects/foo/locations/bar/questions/1234`
340
+ # @param interpretation_index [::Integer]
341
+ # Required. Index of the interpretation to execute.
342
+ #
343
+ # @yield [response, operation] Access the result along with the RPC operation
344
+ # @yieldparam response [::Google::Cloud::DataQnA::V1alpha::Question]
345
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
346
+ #
347
+ # @return [::Google::Cloud::DataQnA::V1alpha::Question]
348
+ #
349
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
350
+ #
351
+ def execute_question request, options = nil
352
+ raise ::ArgumentError, "request must be provided" if request.nil?
353
+
354
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::ExecuteQuestionRequest
355
+
356
+ # Converts hash and nil to an options object
357
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
358
+
359
+ # Customize the options with defaults
360
+ metadata = @config.rpcs.execute_question.metadata.to_h
361
+
362
+ # Set x-goog-api-client and x-goog-user-project headers
363
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
364
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
365
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION
366
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
367
+
368
+ header_params = {
369
+ "name" => request.name
370
+ }
371
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
372
+ metadata[:"x-goog-request-params"] ||= request_params_header
373
+
374
+ options.apply_defaults timeout: @config.rpcs.execute_question.timeout,
375
+ metadata: metadata,
376
+ retry_policy: @config.rpcs.execute_question.retry_policy
377
+ options.apply_defaults metadata: @config.metadata,
378
+ retry_policy: @config.retry_policy
379
+
380
+ @question_service_stub.call_rpc :execute_question, request, options: options do |response, operation|
381
+ yield response, operation if block_given?
382
+ return response
383
+ end
384
+ rescue ::GRPC::BadStatus => e
385
+ raise ::Google::Cloud::Error.from_error(e)
386
+ end
387
+
388
+ ##
389
+ # Gets previously created user feedback.
390
+ #
391
+ # @overload get_user_feedback(request, options = nil)
392
+ # Pass arguments to `get_user_feedback` via a request object, either of type
393
+ # {::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest} or an equivalent Hash.
394
+ #
395
+ # @param request [::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest, ::Hash]
396
+ # A request object representing the call parameters. Required. To specify no
397
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
398
+ # @param options [::Gapic::CallOptions, ::Hash]
399
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
400
+ #
401
+ # @overload get_user_feedback(name: nil)
402
+ # Pass arguments to `get_user_feedback` via keyword arguments. Note that at
403
+ # least one keyword argument is required. To specify no parameters, or to keep all
404
+ # the default parameter values, pass an empty Hash as a request object (see above).
405
+ #
406
+ # @param name [::String]
407
+ # Required. The unique identifier for the user feedback.
408
+ # User feedback is a singleton resource on a Question.
409
+ # Example: `projects/foo/locations/bar/questions/1234/userFeedback`
410
+ #
411
+ # @yield [response, operation] Access the result along with the RPC operation
412
+ # @yieldparam response [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
413
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
414
+ #
415
+ # @return [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
416
+ #
417
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
418
+ #
419
+ def get_user_feedback request, options = nil
420
+ raise ::ArgumentError, "request must be provided" if request.nil?
421
+
422
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::GetUserFeedbackRequest
423
+
424
+ # Converts hash and nil to an options object
425
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
426
+
427
+ # Customize the options with defaults
428
+ metadata = @config.rpcs.get_user_feedback.metadata.to_h
429
+
430
+ # Set x-goog-api-client and x-goog-user-project headers
431
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
432
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
433
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION
434
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
435
+
436
+ header_params = {
437
+ "name" => request.name
438
+ }
439
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
440
+ metadata[:"x-goog-request-params"] ||= request_params_header
441
+
442
+ options.apply_defaults timeout: @config.rpcs.get_user_feedback.timeout,
443
+ metadata: metadata,
444
+ retry_policy: @config.rpcs.get_user_feedback.retry_policy
445
+ options.apply_defaults metadata: @config.metadata,
446
+ retry_policy: @config.retry_policy
447
+
448
+ @question_service_stub.call_rpc :get_user_feedback, request, options: options do |response, operation|
449
+ yield response, operation if block_given?
450
+ return response
451
+ end
452
+ rescue ::GRPC::BadStatus => e
453
+ raise ::Google::Cloud::Error.from_error(e)
454
+ end
455
+
456
+ ##
457
+ # Updates user feedback. This creates user feedback if there was none before
458
+ # (upsert).
459
+ #
460
+ # @overload update_user_feedback(request, options = nil)
461
+ # Pass arguments to `update_user_feedback` via a request object, either of type
462
+ # {::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest} or an equivalent Hash.
463
+ #
464
+ # @param request [::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest, ::Hash]
465
+ # A request object representing the call parameters. Required. To specify no
466
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
467
+ # @param options [::Gapic::CallOptions, ::Hash]
468
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
469
+ #
470
+ # @overload update_user_feedback(user_feedback: nil, update_mask: nil)
471
+ # Pass arguments to `update_user_feedback` via keyword arguments. Note that at
472
+ # least one keyword argument is required. To specify no parameters, or to keep all
473
+ # the default parameter values, pass an empty Hash as a request object (see above).
474
+ #
475
+ # @param user_feedback [::Google::Cloud::DataQnA::V1alpha::UserFeedback, ::Hash]
476
+ # Required. The user feedback to update. This can be called even if there is no
477
+ # user feedback so far.
478
+ # The feedback's name field is used to identify the user feedback (and the
479
+ # corresponding question) to update.
480
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
481
+ # The list of fields to be updated.
482
+ #
483
+ # @yield [response, operation] Access the result along with the RPC operation
484
+ # @yieldparam response [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
485
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
486
+ #
487
+ # @return [::Google::Cloud::DataQnA::V1alpha::UserFeedback]
488
+ #
489
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
490
+ #
491
+ def update_user_feedback request, options = nil
492
+ raise ::ArgumentError, "request must be provided" if request.nil?
493
+
494
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DataQnA::V1alpha::UpdateUserFeedbackRequest
495
+
496
+ # Converts hash and nil to an options object
497
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
498
+
499
+ # Customize the options with defaults
500
+ metadata = @config.rpcs.update_user_feedback.metadata.to_h
501
+
502
+ # Set x-goog-api-client and x-goog-user-project headers
503
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
504
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
505
+ gapic_version: ::Google::Cloud::DataQnA::V1alpha::VERSION
506
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
507
+
508
+ header_params = {
509
+ "user_feedback.name" => request.user_feedback.name
510
+ }
511
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
512
+ metadata[:"x-goog-request-params"] ||= request_params_header
513
+
514
+ options.apply_defaults timeout: @config.rpcs.update_user_feedback.timeout,
515
+ metadata: metadata,
516
+ retry_policy: @config.rpcs.update_user_feedback.retry_policy
517
+ options.apply_defaults metadata: @config.metadata,
518
+ retry_policy: @config.retry_policy
519
+
520
+ @question_service_stub.call_rpc :update_user_feedback, request, options: options do |response, operation|
521
+ yield response, operation if block_given?
522
+ return response
523
+ end
524
+ rescue ::GRPC::BadStatus => e
525
+ raise ::Google::Cloud::Error.from_error(e)
526
+ end
527
+
528
+ ##
529
+ # Configuration class for the QuestionService API.
530
+ #
531
+ # This class represents the configuration for QuestionService,
532
+ # providing control over timeouts, retry behavior, logging, transport
533
+ # parameters, and other low-level controls. Certain parameters can also be
534
+ # applied individually to specific RPCs. See
535
+ # {::Google::Cloud::DataQnA::V1alpha::QuestionService::Client::Configuration::Rpcs}
536
+ # for a list of RPCs that can be configured independently.
537
+ #
538
+ # Configuration can be applied globally to all clients, or to a single client
539
+ # on construction.
540
+ #
541
+ # # Examples
542
+ #
543
+ # To modify the global config, setting the timeout for get_question
544
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
545
+ #
546
+ # ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.configure do |config|
547
+ # config.timeout = 10.0
548
+ # config.rpcs.get_question.timeout = 20.0
549
+ # end
550
+ #
551
+ # To apply the above configuration only to a new client:
552
+ #
553
+ # client = ::Google::Cloud::DataQnA::V1alpha::QuestionService::Client.new do |config|
554
+ # config.timeout = 10.0
555
+ # config.rpcs.get_question.timeout = 20.0
556
+ # end
557
+ #
558
+ # @!attribute [rw] endpoint
559
+ # The hostname or hostname:port of the service endpoint.
560
+ # Defaults to `"dataqna.googleapis.com"`.
561
+ # @return [::String]
562
+ # @!attribute [rw] credentials
563
+ # Credentials to send with calls. You may provide any of the following types:
564
+ # * (`String`) The path to a service account key file in JSON format
565
+ # * (`Hash`) A service account key as a Hash
566
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
567
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
568
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
569
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
570
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
571
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
572
+ # * (`nil`) indicating no credentials
573
+ # @return [::Object]
574
+ # @!attribute [rw] scope
575
+ # The OAuth scopes
576
+ # @return [::Array<::String>]
577
+ # @!attribute [rw] lib_name
578
+ # The library name as recorded in instrumentation and logging
579
+ # @return [::String]
580
+ # @!attribute [rw] lib_version
581
+ # The library version as recorded in instrumentation and logging
582
+ # @return [::String]
583
+ # @!attribute [rw] channel_args
584
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
585
+ # `GRPC::Core::Channel` object is provided as the credential.
586
+ # @return [::Hash]
587
+ # @!attribute [rw] interceptors
588
+ # An array of interceptors that are run before calls are executed.
589
+ # @return [::Array<::GRPC::ClientInterceptor>]
590
+ # @!attribute [rw] timeout
591
+ # The call timeout in seconds.
592
+ # @return [::Numeric]
593
+ # @!attribute [rw] metadata
594
+ # Additional gRPC headers to be sent with the call.
595
+ # @return [::Hash{::Symbol=>::String}]
596
+ # @!attribute [rw] retry_policy
597
+ # The retry policy. The value is a hash with the following keys:
598
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
599
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
600
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
601
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
602
+ # trigger a retry.
603
+ # @return [::Hash]
604
+ # @!attribute [rw] quota_project
605
+ # A separate project against which to charge quota.
606
+ # @return [::String]
607
+ #
608
+ class Configuration
609
+ extend ::Gapic::Config
610
+
611
+ config_attr :endpoint, "dataqna.googleapis.com", ::String
612
+ config_attr :credentials, nil do |value|
613
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
614
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
615
+ allowed.any? { |klass| klass === value }
616
+ end
617
+ config_attr :scope, nil, ::String, ::Array, nil
618
+ config_attr :lib_name, nil, ::String, nil
619
+ config_attr :lib_version, nil, ::String, nil
620
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
621
+ config_attr :interceptors, nil, ::Array, nil
622
+ config_attr :timeout, nil, ::Numeric, nil
623
+ config_attr :metadata, nil, ::Hash, nil
624
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
625
+ config_attr :quota_project, nil, ::String, nil
626
+
627
+ # @private
628
+ def initialize parent_config = nil
629
+ @parent_config = parent_config unless parent_config.nil?
630
+
631
+ yield self if block_given?
632
+ end
633
+
634
+ ##
635
+ # Configurations for individual RPCs
636
+ # @return [Rpcs]
637
+ #
638
+ def rpcs
639
+ @rpcs ||= begin
640
+ parent_rpcs = nil
641
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
642
+ Rpcs.new parent_rpcs
643
+ end
644
+ end
645
+
646
+ ##
647
+ # Configuration RPC class for the QuestionService API.
648
+ #
649
+ # Includes fields providing the configuration for each RPC in this service.
650
+ # Each configuration object is of type `Gapic::Config::Method` and includes
651
+ # the following configuration fields:
652
+ #
653
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
654
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
655
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
656
+ # include the following keys:
657
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
658
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
659
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
660
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
661
+ # trigger a retry.
662
+ #
663
+ class Rpcs
664
+ ##
665
+ # RPC-specific configuration for `get_question`
666
+ # @return [::Gapic::Config::Method]
667
+ #
668
+ attr_reader :get_question
669
+ ##
670
+ # RPC-specific configuration for `create_question`
671
+ # @return [::Gapic::Config::Method]
672
+ #
673
+ attr_reader :create_question
674
+ ##
675
+ # RPC-specific configuration for `execute_question`
676
+ # @return [::Gapic::Config::Method]
677
+ #
678
+ attr_reader :execute_question
679
+ ##
680
+ # RPC-specific configuration for `get_user_feedback`
681
+ # @return [::Gapic::Config::Method]
682
+ #
683
+ attr_reader :get_user_feedback
684
+ ##
685
+ # RPC-specific configuration for `update_user_feedback`
686
+ # @return [::Gapic::Config::Method]
687
+ #
688
+ attr_reader :update_user_feedback
689
+
690
+ # @private
691
+ def initialize parent_rpcs = nil
692
+ get_question_config = parent_rpcs&.get_question if parent_rpcs&.respond_to? :get_question
693
+ @get_question = ::Gapic::Config::Method.new get_question_config
694
+ create_question_config = parent_rpcs&.create_question if parent_rpcs&.respond_to? :create_question
695
+ @create_question = ::Gapic::Config::Method.new create_question_config
696
+ execute_question_config = parent_rpcs&.execute_question if parent_rpcs&.respond_to? :execute_question
697
+ @execute_question = ::Gapic::Config::Method.new execute_question_config
698
+ get_user_feedback_config = parent_rpcs&.get_user_feedback if parent_rpcs&.respond_to? :get_user_feedback
699
+ @get_user_feedback = ::Gapic::Config::Method.new get_user_feedback_config
700
+ update_user_feedback_config = parent_rpcs&.update_user_feedback if parent_rpcs&.respond_to? :update_user_feedback
701
+ @update_user_feedback = ::Gapic::Config::Method.new update_user_feedback_config
702
+
703
+ yield self if block_given?
704
+ end
705
+ end
706
+ end
707
+ end
708
+ end
709
+ end
710
+ end
711
+ end
712
+ end