google-cloud-retail-v2 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/retail/v2/analytics_service/client.rb +29 -2
  4. data/lib/google/cloud/retail/v2/analytics_service/operations.rb +12 -15
  5. data/lib/google/cloud/retail/v2/analytics_service/rest/client.rb +29 -2
  6. data/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb +43 -38
  7. data/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb +22 -8
  8. data/lib/google/cloud/retail/v2/catalog_service/client.rb +29 -12
  9. data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +29 -12
  10. data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +102 -68
  11. data/lib/google/cloud/retail/v2/completion_service/client.rb +31 -5
  12. data/lib/google/cloud/retail/v2/completion_service/operations.rb +12 -15
  13. data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +31 -5
  14. data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +43 -38
  15. data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +30 -14
  16. data/lib/google/cloud/retail/v2/completion_service_pb.rb +2 -1
  17. data/lib/google/cloud/retail/v2/control_service/client.rb +29 -6
  18. data/lib/google/cloud/retail/v2/control_service/rest/client.rb +29 -6
  19. data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +54 -32
  20. data/lib/google/cloud/retail/v2/generative_question_pb.rb +45 -0
  21. data/lib/google/cloud/retail/v2/generative_question_service/client.rb +853 -0
  22. data/lib/google/cloud/retail/v2/generative_question_service/credentials.rb +51 -0
  23. data/lib/google/cloud/retail/v2/generative_question_service/paths.rb +52 -0
  24. data/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb +792 -0
  25. data/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb +389 -0
  26. data/lib/google/cloud/retail/v2/generative_question_service/rest.rb +52 -0
  27. data/lib/google/cloud/retail/v2/generative_question_service.rb +55 -0
  28. data/lib/google/cloud/retail/v2/generative_question_service_pb.rb +57 -0
  29. data/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb +55 -0
  30. data/lib/google/cloud/retail/v2/model_service/client.rb +31 -9
  31. data/lib/google/cloud/retail/v2/model_service/operations.rb +12 -15
  32. data/lib/google/cloud/retail/v2/model_service/rest/client.rb +31 -9
  33. data/lib/google/cloud/retail/v2/model_service/rest/operations.rb +43 -38
  34. data/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +78 -50
  35. data/lib/google/cloud/retail/v2/prediction_service/client.rb +28 -2
  36. data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +28 -2
  37. data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +22 -8
  38. data/lib/google/cloud/retail/v2/product_service/client.rb +36 -13
  39. data/lib/google/cloud/retail/v2/product_service/operations.rb +12 -15
  40. data/lib/google/cloud/retail/v2/product_service/rest/client.rb +36 -13
  41. data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +43 -38
  42. data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +110 -74
  43. data/lib/google/cloud/retail/v2/rest.rb +1 -0
  44. data/lib/google/cloud/retail/v2/search_service/client.rb +35 -3
  45. data/lib/google/cloud/retail/v2/search_service/rest/client.rb +34 -3
  46. data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +22 -8
  47. data/lib/google/cloud/retail/v2/search_service_pb.rb +13 -2
  48. data/lib/google/cloud/retail/v2/serving_config_service/client.rb +29 -8
  49. data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +29 -8
  50. data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +70 -44
  51. data/lib/google/cloud/retail/v2/user_event_service/client.rb +31 -6
  52. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +12 -15
  53. data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +31 -6
  54. data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +43 -38
  55. data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +54 -32
  56. data/lib/google/cloud/retail/v2/version.rb +1 -1
  57. data/lib/google/cloud/retail/v2.rb +1 -0
  58. data/proto_docs/google/api/client.rb +39 -0
  59. data/proto_docs/google/cloud/retail/v2/common.rb +1 -1
  60. data/proto_docs/google/cloud/retail/v2/completion_service.rb +30 -2
  61. data/proto_docs/google/cloud/retail/v2/generative_question.rb +75 -0
  62. data/proto_docs/google/cloud/retail/v2/generative_question_service.rb +109 -0
  63. data/proto_docs/google/cloud/retail/v2/product.rb +9 -2
  64. data/proto_docs/google/cloud/retail/v2/search_service.rb +204 -0
  65. data/proto_docs/google/longrunning/operations.rb +19 -14
  66. metadata +17 -5
@@ -0,0 +1,792 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/retail/v2/generative_question_service_pb"
21
+ require "google/cloud/retail/v2/generative_question_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Retail
27
+ module V2
28
+ module GenerativeQuestionService
29
+ module Rest
30
+ ##
31
+ # REST client for the GenerativeQuestionService service.
32
+ #
33
+ # Service for managing LLM generated questions in search serving.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :generative_question_service_stub
46
+
47
+ ##
48
+ # Configure the GenerativeQuestionService Client class.
49
+ #
50
+ # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all GenerativeQuestionService clients
56
+ # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "Retail", "V2"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the GenerativeQuestionService Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # The effective universe domain
104
+ #
105
+ # @return [String]
106
+ #
107
+ def universe_domain
108
+ @generative_question_service_stub.universe_domain
109
+ end
110
+
111
+ ##
112
+ # Create a new GenerativeQuestionService REST client object.
113
+ #
114
+ # @example
115
+ #
116
+ # # Create a client using the default configuration
117
+ # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new
118
+ #
119
+ # # Create a client using a custom configuration
120
+ # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config|
121
+ # config.timeout = 10.0
122
+ # end
123
+ #
124
+ # @yield [config] Configure the GenerativeQuestionService client.
125
+ # @yieldparam config [Client::Configuration]
126
+ #
127
+ def initialize
128
+ # Create the configuration object
129
+ @config = Configuration.new Client.configure
130
+
131
+ # Yield the configuration if needed
132
+ yield @config if block_given?
133
+
134
+ # Create credentials
135
+ credentials = @config.credentials
136
+ # Use self-signed JWT if the endpoint is unchanged from default,
137
+ # but only if the default endpoint does not have a region prefix.
138
+ enable_self_signed_jwt = @config.endpoint.nil? ||
139
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
140
+ !@config.endpoint.split(".").first.include?("-"))
141
+ credentials ||= Credentials.default scope: @config.scope,
142
+ enable_self_signed_jwt: enable_self_signed_jwt
143
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
144
+ credentials = Credentials.new credentials, scope: @config.scope
145
+ end
146
+
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @generative_question_service_stub = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.new(
151
+ endpoint: @config.endpoint,
152
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
153
+ universe_domain: @config.universe_domain,
154
+ credentials: credentials,
155
+ logger: @config.logger
156
+ )
157
+
158
+ @generative_question_service_stub.logger(stub: true)&.info do |entry|
159
+ entry.set_system_name
160
+ entry.set_service
161
+ entry.message = "Created client for #{entry.service}"
162
+ entry.set_credentials_fields credentials
163
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
164
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
165
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
166
+ end
167
+
168
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
169
+ config.credentials = credentials
170
+ config.quota_project = @quota_project_id
171
+ config.endpoint = @generative_question_service_stub.endpoint
172
+ config.universe_domain = @generative_question_service_stub.universe_domain
173
+ config.logger = @generative_question_service_stub.logger if config.respond_to? :logger=
174
+ end
175
+ end
176
+
177
+ ##
178
+ # Get the associated client for mix-in of the Locations.
179
+ #
180
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
181
+ #
182
+ attr_reader :location_client
183
+
184
+ ##
185
+ # The logger used for request/response debug logging.
186
+ #
187
+ # @return [Logger]
188
+ #
189
+ def logger
190
+ @generative_question_service_stub.logger
191
+ end
192
+
193
+ # Service calls
194
+
195
+ ##
196
+ # Manages overal generative question feature state -- enables toggling
197
+ # feature on and off.
198
+ #
199
+ # @overload update_generative_questions_feature_config(request, options = nil)
200
+ # Pass arguments to `update_generative_questions_feature_config` via a request object, either of type
201
+ # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash.
202
+ #
203
+ # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Hash]
204
+ # A request object representing the call parameters. Required. To specify no
205
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
206
+ # @param options [::Gapic::CallOptions, ::Hash]
207
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
208
+ #
209
+ # @overload update_generative_questions_feature_config(generative_questions_feature_config: nil, update_mask: nil)
210
+ # Pass arguments to `update_generative_questions_feature_config` via keyword arguments. Note that at
211
+ # least one keyword argument is required. To specify no parameters, or to keep all
212
+ # the default parameter values, pass an empty Hash as a request object (see above).
213
+ #
214
+ # @param generative_questions_feature_config [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig, ::Hash]
215
+ # Required. The configuration managing the feature state.
216
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
217
+ # Optional. Indicates which fields in the provided
218
+ # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig}
219
+ # to update. If not set or empty, all supported fields are updated.
220
+ # @yield [result, operation] Access the result along with the TransportOperation object
221
+ # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig]
222
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
223
+ #
224
+ # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig]
225
+ #
226
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
227
+ #
228
+ # @example Basic example
229
+ # require "google/cloud/retail/v2"
230
+ #
231
+ # # Create a client object. The client can be reused for multiple calls.
232
+ # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new
233
+ #
234
+ # # Create a request. To set request fields, pass in keyword arguments.
235
+ # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new
236
+ #
237
+ # # Call the update_generative_questions_feature_config method.
238
+ # result = client.update_generative_questions_feature_config request
239
+ #
240
+ # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.
241
+ # p result
242
+ #
243
+ def update_generative_questions_feature_config request, options = nil
244
+ raise ::ArgumentError, "request must be provided" if request.nil?
245
+
246
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest
247
+
248
+ # Converts hash and nil to an options object
249
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
250
+
251
+ # Customize the options with defaults
252
+ call_metadata = @config.rpcs.update_generative_questions_feature_config.metadata.to_h
253
+
254
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
255
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
256
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
257
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
258
+ transports_version_send: [:rest]
259
+
260
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
261
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
262
+
263
+ options.apply_defaults timeout: @config.rpcs.update_generative_questions_feature_config.timeout,
264
+ metadata: call_metadata,
265
+ retry_policy: @config.rpcs.update_generative_questions_feature_config.retry_policy
266
+
267
+ options.apply_defaults timeout: @config.timeout,
268
+ metadata: @config.metadata,
269
+ retry_policy: @config.retry_policy
270
+
271
+ @generative_question_service_stub.update_generative_questions_feature_config request, options do |result, operation|
272
+ yield result, operation if block_given?
273
+ end
274
+ rescue ::Gapic::Rest::Error => e
275
+ raise ::Google::Cloud::Error.from_error(e)
276
+ end
277
+
278
+ ##
279
+ # Manages overal generative question feature state -- enables toggling
280
+ # feature on and off.
281
+ #
282
+ # @overload get_generative_questions_feature_config(request, options = nil)
283
+ # Pass arguments to `get_generative_questions_feature_config` via a request object, either of type
284
+ # {::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash.
285
+ #
286
+ # @param request [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Hash]
287
+ # A request object representing the call parameters. Required. To specify no
288
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
289
+ # @param options [::Gapic::CallOptions, ::Hash]
290
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
291
+ #
292
+ # @overload get_generative_questions_feature_config(catalog: nil)
293
+ # Pass arguments to `get_generative_questions_feature_config` via keyword arguments. Note that at
294
+ # least one keyword argument is required. To specify no parameters, or to keep all
295
+ # the default parameter values, pass an empty Hash as a request object (see above).
296
+ #
297
+ # @param catalog [::String]
298
+ # Required. Resource name of the parent catalog.
299
+ # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog}
300
+ # @yield [result, operation] Access the result along with the TransportOperation object
301
+ # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig]
302
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
303
+ #
304
+ # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig]
305
+ #
306
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
307
+ #
308
+ # @example Basic example
309
+ # require "google/cloud/retail/v2"
310
+ #
311
+ # # Create a client object. The client can be reused for multiple calls.
312
+ # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new
313
+ #
314
+ # # Create a request. To set request fields, pass in keyword arguments.
315
+ # request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new
316
+ #
317
+ # # Call the get_generative_questions_feature_config method.
318
+ # result = client.get_generative_questions_feature_config request
319
+ #
320
+ # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.
321
+ # p result
322
+ #
323
+ def get_generative_questions_feature_config request, options = nil
324
+ raise ::ArgumentError, "request must be provided" if request.nil?
325
+
326
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest
327
+
328
+ # Converts hash and nil to an options object
329
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
330
+
331
+ # Customize the options with defaults
332
+ call_metadata = @config.rpcs.get_generative_questions_feature_config.metadata.to_h
333
+
334
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
335
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
336
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
337
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
338
+ transports_version_send: [:rest]
339
+
340
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
341
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
342
+
343
+ options.apply_defaults timeout: @config.rpcs.get_generative_questions_feature_config.timeout,
344
+ metadata: call_metadata,
345
+ retry_policy: @config.rpcs.get_generative_questions_feature_config.retry_policy
346
+
347
+ options.apply_defaults timeout: @config.timeout,
348
+ metadata: @config.metadata,
349
+ retry_policy: @config.retry_policy
350
+
351
+ @generative_question_service_stub.get_generative_questions_feature_config request, options do |result, operation|
352
+ yield result, operation if block_given?
353
+ end
354
+ rescue ::Gapic::Rest::Error => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Returns all questions for a given catalog.
360
+ #
361
+ # @overload list_generative_question_configs(request, options = nil)
362
+ # Pass arguments to `list_generative_question_configs` via a request object, either of type
363
+ # {::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest} or an equivalent Hash.
364
+ #
365
+ # @param request [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Hash]
366
+ # A request object representing the call parameters. Required. To specify no
367
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
368
+ # @param options [::Gapic::CallOptions, ::Hash]
369
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
370
+ #
371
+ # @overload list_generative_question_configs(parent: nil)
372
+ # Pass arguments to `list_generative_question_configs` via keyword arguments. Note that at
373
+ # least one keyword argument is required. To specify no parameters, or to keep all
374
+ # the default parameter values, pass an empty Hash as a request object (see above).
375
+ #
376
+ # @param parent [::String]
377
+ # Required. Resource name of the parent catalog.
378
+ # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog}
379
+ # @yield [result, operation] Access the result along with the TransportOperation object
380
+ # @yieldparam result [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse]
381
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
382
+ #
383
+ # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse]
384
+ #
385
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
386
+ #
387
+ # @example Basic example
388
+ # require "google/cloud/retail/v2"
389
+ #
390
+ # # Create a client object. The client can be reused for multiple calls.
391
+ # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new
392
+ #
393
+ # # Create a request. To set request fields, pass in keyword arguments.
394
+ # request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new
395
+ #
396
+ # # Call the list_generative_question_configs method.
397
+ # result = client.list_generative_question_configs request
398
+ #
399
+ # # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.
400
+ # p result
401
+ #
402
+ def list_generative_question_configs request, options = nil
403
+ raise ::ArgumentError, "request must be provided" if request.nil?
404
+
405
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest
406
+
407
+ # Converts hash and nil to an options object
408
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
409
+
410
+ # Customize the options with defaults
411
+ call_metadata = @config.rpcs.list_generative_question_configs.metadata.to_h
412
+
413
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
414
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
415
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
416
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
417
+ transports_version_send: [:rest]
418
+
419
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
420
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
421
+
422
+ options.apply_defaults timeout: @config.rpcs.list_generative_question_configs.timeout,
423
+ metadata: call_metadata,
424
+ retry_policy: @config.rpcs.list_generative_question_configs.retry_policy
425
+
426
+ options.apply_defaults timeout: @config.timeout,
427
+ metadata: @config.metadata,
428
+ retry_policy: @config.retry_policy
429
+
430
+ @generative_question_service_stub.list_generative_question_configs request, options do |result, operation|
431
+ yield result, operation if block_given?
432
+ end
433
+ rescue ::Gapic::Rest::Error => e
434
+ raise ::Google::Cloud::Error.from_error(e)
435
+ end
436
+
437
+ ##
438
+ # Allows management of individual questions.
439
+ #
440
+ # @overload update_generative_question_config(request, options = nil)
441
+ # Pass arguments to `update_generative_question_config` via a request object, either of type
442
+ # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest} or an equivalent Hash.
443
+ #
444
+ # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash]
445
+ # A request object representing the call parameters. Required. To specify no
446
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
447
+ # @param options [::Gapic::CallOptions, ::Hash]
448
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
449
+ #
450
+ # @overload update_generative_question_config(generative_question_config: nil, update_mask: nil)
451
+ # Pass arguments to `update_generative_question_config` via keyword arguments. Note that at
452
+ # least one keyword argument is required. To specify no parameters, or to keep all
453
+ # the default parameter values, pass an empty Hash as a request object (see above).
454
+ #
455
+ # @param generative_question_config [::Google::Cloud::Retail::V2::GenerativeQuestionConfig, ::Hash]
456
+ # Required. The question to update.
457
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
458
+ # Optional. Indicates which fields in the provided
459
+ # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig}
460
+ # to update. The following are NOT supported:
461
+ #
462
+ # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency}
463
+ #
464
+ # If not set or empty, all supported fields are updated.
465
+ # @yield [result, operation] Access the result along with the TransportOperation object
466
+ # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionConfig]
467
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
468
+ #
469
+ # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig]
470
+ #
471
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
472
+ #
473
+ # @example Basic example
474
+ # require "google/cloud/retail/v2"
475
+ #
476
+ # # Create a client object. The client can be reused for multiple calls.
477
+ # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new
478
+ #
479
+ # # Create a request. To set request fields, pass in keyword arguments.
480
+ # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new
481
+ #
482
+ # # Call the update_generative_question_config method.
483
+ # result = client.update_generative_question_config request
484
+ #
485
+ # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig.
486
+ # p result
487
+ #
488
+ def update_generative_question_config request, options = nil
489
+ raise ::ArgumentError, "request must be provided" if request.nil?
490
+
491
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest
492
+
493
+ # Converts hash and nil to an options object
494
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
495
+
496
+ # Customize the options with defaults
497
+ call_metadata = @config.rpcs.update_generative_question_config.metadata.to_h
498
+
499
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
500
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
501
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
502
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
503
+ transports_version_send: [:rest]
504
+
505
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
506
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
507
+
508
+ options.apply_defaults timeout: @config.rpcs.update_generative_question_config.timeout,
509
+ metadata: call_metadata,
510
+ retry_policy: @config.rpcs.update_generative_question_config.retry_policy
511
+
512
+ options.apply_defaults timeout: @config.timeout,
513
+ metadata: @config.metadata,
514
+ retry_policy: @config.retry_policy
515
+
516
+ @generative_question_service_stub.update_generative_question_config request, options do |result, operation|
517
+ yield result, operation if block_given?
518
+ end
519
+ rescue ::Gapic::Rest::Error => e
520
+ raise ::Google::Cloud::Error.from_error(e)
521
+ end
522
+
523
+ ##
524
+ # Allows management of multiple questions.
525
+ #
526
+ # @overload batch_update_generative_question_configs(request, options = nil)
527
+ # Pass arguments to `batch_update_generative_question_configs` via a request object, either of type
528
+ # {::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest} or an equivalent Hash.
529
+ #
530
+ # @param request [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Hash]
531
+ # A request object representing the call parameters. Required. To specify no
532
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
533
+ # @param options [::Gapic::CallOptions, ::Hash]
534
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
535
+ #
536
+ # @overload batch_update_generative_question_configs(parent: nil, requests: nil)
537
+ # Pass arguments to `batch_update_generative_question_configs` via keyword arguments. Note that at
538
+ # least one keyword argument is required. To specify no parameters, or to keep all
539
+ # the default parameter values, pass an empty Hash as a request object (see above).
540
+ #
541
+ # @param parent [::String]
542
+ # Optional. Resource name of the parent catalog.
543
+ # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog}
544
+ # @param requests [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash>]
545
+ # Required. The updates question configs.
546
+ # @yield [result, operation] Access the result along with the TransportOperation object
547
+ # @yieldparam result [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse]
548
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
549
+ #
550
+ # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse]
551
+ #
552
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
553
+ #
554
+ # @example Basic example
555
+ # require "google/cloud/retail/v2"
556
+ #
557
+ # # Create a client object. The client can be reused for multiple calls.
558
+ # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new
559
+ #
560
+ # # Create a request. To set request fields, pass in keyword arguments.
561
+ # request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new
562
+ #
563
+ # # Call the batch_update_generative_question_configs method.
564
+ # result = client.batch_update_generative_question_configs request
565
+ #
566
+ # # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.
567
+ # p result
568
+ #
569
+ def batch_update_generative_question_configs request, options = nil
570
+ raise ::ArgumentError, "request must be provided" if request.nil?
571
+
572
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest
573
+
574
+ # Converts hash and nil to an options object
575
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
576
+
577
+ # Customize the options with defaults
578
+ call_metadata = @config.rpcs.batch_update_generative_question_configs.metadata.to_h
579
+
580
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
581
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
582
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
583
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION,
584
+ transports_version_send: [:rest]
585
+
586
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
587
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
588
+
589
+ options.apply_defaults timeout: @config.rpcs.batch_update_generative_question_configs.timeout,
590
+ metadata: call_metadata,
591
+ retry_policy: @config.rpcs.batch_update_generative_question_configs.retry_policy
592
+
593
+ options.apply_defaults timeout: @config.timeout,
594
+ metadata: @config.metadata,
595
+ retry_policy: @config.retry_policy
596
+
597
+ @generative_question_service_stub.batch_update_generative_question_configs request, options do |result, operation|
598
+ yield result, operation if block_given?
599
+ end
600
+ rescue ::Gapic::Rest::Error => e
601
+ raise ::Google::Cloud::Error.from_error(e)
602
+ end
603
+
604
+ ##
605
+ # Configuration class for the GenerativeQuestionService REST API.
606
+ #
607
+ # This class represents the configuration for GenerativeQuestionService REST,
608
+ # providing control over timeouts, retry behavior, logging, transport
609
+ # parameters, and other low-level controls. Certain parameters can also be
610
+ # applied individually to specific RPCs. See
611
+ # {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration::Rpcs}
612
+ # for a list of RPCs that can be configured independently.
613
+ #
614
+ # Configuration can be applied globally to all clients, or to a single client
615
+ # on construction.
616
+ #
617
+ # @example
618
+ #
619
+ # # Modify the global config, setting the timeout for
620
+ # # update_generative_questions_feature_config to 20 seconds,
621
+ # # and all remaining timeouts to 10 seconds.
622
+ # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.configure do |config|
623
+ # config.timeout = 10.0
624
+ # config.rpcs.update_generative_questions_feature_config.timeout = 20.0
625
+ # end
626
+ #
627
+ # # Apply the above configuration only to a new client.
628
+ # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config|
629
+ # config.timeout = 10.0
630
+ # config.rpcs.update_generative_questions_feature_config.timeout = 20.0
631
+ # end
632
+ #
633
+ # @!attribute [rw] endpoint
634
+ # A custom service endpoint, as a hostname or hostname:port. The default is
635
+ # nil, indicating to use the default endpoint in the current universe domain.
636
+ # @return [::String,nil]
637
+ # @!attribute [rw] credentials
638
+ # Credentials to send with calls. You may provide any of the following types:
639
+ # * (`String`) The path to a service account key file in JSON format
640
+ # * (`Hash`) A service account key as a Hash
641
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
642
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
643
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
644
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
645
+ # * (`nil`) indicating no credentials
646
+ # @return [::Object]
647
+ # @!attribute [rw] scope
648
+ # The OAuth scopes
649
+ # @return [::Array<::String>]
650
+ # @!attribute [rw] lib_name
651
+ # The library name as recorded in instrumentation and logging
652
+ # @return [::String]
653
+ # @!attribute [rw] lib_version
654
+ # The library version as recorded in instrumentation and logging
655
+ # @return [::String]
656
+ # @!attribute [rw] timeout
657
+ # The call timeout in seconds.
658
+ # @return [::Numeric]
659
+ # @!attribute [rw] metadata
660
+ # Additional headers to be sent with the call.
661
+ # @return [::Hash{::Symbol=>::String}]
662
+ # @!attribute [rw] retry_policy
663
+ # The retry policy. The value is a hash with the following keys:
664
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
665
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
666
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
667
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
668
+ # trigger a retry.
669
+ # @return [::Hash]
670
+ # @!attribute [rw] quota_project
671
+ # A separate project against which to charge quota.
672
+ # @return [::String]
673
+ # @!attribute [rw] universe_domain
674
+ # The universe domain within which to make requests. This determines the
675
+ # default endpoint URL. The default value of nil uses the environment
676
+ # universe (usually the default "googleapis.com" universe).
677
+ # @return [::String,nil]
678
+ # @!attribute [rw] logger
679
+ # A custom logger to use for request/response debug logging, or the value
680
+ # `:default` (the default) to construct a default logger, or `nil` to
681
+ # explicitly disable logging.
682
+ # @return [::Logger,:default,nil]
683
+ #
684
+ class Configuration
685
+ extend ::Gapic::Config
686
+
687
+ # @private
688
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
689
+ DEFAULT_ENDPOINT = "retail.googleapis.com"
690
+
691
+ config_attr :endpoint, nil, ::String, nil
692
+ config_attr :credentials, nil do |value|
693
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
694
+ allowed.any? { |klass| klass === value }
695
+ end
696
+ config_attr :scope, nil, ::String, ::Array, nil
697
+ config_attr :lib_name, nil, ::String, nil
698
+ config_attr :lib_version, nil, ::String, nil
699
+ config_attr :timeout, nil, ::Numeric, nil
700
+ config_attr :metadata, nil, ::Hash, nil
701
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
702
+ config_attr :quota_project, nil, ::String, nil
703
+ config_attr :universe_domain, nil, ::String, nil
704
+ config_attr :logger, :default, ::Logger, nil, :default
705
+
706
+ # @private
707
+ def initialize parent_config = nil
708
+ @parent_config = parent_config unless parent_config.nil?
709
+
710
+ yield self if block_given?
711
+ end
712
+
713
+ ##
714
+ # Configurations for individual RPCs
715
+ # @return [Rpcs]
716
+ #
717
+ def rpcs
718
+ @rpcs ||= begin
719
+ parent_rpcs = nil
720
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
721
+ Rpcs.new parent_rpcs
722
+ end
723
+ end
724
+
725
+ ##
726
+ # Configuration RPC class for the GenerativeQuestionService API.
727
+ #
728
+ # Includes fields providing the configuration for each RPC in this service.
729
+ # Each configuration object is of type `Gapic::Config::Method` and includes
730
+ # the following configuration fields:
731
+ #
732
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
733
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
734
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
735
+ # include the following keys:
736
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
737
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
738
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
739
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
740
+ # trigger a retry.
741
+ #
742
+ class Rpcs
743
+ ##
744
+ # RPC-specific configuration for `update_generative_questions_feature_config`
745
+ # @return [::Gapic::Config::Method]
746
+ #
747
+ attr_reader :update_generative_questions_feature_config
748
+ ##
749
+ # RPC-specific configuration for `get_generative_questions_feature_config`
750
+ # @return [::Gapic::Config::Method]
751
+ #
752
+ attr_reader :get_generative_questions_feature_config
753
+ ##
754
+ # RPC-specific configuration for `list_generative_question_configs`
755
+ # @return [::Gapic::Config::Method]
756
+ #
757
+ attr_reader :list_generative_question_configs
758
+ ##
759
+ # RPC-specific configuration for `update_generative_question_config`
760
+ # @return [::Gapic::Config::Method]
761
+ #
762
+ attr_reader :update_generative_question_config
763
+ ##
764
+ # RPC-specific configuration for `batch_update_generative_question_configs`
765
+ # @return [::Gapic::Config::Method]
766
+ #
767
+ attr_reader :batch_update_generative_question_configs
768
+
769
+ # @private
770
+ def initialize parent_rpcs = nil
771
+ update_generative_questions_feature_config_config = parent_rpcs.update_generative_questions_feature_config if parent_rpcs.respond_to? :update_generative_questions_feature_config
772
+ @update_generative_questions_feature_config = ::Gapic::Config::Method.new update_generative_questions_feature_config_config
773
+ get_generative_questions_feature_config_config = parent_rpcs.get_generative_questions_feature_config if parent_rpcs.respond_to? :get_generative_questions_feature_config
774
+ @get_generative_questions_feature_config = ::Gapic::Config::Method.new get_generative_questions_feature_config_config
775
+ list_generative_question_configs_config = parent_rpcs.list_generative_question_configs if parent_rpcs.respond_to? :list_generative_question_configs
776
+ @list_generative_question_configs = ::Gapic::Config::Method.new list_generative_question_configs_config
777
+ update_generative_question_config_config = parent_rpcs.update_generative_question_config if parent_rpcs.respond_to? :update_generative_question_config
778
+ @update_generative_question_config = ::Gapic::Config::Method.new update_generative_question_config_config
779
+ batch_update_generative_question_configs_config = parent_rpcs.batch_update_generative_question_configs if parent_rpcs.respond_to? :batch_update_generative_question_configs
780
+ @batch_update_generative_question_configs = ::Gapic::Config::Method.new batch_update_generative_question_configs_config
781
+
782
+ yield self if block_given?
783
+ end
784
+ end
785
+ end
786
+ end
787
+ end
788
+ end
789
+ end
790
+ end
791
+ end
792
+ end