google-cloud-retail-v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) 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 +75 -0
  6. data/lib/google-cloud-retail-v2.rb +21 -0
  7. data/lib/google/cloud/retail/v2.rb +41 -0
  8. data/lib/google/cloud/retail/v2/catalog_pb.rb +32 -0
  9. data/lib/google/cloud/retail/v2/catalog_service.rb +49 -0
  10. data/lib/google/cloud/retail/v2/catalog_service/client.rb +490 -0
  11. data/lib/google/cloud/retail/v2/catalog_service/credentials.rb +51 -0
  12. data/lib/google/cloud/retail/v2/catalog_service/paths.rb +69 -0
  13. data/lib/google/cloud/retail/v2/catalog_service_pb.rb +42 -0
  14. data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +48 -0
  15. data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
  16. data/lib/google/cloud/retail/v2/import_config_pb.rb +104 -0
  17. data/lib/google/cloud/retail/v2/prediction_service.rb +49 -0
  18. data/lib/google/cloud/retail/v2/prediction_service/client.rb +472 -0
  19. data/lib/google/cloud/retail/v2/prediction_service/credentials.rb +51 -0
  20. data/lib/google/cloud/retail/v2/prediction_service/paths.rb +56 -0
  21. data/lib/google/cloud/retail/v2/prediction_service_pb.rb +46 -0
  22. data/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +45 -0
  23. data/lib/google/cloud/retail/v2/product_pb.rb +58 -0
  24. data/lib/google/cloud/retail/v2/product_service.rb +51 -0
  25. data/lib/google/cloud/retail/v2/product_service/client.rb +752 -0
  26. data/lib/google/cloud/retail/v2/product_service/credentials.rb +51 -0
  27. data/lib/google/cloud/retail/v2/product_service/operations.rb +570 -0
  28. data/lib/google/cloud/retail/v2/product_service/paths.rb +77 -0
  29. data/lib/google/cloud/retail/v2/product_service_pb.rb +47 -0
  30. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +60 -0
  31. data/lib/google/cloud/retail/v2/purge_config_pb.rb +33 -0
  32. data/lib/google/cloud/retail/v2/user_event_pb.rb +55 -0
  33. data/lib/google/cloud/retail/v2/user_event_service.rb +50 -0
  34. data/lib/google/cloud/retail/v2/user_event_service/client.rb +760 -0
  35. data/lib/google/cloud/retail/v2/user_event_service/credentials.rb +51 -0
  36. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +570 -0
  37. data/lib/google/cloud/retail/v2/user_event_service/paths.rb +56 -0
  38. data/lib/google/cloud/retail/v2/user_event_service_pb.rb +56 -0
  39. data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +72 -0
  40. data/lib/google/cloud/retail/v2/version.rb +28 -0
  41. data/proto_docs/README.md +4 -0
  42. data/proto_docs/google/api/field_behavior.rb +59 -0
  43. data/proto_docs/google/api/httpbody.rb +75 -0
  44. data/proto_docs/google/api/resource.rb +283 -0
  45. data/proto_docs/google/cloud/retail/v2/catalog.rb +101 -0
  46. data/proto_docs/google/cloud/retail/v2/catalog_service.rb +106 -0
  47. data/proto_docs/google/cloud/retail/v2/common.rb +169 -0
  48. data/proto_docs/google/cloud/retail/v2/import_config.rb +270 -0
  49. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +205 -0
  50. data/proto_docs/google/cloud/retail/v2/product.rb +278 -0
  51. data/proto_docs/google/cloud/retail/v2/product_service.rb +117 -0
  52. data/proto_docs/google/cloud/retail/v2/purge_config.rb +85 -0
  53. data/proto_docs/google/cloud/retail/v2/user_event.rb +238 -0
  54. data/proto_docs/google/cloud/retail/v2/user_event_service.rb +114 -0
  55. data/proto_docs/google/longrunning/operations.rb +150 -0
  56. data/proto_docs/google/protobuf/any.rb +138 -0
  57. data/proto_docs/google/protobuf/empty.rb +36 -0
  58. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  59. data/proto_docs/google/protobuf/struct.rb +96 -0
  60. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  61. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  62. data/proto_docs/google/rpc/status.rb +46 -0
  63. metadata +245 -0
@@ -0,0 +1,21 @@
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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/retail/v2"
@@ -0,0 +1,41 @@
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/retail/v2/catalog_service"
20
+ require "google/cloud/retail/v2/prediction_service"
21
+ require "google/cloud/retail/v2/product_service"
22
+ require "google/cloud/retail/v2/user_event_service"
23
+ require "google/cloud/retail/v2/version"
24
+
25
+ module Google
26
+ module Cloud
27
+ module Retail
28
+ ##
29
+ # To load this package, including all its services, and instantiate a client:
30
+ #
31
+ # require "google/cloud/retail/v2"
32
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
33
+ #
34
+ module V2
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ helper_path = ::File.join __dir__, "v2", "_helpers.rb"
41
+ require "google/cloud/retail/v2/_helpers" if ::File.file? helper_path
@@ -0,0 +1,32 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/retail/v2/catalog.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/field_behavior_pb'
8
+ require 'google/api/resource_pb'
9
+ Google::Protobuf::DescriptorPool.generated_pool.build do
10
+ add_file("google/cloud/retail/v2/catalog.proto", :syntax => :proto3) do
11
+ add_message "google.cloud.retail.v2.ProductLevelConfig" do
12
+ optional :ingestion_product_type, :string, 1
13
+ optional :merchant_center_product_id_field, :string, 2
14
+ end
15
+ add_message "google.cloud.retail.v2.Catalog" do
16
+ optional :name, :string, 1
17
+ optional :display_name, :string, 2
18
+ optional :product_level_config, :message, 4, "google.cloud.retail.v2.ProductLevelConfig"
19
+ end
20
+ end
21
+ end
22
+
23
+ module Google
24
+ module Cloud
25
+ module Retail
26
+ module V2
27
+ ProductLevelConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductLevelConfig").msgclass
28
+ Catalog = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Catalog").msgclass
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,49 @@
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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/retail/v2/version"
24
+
25
+ require "google/cloud/retail/v2/catalog_service/credentials"
26
+ require "google/cloud/retail/v2/catalog_service/paths"
27
+ require "google/cloud/retail/v2/catalog_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Retail
32
+ module V2
33
+ ##
34
+ # Service for managing catalog configuration.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/retail/v2/catalog_service"
39
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
40
+ #
41
+ module CatalogService
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "catalog_service", "helpers.rb"
49
+ require "google/cloud/retail/v2/catalog_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,490 @@
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/retail/v2/catalog_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Retail
25
+ module V2
26
+ module CatalogService
27
+ ##
28
+ # Client for the CatalogService service.
29
+ #
30
+ # Service for managing catalog configuration.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :catalog_service_stub
37
+
38
+ ##
39
+ # Configure the CatalogService Client class.
40
+ #
41
+ # See {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all CatalogService clients:
47
+ #
48
+ # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Retail", "V2"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const&.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.timeout = 60.0
69
+ default_config.retry_policy = {
70
+ initial_delay: 0.1,
71
+ max_delay: 60.0,
72
+ multiplier: 1.3,
73
+ retry_codes: [14, 4]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the CatalogService 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::CatalogService::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
+ # Create a new CatalogService client object.
104
+ #
105
+ # ## Examples
106
+ #
107
+ # To create a new CatalogService client with the default
108
+ # configuration:
109
+ #
110
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
111
+ #
112
+ # To create a new CatalogService client with a custom
113
+ # configuration:
114
+ #
115
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config|
116
+ # config.timeout = 10.0
117
+ # end
118
+ #
119
+ # @yield [config] Configure the CatalogService client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ def initialize
123
+ # These require statements are intentionally placed here to initialize
124
+ # the gRPC module only when it's required.
125
+ # See https://github.com/googleapis/toolkit/issues/446
126
+ require "gapic/grpc"
127
+ require "google/cloud/retail/v2/catalog_service_services_pb"
128
+
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ credentials ||= Credentials.default scope: @config.scope
138
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
139
+ credentials = Credentials.new credentials, scope: @config.scope
140
+ end
141
+ @quota_project_id = @config.quota_project
142
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
143
+
144
+ @catalog_service_stub = ::Gapic::ServiceStub.new(
145
+ ::Google::Cloud::Retail::V2::CatalogService::Stub,
146
+ credentials: credentials,
147
+ endpoint: @config.endpoint,
148
+ channel_args: @config.channel_args,
149
+ interceptors: @config.interceptors
150
+ )
151
+ end
152
+
153
+ # Service calls
154
+
155
+ ##
156
+ # Lists all the {::Google::Cloud::Retail::V2::Catalog Catalog}s associated with
157
+ # the project.
158
+ #
159
+ # @overload list_catalogs(request, options = nil)
160
+ # Pass arguments to `list_catalogs` via a request object, either of type
161
+ # {::Google::Cloud::Retail::V2::ListCatalogsRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
168
+ #
169
+ # @overload list_catalogs(parent: nil, page_size: nil, page_token: nil)
170
+ # Pass arguments to `list_catalogs` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param parent [::String]
175
+ # Required. The account resource name with an associated location.
176
+ #
177
+ # If the caller does not have permission to list
178
+ # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless
179
+ # of whether or not this location exists, a PERMISSION_DENIED error is
180
+ # returned.
181
+ # @param page_size [::Integer]
182
+ # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If
183
+ # unspecified, defaults to 50. The maximum allowed value is 1000. Values
184
+ # above 1000 will be coerced to 1000.
185
+ #
186
+ # If this field is negative, an INVALID_ARGUMENT is returned.
187
+ # @param page_token [::String]
188
+ # A page token
189
+ # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token},
190
+ # received from a previous
191
+ # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs}
192
+ # call. Provide this to retrieve the subsequent page.
193
+ #
194
+ # When paginating, all other parameters provided to
195
+ # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs}
196
+ # must match the call that provided the page token. Otherwise, an
197
+ # INVALID_ARGUMENT error is returned.
198
+ #
199
+ # @yield [response, operation] Access the result along with the RPC operation
200
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>]
201
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
202
+ #
203
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>]
204
+ #
205
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
206
+ #
207
+ def list_catalogs request, options = nil
208
+ raise ::ArgumentError, "request must be provided" if request.nil?
209
+
210
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListCatalogsRequest
211
+
212
+ # Converts hash and nil to an options object
213
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
214
+
215
+ # Customize the options with defaults
216
+ metadata = @config.rpcs.list_catalogs.metadata.to_h
217
+
218
+ # Set x-goog-api-client and x-goog-user-project headers
219
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
220
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
221
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
222
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
223
+
224
+ header_params = {
225
+ "parent" => request.parent
226
+ }
227
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
228
+ metadata[:"x-goog-request-params"] ||= request_params_header
229
+
230
+ options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout,
231
+ metadata: metadata,
232
+ retry_policy: @config.rpcs.list_catalogs.retry_policy
233
+ options.apply_defaults metadata: @config.metadata,
234
+ retry_policy: @config.retry_policy
235
+
236
+ @catalog_service_stub.call_rpc :list_catalogs, request, options: options do |response, operation|
237
+ response = ::Gapic::PagedEnumerable.new @catalog_service_stub, :list_catalogs, request, response, operation, options
238
+ yield response, operation if block_given?
239
+ return response
240
+ end
241
+ rescue ::GRPC::BadStatus => e
242
+ raise ::Google::Cloud::Error.from_error(e)
243
+ end
244
+
245
+ ##
246
+ # Updates the {::Google::Cloud::Retail::V2::Catalog Catalog}s.
247
+ #
248
+ # @overload update_catalog(request, options = nil)
249
+ # Pass arguments to `update_catalog` via a request object, either of type
250
+ # {::Google::Cloud::Retail::V2::UpdateCatalogRequest} or an equivalent Hash.
251
+ #
252
+ # @param request [::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Hash]
253
+ # A request object representing the call parameters. Required. To specify no
254
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
255
+ # @param options [::Gapic::CallOptions, ::Hash]
256
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
257
+ #
258
+ # @overload update_catalog(catalog: nil, update_mask: nil)
259
+ # Pass arguments to `update_catalog` via keyword arguments. Note that at
260
+ # least one keyword argument is required. To specify no parameters, or to keep all
261
+ # the default parameter values, pass an empty Hash as a request object (see above).
262
+ #
263
+ # @param catalog [::Google::Cloud::Retail::V2::Catalog, ::Hash]
264
+ # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
265
+ #
266
+ # If the caller does not have permission to update the
267
+ # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it
268
+ # exists, a PERMISSION_DENIED error is returned.
269
+ #
270
+ # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist,
271
+ # a NOT_FOUND error is returned.
272
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
273
+ # Indicates which fields in the provided
274
+ # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. If not set, will only
275
+ # update the
276
+ # {::Google::Cloud::Retail::V2::Catalog#product_level_config Catalog.product_level_config}
277
+ # field, which is also the only currently supported field to update.
278
+ #
279
+ # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
280
+ # is returned.
281
+ #
282
+ # @yield [response, operation] Access the result along with the RPC operation
283
+ # @yieldparam response [::Google::Cloud::Retail::V2::Catalog]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
285
+ #
286
+ # @return [::Google::Cloud::Retail::V2::Catalog]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
+ #
290
+ def update_catalog request, options = nil
291
+ raise ::ArgumentError, "request must be provided" if request.nil?
292
+
293
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCatalogRequest
294
+
295
+ # Converts hash and nil to an options object
296
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
297
+
298
+ # Customize the options with defaults
299
+ metadata = @config.rpcs.update_catalog.metadata.to_h
300
+
301
+ # Set x-goog-api-client and x-goog-user-project headers
302
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
303
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
304
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
305
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
+
307
+ header_params = {
308
+ "catalog.name" => request.catalog.name
309
+ }
310
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
+ metadata[:"x-goog-request-params"] ||= request_params_header
312
+
313
+ options.apply_defaults timeout: @config.rpcs.update_catalog.timeout,
314
+ metadata: metadata,
315
+ retry_policy: @config.rpcs.update_catalog.retry_policy
316
+ options.apply_defaults metadata: @config.metadata,
317
+ retry_policy: @config.retry_policy
318
+
319
+ @catalog_service_stub.call_rpc :update_catalog, request, options: options do |response, operation|
320
+ yield response, operation if block_given?
321
+ return response
322
+ end
323
+ rescue ::GRPC::BadStatus => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Configuration class for the CatalogService API.
329
+ #
330
+ # This class represents the configuration for CatalogService,
331
+ # providing control over timeouts, retry behavior, logging, transport
332
+ # parameters, and other low-level controls. Certain parameters can also be
333
+ # applied individually to specific RPCs. See
334
+ # {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration::Rpcs}
335
+ # for a list of RPCs that can be configured independently.
336
+ #
337
+ # Configuration can be applied globally to all clients, or to a single client
338
+ # on construction.
339
+ #
340
+ # # Examples
341
+ #
342
+ # To modify the global config, setting the timeout for list_catalogs
343
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
344
+ #
345
+ # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config|
346
+ # config.timeout = 10.0
347
+ # config.rpcs.list_catalogs.timeout = 20.0
348
+ # end
349
+ #
350
+ # To apply the above configuration only to a new client:
351
+ #
352
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config|
353
+ # config.timeout = 10.0
354
+ # config.rpcs.list_catalogs.timeout = 20.0
355
+ # end
356
+ #
357
+ # @!attribute [rw] endpoint
358
+ # The hostname or hostname:port of the service endpoint.
359
+ # Defaults to `"retail.googleapis.com"`.
360
+ # @return [::String]
361
+ # @!attribute [rw] credentials
362
+ # Credentials to send with calls. You may provide any of the following types:
363
+ # * (`String`) The path to a service account key file in JSON format
364
+ # * (`Hash`) A service account key as a Hash
365
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
366
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
367
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
368
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
369
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
370
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
371
+ # * (`nil`) indicating no credentials
372
+ # @return [::Object]
373
+ # @!attribute [rw] scope
374
+ # The OAuth scopes
375
+ # @return [::Array<::String>]
376
+ # @!attribute [rw] lib_name
377
+ # The library name as recorded in instrumentation and logging
378
+ # @return [::String]
379
+ # @!attribute [rw] lib_version
380
+ # The library version as recorded in instrumentation and logging
381
+ # @return [::String]
382
+ # @!attribute [rw] channel_args
383
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
384
+ # `GRPC::Core::Channel` object is provided as the credential.
385
+ # @return [::Hash]
386
+ # @!attribute [rw] interceptors
387
+ # An array of interceptors that are run before calls are executed.
388
+ # @return [::Array<::GRPC::ClientInterceptor>]
389
+ # @!attribute [rw] timeout
390
+ # The call timeout in seconds.
391
+ # @return [::Numeric]
392
+ # @!attribute [rw] metadata
393
+ # Additional gRPC headers to be sent with the call.
394
+ # @return [::Hash{::Symbol=>::String}]
395
+ # @!attribute [rw] retry_policy
396
+ # The retry policy. The value is a hash with the following keys:
397
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
398
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
399
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
400
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
401
+ # trigger a retry.
402
+ # @return [::Hash]
403
+ # @!attribute [rw] quota_project
404
+ # A separate project against which to charge quota.
405
+ # @return [::String]
406
+ #
407
+ class Configuration
408
+ extend ::Gapic::Config
409
+
410
+ config_attr :endpoint, "retail.googleapis.com", ::String
411
+ config_attr :credentials, nil do |value|
412
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
413
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
414
+ allowed.any? { |klass| klass === value }
415
+ end
416
+ config_attr :scope, nil, ::String, ::Array, nil
417
+ config_attr :lib_name, nil, ::String, nil
418
+ config_attr :lib_version, nil, ::String, nil
419
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
420
+ config_attr :interceptors, nil, ::Array, nil
421
+ config_attr :timeout, nil, ::Numeric, nil
422
+ config_attr :metadata, nil, ::Hash, nil
423
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
424
+ config_attr :quota_project, nil, ::String, nil
425
+
426
+ # @private
427
+ def initialize parent_config = nil
428
+ @parent_config = parent_config unless parent_config.nil?
429
+
430
+ yield self if block_given?
431
+ end
432
+
433
+ ##
434
+ # Configurations for individual RPCs
435
+ # @return [Rpcs]
436
+ #
437
+ def rpcs
438
+ @rpcs ||= begin
439
+ parent_rpcs = nil
440
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
441
+ Rpcs.new parent_rpcs
442
+ end
443
+ end
444
+
445
+ ##
446
+ # Configuration RPC class for the CatalogService API.
447
+ #
448
+ # Includes fields providing the configuration for each RPC in this service.
449
+ # Each configuration object is of type `Gapic::Config::Method` and includes
450
+ # the following configuration fields:
451
+ #
452
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
453
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
454
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
455
+ # include the following keys:
456
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
457
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
458
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
459
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
460
+ # trigger a retry.
461
+ #
462
+ class Rpcs
463
+ ##
464
+ # RPC-specific configuration for `list_catalogs`
465
+ # @return [::Gapic::Config::Method]
466
+ #
467
+ attr_reader :list_catalogs
468
+ ##
469
+ # RPC-specific configuration for `update_catalog`
470
+ # @return [::Gapic::Config::Method]
471
+ #
472
+ attr_reader :update_catalog
473
+
474
+ # @private
475
+ def initialize parent_rpcs = nil
476
+ list_catalogs_config = parent_rpcs&.list_catalogs if parent_rpcs&.respond_to? :list_catalogs
477
+ @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config
478
+ update_catalog_config = parent_rpcs&.update_catalog if parent_rpcs&.respond_to? :update_catalog
479
+ @update_catalog = ::Gapic::Config::Method.new update_catalog_config
480
+
481
+ yield self if block_given?
482
+ end
483
+ end
484
+ end
485
+ end
486
+ end
487
+ end
488
+ end
489
+ end
490
+ end