google-cloud-retail-v2 0.3.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +240 -40
- data/lib/google/cloud/retail/v2/catalog_service/paths.rb +21 -0
- data/lib/google/cloud/retail/v2/catalog_service_pb.rb +16 -0
- data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +46 -0
- data/lib/google/cloud/retail/v2/common_pb.rb +46 -0
- data/lib/google/cloud/retail/v2/completion_service/client.rb +545 -0
- data/lib/google/cloud/retail/v2/completion_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +664 -0
- data/lib/google/cloud/retail/v2/completion_service/paths.rb +52 -0
- data/lib/google/cloud/retail/v2/completion_service.rb +54 -0
- data/lib/google/cloud/retail/v2/completion_service_pb.rb +50 -0
- data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +61 -0
- data/lib/google/cloud/retail/v2/import_config_pb.rb +32 -0
- data/lib/google/cloud/retail/v2/prediction_service/client.rb +66 -70
- data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +682 -43
- data/lib/google/cloud/retail/v2/product_service/operations.rb +30 -21
- data/lib/google/cloud/retail/v2/product_service_pb.rb +56 -0
- data/lib/google/cloud/retail/v2/product_service_services_pb.rb +75 -0
- data/lib/google/cloud/retail/v2/search_service/client.rb +552 -0
- data/lib/google/cloud/retail/v2/search_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/search_service/paths.rb +54 -0
- data/lib/google/cloud/retail/v2/search_service.rb +53 -0
- data/lib/google/cloud/retail/v2/search_service_pb.rb +133 -0
- data/lib/google/cloud/retail/v2/search_service_services_pb.rb +53 -0
- data/lib/google/cloud/retail/v2/user_event_pb.rb +11 -0
- data/lib/google/cloud/retail/v2/user_event_service/client.rb +45 -42
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +30 -21
- data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/lib/google/cloud/retail/v2.rb +2 -0
- data/proto_docs/google/cloud/retail/v2/catalog.rb +6 -6
- data/proto_docs/google/cloud/retail/v2/catalog_service.rb +53 -4
- data/proto_docs/google/cloud/retail/v2/common.rb +272 -4
- data/proto_docs/google/cloud/retail/v2/completion_service.rb +164 -0
- data/proto_docs/google/cloud/retail/v2/import_config.rb +122 -6
- data/proto_docs/google/cloud/retail/v2/prediction_service.rb +32 -31
- data/proto_docs/google/cloud/retail/v2/product.rb +265 -9
- data/proto_docs/google/cloud/retail/v2/product_service.rb +362 -2
- data/proto_docs/google/cloud/retail/v2/purge_config.rb +1 -1
- data/proto_docs/google/cloud/retail/v2/search_service.rb +711 -0
- data/proto_docs/google/cloud/retail/v2/user_event.rb +110 -6
- data/proto_docs/google/type/date.rb +53 -0
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4362ee1ee1297de1e4f20da8c2e02d5b20a38f5334da03e58db621276d2d767b
|
4
|
+
data.tar.gz: 7de1bf1b00e922ab9b07c4b7912161f3af7dce3cd46fb4bf4f139d4dd53fba1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dca8e4dc874b55df773716b5115820d4e4f528a88673cf55107acaae041fd3aa8ee236b5bfaa20244172ae23a9b92053dfb10c77c6ee252610c635f19cc35a9
|
7
|
+
data.tar.gz: 66bc9026d1216894564f36f5fe8ed093225e7213ed85e3571dce187a4b9ab672023b51706d727ca4acee795ced47cbcfdb9e1aab84146ca75866546ffc15a8e4
|
@@ -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
|
-
#
|
44
|
+
# @example
|
45
45
|
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
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]
|
@@ -99,19 +98,15 @@ module Google
|
|
99
98
|
##
|
100
99
|
# Create a new CatalogService client object.
|
101
100
|
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
# To create a new CatalogService client with the default
|
105
|
-
# configuration:
|
101
|
+
# @example
|
106
102
|
#
|
107
|
-
#
|
103
|
+
# # Create a client using the default configuration
|
104
|
+
# client = ::Google::Cloud::Retail::V2::CatalogService::Client.new
|
108
105
|
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
# config.timeout = 10.0
|
114
|
-
# 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
|
115
110
|
#
|
116
111
|
# @yield [config] Configure the CatalogService client.
|
117
112
|
# @yieldparam config [Client::Configuration]
|
@@ -131,10 +126,9 @@ module Google
|
|
131
126
|
|
132
127
|
# Create credentials
|
133
128
|
credentials = @config.credentials
|
134
|
-
# Use self-signed JWT if the
|
129
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
135
130
|
# but only if the default endpoint does not have a region prefix.
|
136
|
-
enable_self_signed_jwt = @config.
|
137
|
-
@config.endpoint == Client.configure.endpoint &&
|
131
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
138
132
|
!@config.endpoint.split(".").first.include?("-")
|
139
133
|
credentials ||= Credentials.default scope: @config.scope,
|
140
134
|
enable_self_signed_jwt: enable_self_signed_jwt
|
@@ -233,7 +227,9 @@ module Google
|
|
233
227
|
options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout,
|
234
228
|
metadata: metadata,
|
235
229
|
retry_policy: @config.rpcs.list_catalogs.retry_policy
|
236
|
-
|
230
|
+
|
231
|
+
options.apply_defaults timeout: @config.timeout,
|
232
|
+
metadata: @config.metadata,
|
237
233
|
retry_policy: @config.retry_policy
|
238
234
|
|
239
235
|
@catalog_service_stub.call_rpc :list_catalogs, request, options: options do |response, operation|
|
@@ -274,10 +270,7 @@ module Google
|
|
274
270
|
# a NOT_FOUND error is returned.
|
275
271
|
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
276
272
|
# Indicates which fields in the provided
|
277
|
-
# {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
|
278
|
-
# update the
|
279
|
-
# {::Google::Cloud::Retail::V2::Catalog#product_level_config Catalog.product_level_config}
|
280
|
-
# field, which is also the only currently supported field to update.
|
273
|
+
# {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
|
281
274
|
#
|
282
275
|
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
283
276
|
# is returned.
|
@@ -316,7 +309,9 @@ module Google
|
|
316
309
|
options.apply_defaults timeout: @config.rpcs.update_catalog.timeout,
|
317
310
|
metadata: metadata,
|
318
311
|
retry_policy: @config.rpcs.update_catalog.retry_policy
|
319
|
-
|
312
|
+
|
313
|
+
options.apply_defaults timeout: @config.timeout,
|
314
|
+
metadata: @config.metadata,
|
320
315
|
retry_policy: @config.retry_policy
|
321
316
|
|
322
317
|
@catalog_service_stub.call_rpc :update_catalog, request, options: options do |response, operation|
|
@@ -327,6 +322,198 @@ module Google
|
|
327
322
|
raise ::Google::Cloud::Error.from_error(e)
|
328
323
|
end
|
329
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
|
+
# Please submit a form [here](https://cloud.google.com/contact) to contact
|
362
|
+
# cloud sales if you are 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
|
+
# Please submit a form [here](https://cloud.google.com/contact) to contact
|
449
|
+
# cloud sales if you are 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
|
+
|
330
517
|
##
|
331
518
|
# Configuration class for the CatalogService API.
|
332
519
|
#
|
@@ -340,22 +527,21 @@ module Google
|
|
340
527
|
# Configuration can be applied globally to all clients, or to a single client
|
341
528
|
# on construction.
|
342
529
|
#
|
343
|
-
#
|
344
|
-
#
|
345
|
-
# To modify the global config, setting the timeout for list_catalogs
|
346
|
-
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
347
|
-
#
|
348
|
-
# ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config|
|
349
|
-
# config.timeout = 10.0
|
350
|
-
# config.rpcs.list_catalogs.timeout = 20.0
|
351
|
-
# end
|
530
|
+
# @example
|
352
531
|
#
|
353
|
-
#
|
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
|
354
539
|
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
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
|
359
545
|
#
|
360
546
|
# @!attribute [rw] endpoint
|
361
547
|
# The hostname or hostname:port of the service endpoint.
|
@@ -473,6 +659,16 @@ module Google
|
|
473
659
|
# @return [::Gapic::Config::Method]
|
474
660
|
#
|
475
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
|
476
672
|
|
477
673
|
# @private
|
478
674
|
def initialize parent_rpcs = nil
|
@@ -480,6 +676,10 @@ module Google
|
|
480
676
|
@list_catalogs = ::Gapic::Config::Method.new list_catalogs_config
|
481
677
|
update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog
|
482
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
|
483
683
|
|
484
684
|
yield self if block_given?
|
485
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
|
#
|
@@ -26,6 +26,19 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
26
26
|
optional :catalog, :message, 1, "google.cloud.retail.v2.Catalog"
|
27
27
|
optional :update_mask, :message, 2, "google.protobuf.FieldMask"
|
28
28
|
end
|
29
|
+
add_message "google.cloud.retail.v2.SetDefaultBranchRequest" do
|
30
|
+
optional :catalog, :string, 1
|
31
|
+
optional :branch_id, :string, 2
|
32
|
+
optional :note, :string, 3
|
33
|
+
end
|
34
|
+
add_message "google.cloud.retail.v2.GetDefaultBranchRequest" do
|
35
|
+
optional :catalog, :string, 1
|
36
|
+
end
|
37
|
+
add_message "google.cloud.retail.v2.GetDefaultBranchResponse" do
|
38
|
+
optional :branch, :string, 1
|
39
|
+
optional :set_time, :message, 2, "google.protobuf.Timestamp"
|
40
|
+
optional :note, :string, 3
|
41
|
+
end
|
29
42
|
end
|
30
43
|
end
|
31
44
|
|
@@ -36,6 +49,9 @@ module Google
|
|
36
49
|
ListCatalogsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsRequest").msgclass
|
37
50
|
ListCatalogsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsResponse").msgclass
|
38
51
|
UpdateCatalogRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateCatalogRequest").msgclass
|
52
|
+
SetDefaultBranchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetDefaultBranchRequest").msgclass
|
53
|
+
GetDefaultBranchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetDefaultBranchRequest").msgclass
|
54
|
+
GetDefaultBranchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetDefaultBranchResponse").msgclass
|
39
55
|
end
|
40
56
|
end
|
41
57
|
end
|
@@ -38,6 +38,52 @@ module Google
|
|
38
38
|
rpc :ListCatalogs, ::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Google::Cloud::Retail::V2::ListCatalogsResponse
|
39
39
|
# Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
|
40
40
|
rpc :UpdateCatalog, ::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Google::Cloud::Retail::V2::Catalog
|
41
|
+
# Set a specified branch id as default branch. API methods such as
|
42
|
+
# [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
|
43
|
+
# [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
|
44
|
+
# [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
|
45
|
+
# will treat requests using "default_branch" to the actual branch id set as
|
46
|
+
# default.
|
47
|
+
#
|
48
|
+
# For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
|
49
|
+
# default, setting
|
50
|
+
# [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
|
51
|
+
# `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
|
52
|
+
# to setting
|
53
|
+
# [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
|
54
|
+
# `projects/*/locations/*/catalogs/*/branches/1`.
|
55
|
+
#
|
56
|
+
# Using multiple branches can be useful when developers would like
|
57
|
+
# to have a staging branch to test and verify for future usage. When it
|
58
|
+
# becomes ready, developers switch on the staging branch using this API while
|
59
|
+
# keeping using `projects/*/locations/*/catalogs/*/branches/default_branch`
|
60
|
+
# as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
|
61
|
+
# route the traffic to this staging branch.
|
62
|
+
#
|
63
|
+
# CAUTION: If you have live predict/search traffic, switching the default
|
64
|
+
# branch could potentially cause outages if the ID space of the new branch is
|
65
|
+
# very different from the old one.
|
66
|
+
#
|
67
|
+
# More specifically:
|
68
|
+
#
|
69
|
+
# * PredictionService will only return product IDs from branch {newBranch}.
|
70
|
+
# * SearchService will only return product IDs from branch {newBranch}
|
71
|
+
# (if branch is not explicitly set).
|
72
|
+
# * UserEventService will only join events with products from branch
|
73
|
+
# {newBranch}.
|
74
|
+
#
|
75
|
+
# This feature is only available for users who have Retail Search enabled.
|
76
|
+
# Please submit a form [here](https://cloud.google.com/contact) to contact
|
77
|
+
# cloud sales if you are interested in using Retail Search.
|
78
|
+
rpc :SetDefaultBranch, ::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Google::Protobuf::Empty
|
79
|
+
# Get which branch is currently default branch set by
|
80
|
+
# [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
|
81
|
+
# method under a specified parent catalog.
|
82
|
+
#
|
83
|
+
# This feature is only available for users who have Retail Search enabled.
|
84
|
+
# Please submit a form [here](https://cloud.google.com/contact) to contact
|
85
|
+
# cloud sales if you are interested in using Retail Search.
|
86
|
+
rpc :GetDefaultBranch, ::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Google::Cloud::Retail::V2::GetDefaultBranchResponse
|
41
87
|
end
|
42
88
|
|
43
89
|
Stub = Service.rpc_stub_class
|