google-cloud-retail-v2 0.3.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/retail/v2.rb +2 -0
  5. data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -0
  6. data/lib/google/cloud/retail/v2/catalog_service/client.rb +242 -45
  7. data/lib/google/cloud/retail/v2/catalog_service/paths.rb +21 -0
  8. data/lib/google/cloud/retail/v2/catalog_service_pb.rb +16 -0
  9. data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +47 -1
  10. data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
  11. data/lib/google/cloud/retail/v2/completion_service.rb +54 -0
  12. data/lib/google/cloud/retail/v2/completion_service/client.rb +543 -0
  13. data/lib/google/cloud/retail/v2/completion_service/credentials.rb +51 -0
  14. data/lib/google/cloud/retail/v2/completion_service/operations.rb +664 -0
  15. data/lib/google/cloud/retail/v2/completion_service/paths.rb +52 -0
  16. data/lib/google/cloud/retail/v2/completion_service_pb.rb +50 -0
  17. data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +61 -0
  18. data/lib/google/cloud/retail/v2/import_config_pb.rb +32 -0
  19. data/lib/google/cloud/retail/v2/prediction_service/client.rb +68 -75
  20. data/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +1 -1
  21. data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
  22. data/lib/google/cloud/retail/v2/product_service/client.rb +684 -48
  23. data/lib/google/cloud/retail/v2/product_service/operations.rb +34 -25
  24. data/lib/google/cloud/retail/v2/product_service_pb.rb +56 -0
  25. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +76 -1
  26. data/lib/google/cloud/retail/v2/search_service.rb +53 -0
  27. data/lib/google/cloud/retail/v2/search_service/client.rb +531 -0
  28. data/lib/google/cloud/retail/v2/search_service/credentials.rb +51 -0
  29. data/lib/google/cloud/retail/v2/search_service/paths.rb +54 -0
  30. data/lib/google/cloud/retail/v2/search_service_pb.rb +131 -0
  31. data/lib/google/cloud/retail/v2/search_service_services_pb.rb +53 -0
  32. data/lib/google/cloud/retail/v2/user_event_pb.rb +11 -0
  33. data/lib/google/cloud/retail/v2/user_event_service/client.rb +47 -47
  34. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +34 -25
  35. data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
  36. data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +1 -1
  37. data/lib/google/cloud/retail/v2/version.rb +1 -1
  38. data/proto_docs/google/api/field_behavior.rb +7 -1
  39. data/proto_docs/google/api/httpbody.rb +4 -3
  40. data/proto_docs/google/cloud/retail/v2/catalog.rb +6 -6
  41. data/proto_docs/google/cloud/retail/v2/catalog_service.rb +53 -4
  42. data/proto_docs/google/cloud/retail/v2/common.rb +272 -4
  43. data/proto_docs/google/cloud/retail/v2/completion_service.rb +162 -0
  44. data/proto_docs/google/cloud/retail/v2/import_config.rb +122 -6
  45. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +32 -31
  46. data/proto_docs/google/cloud/retail/v2/product.rb +266 -10
  47. data/proto_docs/google/cloud/retail/v2/product_service.rb +362 -2
  48. data/proto_docs/google/cloud/retail/v2/purge_config.rb +1 -1
  49. data/proto_docs/google/cloud/retail/v2/search_service.rb +681 -0
  50. data/proto_docs/google/cloud/retail/v2/user_event.rb +95 -3
  51. data/proto_docs/google/type/date.rb +53 -0
  52. metadata +20 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd84ee8b8cb6402aa583b3e9c4547a5fc1a289e166e65545ddb713576f1d880c
4
- data.tar.gz: fea5c7cc85fec5aeee31730266cf8c99dd8fe5b3ee52963e58ecde4002291149
3
+ metadata.gz: b07d919181d8706e180a703f7cecd52fb464e69cfa4fd0ede43cf5b351a0e88e
4
+ data.tar.gz: 04bee385524f62ef1d40025669309f5d094b228e5ec833805baad6bacd1d2365
5
5
  SHA512:
6
- metadata.gz: fbc4ce6666a59e6c4cb03e2d912f030bcbdad8928bc89150f28e06edcd98b5517a7e414a9b22a05168ea79f3f8eab96c70afb7510e20b42cb05aecd749c3b778
7
- data.tar.gz: 542f628eeccc024f038b23ec2540117fdd0b1810cfa64ff0400fd0bde837c8ddcacbcec9ff5ff4670e86d297dd65149b5ad3c217a6cacd49569501ccbcbc32d0
6
+ metadata.gz: f41c60eb5f15c54e8f4ac41a94be47f87013ece357de71a7699a3b6a8af7ddb0f5d955092c446df68c06ea1aad20d162aca6aa5785680ecf619af408e494a284
7
+ data.tar.gz: 536710d9c52c19162bc9a2effd65d2f7861b1b81a50ad3c659a4b1d4034a9acbfbcdb4a205a4de36df434a338ceb076ee68de0566cc29d259449568d876c557f
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-retail-v2
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::Retail::V2::CatalogService::Credentials}):
68
68
 
69
- 1. `RETAIL_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `RETAIL_KEYFILE` - Path to JSON file, or JSON contents
71
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
69
+ * `RETAIL_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `RETAIL_KEYFILE` - Path to JSON file, or JSON contents
71
+ * `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
+ * `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
+ * `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/retail/v2"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
82
82
 
83
83
  ### Configuration
84
84
 
85
- The **Credentials JSON** can be configured instead of placing them in
86
- environment variables. Either on an individual client initialization:
85
+ The path to the **Credentials JSON** file can be configured instead of storing
86
+ it in an environment variable. Either on an individual client initialization:
87
87
 
88
88
  ```ruby
89
89
  require "google/cloud/retail/v2"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config|
93
93
  end
94
94
  ```
95
95
 
96
- Or configured globally for all clients:
96
+ Or globally for all clients:
97
97
 
98
98
  ```ruby
99
99
  require "google/cloud/retail/v2"
data/README.md CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/retail/v2"
34
34
 
35
35
  client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::Retail::V2::ListCatalogsRequest.new # (request fields as keyword arguments...)
37
37
  response = client.list_catalogs request
38
38
  ```
39
39
 
@@ -17,8 +17,10 @@
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
19
  require "google/cloud/retail/v2/catalog_service"
20
+ require "google/cloud/retail/v2/completion_service"
20
21
  require "google/cloud/retail/v2/prediction_service"
21
22
  require "google/cloud/retail/v2/product_service"
23
+ require "google/cloud/retail/v2/search_service"
22
24
  require "google/cloud/retail/v2/user_event_service"
23
25
  require "google/cloud/retail/v2/version"
24
26
 
@@ -6,6 +6,8 @@ require 'google/protobuf'
6
6
  require 'google/api/annotations_pb'
7
7
  require 'google/api/field_behavior_pb'
8
8
  require 'google/api/resource_pb'
9
+ require 'google/cloud/retail/v2/common_pb'
10
+ require 'google/cloud/retail/v2/import_config_pb'
9
11
  Google::Protobuf::DescriptorPool.generated_pool.build do
10
12
  add_file("google/cloud/retail/v2/catalog.proto", :syntax => :proto3) do
11
13
  add_message "google.cloud.retail.v2.ProductLevelConfig" do
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
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
46
+ # # Modify the configuration for all CatalogService clients
47
+ # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -67,10 +66,7 @@ module Google
67
66
 
68
67
  default_config.timeout = 60.0
69
68
  default_config.retry_policy = {
70
- initial_delay: 0.1,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [14, 4]
69
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
74
70
  }
75
71
 
76
72
  default_config
@@ -102,19 +98,15 @@ module Google
102
98
  ##
103
99
  # Create a new CatalogService client object.
104
100
  #
105
- # ## Examples
106
- #
107
- # To create a new CatalogService client with the default
108
- # configuration:
101
+ # @example
109
102
  #
110
- # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
111
105
  #
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
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
118
110
  #
119
111
  # @yield [config] Configure the CatalogService client.
120
112
  # @yieldparam config [Client::Configuration]
@@ -134,14 +126,13 @@ module Google
134
126
 
135
127
  # Create credentials
136
128
  credentials = @config.credentials
137
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
130
  # but only if the default endpoint does not have a region prefix.
139
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
140
- @config.endpoint == Client.configure.endpoint &&
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
132
  !@config.endpoint.split(".").first.include?("-")
142
133
  credentials ||= Credentials.default scope: @config.scope,
143
134
  enable_self_signed_jwt: enable_self_signed_jwt
144
- if credentials.is_a?(String) || credentials.is_a?(Hash)
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
136
  credentials = Credentials.new credentials, scope: @config.scope
146
137
  end
147
138
  @quota_project_id = @config.quota_project
@@ -236,7 +227,9 @@ module Google
236
227
  options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout,
237
228
  metadata: metadata,
238
229
  retry_policy: @config.rpcs.list_catalogs.retry_policy
239
- options.apply_defaults metadata: @config.metadata,
230
+
231
+ options.apply_defaults timeout: @config.timeout,
232
+ metadata: @config.metadata,
240
233
  retry_policy: @config.retry_policy
241
234
 
242
235
  @catalog_service_stub.call_rpc :list_catalogs, request, options: options do |response, operation|
@@ -277,10 +270,7 @@ module Google
277
270
  # a NOT_FOUND error is returned.
278
271
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
279
272
  # Indicates which fields in the provided
280
- # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. If not set, will only
281
- # update the
282
- # {::Google::Cloud::Retail::V2::Catalog#product_level_config Catalog.product_level_config}
283
- # field, which is also the only currently supported field to update.
273
+ # {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
284
274
  #
285
275
  # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
286
276
  # is returned.
@@ -319,7 +309,9 @@ module Google
319
309
  options.apply_defaults timeout: @config.rpcs.update_catalog.timeout,
320
310
  metadata: metadata,
321
311
  retry_policy: @config.rpcs.update_catalog.retry_policy
322
- options.apply_defaults metadata: @config.metadata,
312
+
313
+ options.apply_defaults timeout: @config.timeout,
314
+ metadata: @config.metadata,
323
315
  retry_policy: @config.retry_policy
324
316
 
325
317
  @catalog_service_stub.call_rpc :update_catalog, request, options: options do |response, operation|
@@ -330,6 +322,198 @@ module Google
330
322
  raise ::Google::Cloud::Error.from_error(e)
331
323
  end
332
324
 
325
+ ##
326
+ # Set a specified branch id as default branch. API methods such as
327
+ # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search},
328
+ # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct},
329
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}
330
+ # will treat requests using "default_branch" to the actual branch id set as
331
+ # default.
332
+ #
333
+ # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
334
+ # default, setting
335
+ # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
336
+ # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
337
+ # to setting
338
+ # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
339
+ # `projects/*/locations/*/catalogs/*/branches/1`.
340
+ #
341
+ # Using multiple branches can be useful when developers would like
342
+ # to have a staging branch to test and verify for future usage. When it
343
+ # becomes ready, developers switch on the staging branch using this API while
344
+ # keeping using `projects/*/locations/*/catalogs/*/branches/default_branch`
345
+ # as {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
346
+ # route the traffic to this staging branch.
347
+ #
348
+ # CAUTION: If you have live predict/search traffic, switching the default
349
+ # branch could potentially cause outages if the ID space of the new branch is
350
+ # very different from the old one.
351
+ #
352
+ # More specifically:
353
+ #
354
+ # * PredictionService will only return product IDs from branch \\{newBranch}.
355
+ # * SearchService will only return product IDs from branch \\{newBranch}
356
+ # (if branch is not explicitly set).
357
+ # * UserEventService will only join events with products from branch
358
+ # \\{newBranch}.
359
+ #
360
+ # This feature is only available for users who have Retail Search enabled.
361
+ # Contact Retail Support (retail-search-support@google.com) if you are
362
+ # interested in using Retail Search.
363
+ #
364
+ # @overload set_default_branch(request, options = nil)
365
+ # Pass arguments to `set_default_branch` via a request object, either of type
366
+ # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash.
367
+ #
368
+ # @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash]
369
+ # A request object representing the call parameters. Required. To specify no
370
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
371
+ # @param options [::Gapic::CallOptions, ::Hash]
372
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
373
+ #
374
+ # @overload set_default_branch(catalog: nil, branch_id: nil, note: nil)
375
+ # Pass arguments to `set_default_branch` via keyword arguments. Note that at
376
+ # least one keyword argument is required. To specify no parameters, or to keep all
377
+ # the default parameter values, pass an empty Hash as a request object (see above).
378
+ #
379
+ # @param catalog [::String]
380
+ # Full resource name of the catalog, such as
381
+ # `projects/*/locations/global/catalogs/default_catalog`.
382
+ # @param branch_id [::String]
383
+ # The final component of the resource name of a branch.
384
+ #
385
+ # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
386
+ # error is returned.
387
+ # @param note [::String]
388
+ # Some note on this request, this can be retrieved by
389
+ # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch}
390
+ # before next valid default branch set occurs.
391
+ #
392
+ # This field must be a UTF-8 encoded string with a length limit of 1,000
393
+ # characters. Otherwise, an INVALID_ARGUMENT error is returned.
394
+ #
395
+ # @yield [response, operation] Access the result along with the RPC operation
396
+ # @yieldparam response [::Google::Protobuf::Empty]
397
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
398
+ #
399
+ # @return [::Google::Protobuf::Empty]
400
+ #
401
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
402
+ #
403
+ def set_default_branch request, options = nil
404
+ raise ::ArgumentError, "request must be provided" if request.nil?
405
+
406
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest
407
+
408
+ # Converts hash and nil to an options object
409
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
410
+
411
+ # Customize the options with defaults
412
+ metadata = @config.rpcs.set_default_branch.metadata.to_h
413
+
414
+ # Set x-goog-api-client and x-goog-user-project headers
415
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
416
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
417
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
418
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
419
+
420
+ header_params = {
421
+ "catalog" => request.catalog
422
+ }
423
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
424
+ metadata[:"x-goog-request-params"] ||= request_params_header
425
+
426
+ options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout,
427
+ metadata: metadata,
428
+ retry_policy: @config.rpcs.set_default_branch.retry_policy
429
+
430
+ options.apply_defaults timeout: @config.timeout,
431
+ metadata: @config.metadata,
432
+ retry_policy: @config.retry_policy
433
+
434
+ @catalog_service_stub.call_rpc :set_default_branch, request, options: options do |response, operation|
435
+ yield response, operation if block_given?
436
+ return response
437
+ end
438
+ rescue ::GRPC::BadStatus => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
442
+ ##
443
+ # Get which branch is currently default branch set by
444
+ # {::Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch CatalogService.SetDefaultBranch}
445
+ # method under a specified parent catalog.
446
+ #
447
+ # This feature is only available for users who have Retail Search enabled.
448
+ # Contact Retail Support (retail-search-support@google.com) if you are
449
+ # interested in using Retail Search.
450
+ #
451
+ # @overload get_default_branch(request, options = nil)
452
+ # Pass arguments to `get_default_branch` via a request object, either of type
453
+ # {::Google::Cloud::Retail::V2::GetDefaultBranchRequest} or an equivalent Hash.
454
+ #
455
+ # @param request [::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Hash]
456
+ # A request object representing the call parameters. Required. To specify no
457
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
458
+ # @param options [::Gapic::CallOptions, ::Hash]
459
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
460
+ #
461
+ # @overload get_default_branch(catalog: nil)
462
+ # Pass arguments to `get_default_branch` via keyword arguments. Note that at
463
+ # least one keyword argument is required. To specify no parameters, or to keep all
464
+ # the default parameter values, pass an empty Hash as a request object (see above).
465
+ #
466
+ # @param catalog [::String]
467
+ # The parent catalog resource name, such as
468
+ # `projects/*/locations/global/catalogs/default_catalog`.
469
+ #
470
+ # @yield [response, operation] Access the result along with the RPC operation
471
+ # @yieldparam response [::Google::Cloud::Retail::V2::GetDefaultBranchResponse]
472
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
473
+ #
474
+ # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse]
475
+ #
476
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
477
+ #
478
+ def get_default_branch request, options = nil
479
+ raise ::ArgumentError, "request must be provided" if request.nil?
480
+
481
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetDefaultBranchRequest
482
+
483
+ # Converts hash and nil to an options object
484
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
485
+
486
+ # Customize the options with defaults
487
+ metadata = @config.rpcs.get_default_branch.metadata.to_h
488
+
489
+ # Set x-goog-api-client and x-goog-user-project headers
490
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
491
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
492
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
493
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
494
+
495
+ header_params = {
496
+ "catalog" => request.catalog
497
+ }
498
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
499
+ metadata[:"x-goog-request-params"] ||= request_params_header
500
+
501
+ options.apply_defaults timeout: @config.rpcs.get_default_branch.timeout,
502
+ metadata: metadata,
503
+ retry_policy: @config.rpcs.get_default_branch.retry_policy
504
+
505
+ options.apply_defaults timeout: @config.timeout,
506
+ metadata: @config.metadata,
507
+ retry_policy: @config.retry_policy
508
+
509
+ @catalog_service_stub.call_rpc :get_default_branch, request, options: options do |response, operation|
510
+ yield response, operation if block_given?
511
+ return response
512
+ end
513
+ rescue ::GRPC::BadStatus => e
514
+ raise ::Google::Cloud::Error.from_error(e)
515
+ end
516
+
333
517
  ##
334
518
  # Configuration class for the CatalogService API.
335
519
  #
@@ -343,22 +527,21 @@ module Google
343
527
  # Configuration can be applied globally to all clients, or to a single client
344
528
  # on construction.
345
529
  #
346
- # # Examples
347
- #
348
- # To modify the global config, setting the timeout for list_catalogs
349
- # to 20 seconds, and all remaining timeouts to 10 seconds:
350
- #
351
- # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config|
352
- # config.timeout = 10.0
353
- # config.rpcs.list_catalogs.timeout = 20.0
354
- # end
530
+ # @example
355
531
  #
356
- # To apply the above configuration only to a new client:
532
+ # # Modify the global config, setting the timeout for
533
+ # # list_catalogs to 20 seconds,
534
+ # # and all remaining timeouts to 10 seconds.
535
+ # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config|
536
+ # config.timeout = 10.0
537
+ # config.rpcs.list_catalogs.timeout = 20.0
538
+ # end
357
539
  #
358
- # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config|
359
- # config.timeout = 10.0
360
- # config.rpcs.list_catalogs.timeout = 20.0
361
- # end
540
+ # # Apply the above configuration only to a new client.
541
+ # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config|
542
+ # config.timeout = 10.0
543
+ # config.rpcs.list_catalogs.timeout = 20.0
544
+ # end
362
545
  #
363
546
  # @!attribute [rw] endpoint
364
547
  # The hostname or hostname:port of the service endpoint.
@@ -476,6 +659,16 @@ module Google
476
659
  # @return [::Gapic::Config::Method]
477
660
  #
478
661
  attr_reader :update_catalog
662
+ ##
663
+ # RPC-specific configuration for `set_default_branch`
664
+ # @return [::Gapic::Config::Method]
665
+ #
666
+ attr_reader :set_default_branch
667
+ ##
668
+ # RPC-specific configuration for `get_default_branch`
669
+ # @return [::Gapic::Config::Method]
670
+ #
671
+ attr_reader :get_default_branch
479
672
 
480
673
  # @private
481
674
  def initialize parent_rpcs = nil
@@ -483,6 +676,10 @@ module Google
483
676
  @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config
484
677
  update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog
485
678
  @update_catalog = ::Gapic::Config::Method.new update_catalog_config
679
+ set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch
680
+ @set_default_branch = ::Gapic::Config::Method.new set_default_branch_config
681
+ get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch
682
+ @get_default_branch = ::Gapic::Config::Method.new get_default_branch_config
486
683
 
487
684
  yield self if block_given?
488
685
  end
@@ -24,6 +24,27 @@ module Google
24
24
  module CatalogService
25
25
  # Path helper methods for the CatalogService API.
26
26
  module Paths
27
+ ##
28
+ # Create a fully-qualified Branch resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param catalog [String]
37
+ # @param branch [String]
38
+ #
39
+ # @return [::String]
40
+ def branch_path project:, location:, catalog:, branch:
41
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
42
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
43
+ raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/"
44
+
45
+ "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}"
46
+ end
47
+
27
48
  ##
28
49
  # Create a fully-qualified Catalog resource string.
29
50
  #