google-cloud-retail-v2 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/README.md +1 -1
- data/lib/google/cloud/retail/v2.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -0
- data/lib/google/cloud/retail/v2/catalog_service/client.rb +205 -9
- 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.rb +54 -0
- data/lib/google/cloud/retail/v2/completion_service/client.rb +546 -0
- data/lib/google/cloud/retail/v2/completion_service/credentials.rb +51 -0
- data/lib/google/cloud/retail/v2/completion_service/operations.rb +655 -0
- data/lib/google/cloud/retail/v2/completion_service/paths.rb +52 -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 +36 -38
- data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
- data/lib/google/cloud/retail/v2/product_service/client.rb +634 -9
- data/lib/google/cloud/retail/v2/product_service/operations.rb +4 -4
- 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.rb +53 -0
- data/lib/google/cloud/retail/v2/search_service/client.rb +536 -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_pb.rb +131 -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 +3 -6
- data/lib/google/cloud/retail/v2/user_event_service/operations.rb +4 -4
- data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
- data/lib/google/cloud/retail/v2/version.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/api/httpbody.rb +4 -3
- 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 +162 -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 +266 -10
- 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 +681 -0
- data/proto_docs/google/cloud/retail/v2/user_event.rb +95 -3
- data/proto_docs/google/type/date.rb +53 -0
- metadata +29 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dc44cab7183e8c99dcff0174ca915af53d47e792de193605d4333dd65777ced
|
4
|
+
data.tar.gz: 31deb9ad3ab11a76193b85fe3bc30c39eaa372dda44dd1b83c12a01a89e9e06c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8925f2040c7b54c45d4dc158735550f20cda1aacbf42b6e46e7abc02dcab586921cd2744b6b44573dd0fbe3164cfab9e5432ecb55a81c9275321337e3a654515
|
7
|
+
data.tar.gz: 502150bb18dbb2fdbb9ba9911d1e6e1272c80506feb6a625bb4ac335d5fdfbfa5b62d901385dc115c0921dbcfd092b35219c44709e9cb1904d1ba02dd4ace9a9
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
86
|
-
environment
|
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
|
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 =
|
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
|
@@ -67,10 +67,7 @@ module Google
|
|
67
67
|
|
68
68
|
default_config.timeout = 60.0
|
69
69
|
default_config.retry_policy = {
|
70
|
-
initial_delay: 0.1,
|
71
|
-
max_delay: 60.0,
|
72
|
-
multiplier: 1.3,
|
73
|
-
retry_codes: [14, 4]
|
70
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
|
74
71
|
}
|
75
72
|
|
76
73
|
default_config
|
@@ -141,7 +138,7 @@ module Google
|
|
141
138
|
!@config.endpoint.split(".").first.include?("-")
|
142
139
|
credentials ||= Credentials.default scope: @config.scope,
|
143
140
|
enable_self_signed_jwt: enable_self_signed_jwt
|
144
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
141
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
145
142
|
credentials = Credentials.new credentials, scope: @config.scope
|
146
143
|
end
|
147
144
|
@quota_project_id = @config.quota_project
|
@@ -277,10 +274,7 @@ module Google
|
|
277
274
|
# a NOT_FOUND error is returned.
|
278
275
|
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
279
276
|
# Indicates which fields in the provided
|
280
|
-
# {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
|
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.
|
277
|
+
# {::Google::Cloud::Retail::V2::Catalog Catalog} to update.
|
284
278
|
#
|
285
279
|
# If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
|
286
280
|
# is returned.
|
@@ -330,6 +324,194 @@ module Google
|
|
330
324
|
raise ::Google::Cloud::Error.from_error(e)
|
331
325
|
end
|
332
326
|
|
327
|
+
##
|
328
|
+
# Set a specified branch id as default branch. API methods such as
|
329
|
+
# {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search},
|
330
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct},
|
331
|
+
# {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}
|
332
|
+
# will treat requests using "default_branch" to the actual branch id set as
|
333
|
+
# default.
|
334
|
+
#
|
335
|
+
# For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
|
336
|
+
# default, setting
|
337
|
+
# {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
|
338
|
+
# `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
|
339
|
+
# to setting
|
340
|
+
# {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
|
341
|
+
# `projects/*/locations/*/catalogs/*/branches/1`.
|
342
|
+
#
|
343
|
+
# Using multiple branches can be useful when developers would like
|
344
|
+
# to have a staging branch to test and verify for future usage. When it
|
345
|
+
# becomes ready, developers switch on the staging branch using this API while
|
346
|
+
# keeping using `projects/*/locations/*/catalogs/*/branches/default_branch`
|
347
|
+
# as {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to
|
348
|
+
# route the traffic to this staging branch.
|
349
|
+
#
|
350
|
+
# CAUTION: If you have live predict/search traffic, switching the default
|
351
|
+
# branch could potentially cause outages if the ID space of the new branch is
|
352
|
+
# very different from the old one.
|
353
|
+
#
|
354
|
+
# More specifically:
|
355
|
+
#
|
356
|
+
# * PredictionService will only return product IDs from branch \\{newBranch}.
|
357
|
+
# * SearchService will only return product IDs from branch \\{newBranch}
|
358
|
+
# (if branch is not explicitly set).
|
359
|
+
# * UserEventService will only join events with products from branch
|
360
|
+
# \\{newBranch}.
|
361
|
+
#
|
362
|
+
# This feature is only available for users who have Retail Search enabled.
|
363
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
364
|
+
# interested in using Retail Search.
|
365
|
+
#
|
366
|
+
# @overload set_default_branch(request, options = nil)
|
367
|
+
# Pass arguments to `set_default_branch` via a request object, either of type
|
368
|
+
# {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash.
|
369
|
+
#
|
370
|
+
# @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash]
|
371
|
+
# A request object representing the call parameters. Required. To specify no
|
372
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
373
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
374
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
375
|
+
#
|
376
|
+
# @overload set_default_branch(catalog: nil, branch_id: nil, note: nil)
|
377
|
+
# Pass arguments to `set_default_branch` via keyword arguments. Note that at
|
378
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
379
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
380
|
+
#
|
381
|
+
# @param catalog [::String]
|
382
|
+
# Full resource name of the catalog, such as
|
383
|
+
# `projects/*/locations/global/catalogs/default_catalog`.
|
384
|
+
# @param branch_id [::String]
|
385
|
+
# The final component of the resource name of a branch.
|
386
|
+
#
|
387
|
+
# This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
|
388
|
+
# error is returned.
|
389
|
+
# @param note [::String]
|
390
|
+
# Some note on this request, this can be retrieved by
|
391
|
+
# {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch}
|
392
|
+
# before next valid default branch set occurs.
|
393
|
+
#
|
394
|
+
# This field must be a UTF-8 encoded string with a length limit of 1,000
|
395
|
+
# characters. Otherwise, an INVALID_ARGUMENT error is returned.
|
396
|
+
#
|
397
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
398
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
399
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
400
|
+
#
|
401
|
+
# @return [::Google::Protobuf::Empty]
|
402
|
+
#
|
403
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
404
|
+
#
|
405
|
+
def set_default_branch request, options = nil
|
406
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
407
|
+
|
408
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest
|
409
|
+
|
410
|
+
# Converts hash and nil to an options object
|
411
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
412
|
+
|
413
|
+
# Customize the options with defaults
|
414
|
+
metadata = @config.rpcs.set_default_branch.metadata.to_h
|
415
|
+
|
416
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
417
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
418
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
419
|
+
gapic_version: ::Google::Cloud::Retail::V2::VERSION
|
420
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
421
|
+
|
422
|
+
header_params = {
|
423
|
+
"catalog" => request.catalog
|
424
|
+
}
|
425
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
426
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
427
|
+
|
428
|
+
options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout,
|
429
|
+
metadata: metadata,
|
430
|
+
retry_policy: @config.rpcs.set_default_branch.retry_policy
|
431
|
+
options.apply_defaults 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
|
+
options.apply_defaults metadata: @config.metadata,
|
505
|
+
retry_policy: @config.retry_policy
|
506
|
+
|
507
|
+
@catalog_service_stub.call_rpc :get_default_branch, request, options: options do |response, operation|
|
508
|
+
yield response, operation if block_given?
|
509
|
+
return response
|
510
|
+
end
|
511
|
+
rescue ::GRPC::BadStatus => e
|
512
|
+
raise ::Google::Cloud::Error.from_error(e)
|
513
|
+
end
|
514
|
+
|
333
515
|
##
|
334
516
|
# Configuration class for the CatalogService API.
|
335
517
|
#
|
@@ -476,6 +658,16 @@ module Google
|
|
476
658
|
# @return [::Gapic::Config::Method]
|
477
659
|
#
|
478
660
|
attr_reader :update_catalog
|
661
|
+
##
|
662
|
+
# RPC-specific configuration for `set_default_branch`
|
663
|
+
# @return [::Gapic::Config::Method]
|
664
|
+
#
|
665
|
+
attr_reader :set_default_branch
|
666
|
+
##
|
667
|
+
# RPC-specific configuration for `get_default_branch`
|
668
|
+
# @return [::Gapic::Config::Method]
|
669
|
+
#
|
670
|
+
attr_reader :get_default_branch
|
479
671
|
|
480
672
|
# @private
|
481
673
|
def initialize parent_rpcs = nil
|
@@ -483,6 +675,10 @@ module Google
|
|
483
675
|
@list_catalogs = ::Gapic::Config::Method.new list_catalogs_config
|
484
676
|
update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog
|
485
677
|
@update_catalog = ::Gapic::Config::Method.new update_catalog_config
|
678
|
+
set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch
|
679
|
+
@set_default_branch = ::Gapic::Config::Method.new set_default_branch_config
|
680
|
+
get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch
|
681
|
+
@get_default_branch = ::Gapic::Config::Method.new get_default_branch_config
|
486
682
|
|
487
683
|
yield self if block_given?
|
488
684
|
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
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
77
|
+
# 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
|
+
# Contact Retail Support (retail-search-support@google.com) if you are
|
85
|
+
# 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
|
@@ -8,20 +8,56 @@ require 'google/api/field_behavior_pb'
|
|
8
8
|
require 'google/protobuf/timestamp_pb'
|
9
9
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
10
|
add_file("google/cloud/retail/v2/common.proto", :syntax => :proto3) do
|
11
|
+
add_message "google.cloud.retail.v2.Audience" do
|
12
|
+
repeated :genders, :string, 1
|
13
|
+
repeated :age_groups, :string, 2
|
14
|
+
end
|
15
|
+
add_message "google.cloud.retail.v2.ColorInfo" do
|
16
|
+
repeated :color_families, :string, 1
|
17
|
+
repeated :colors, :string, 2
|
18
|
+
end
|
11
19
|
add_message "google.cloud.retail.v2.CustomAttribute" do
|
12
20
|
repeated :text, :string, 1
|
13
21
|
repeated :numbers, :double, 2
|
22
|
+
proto3_optional :searchable, :bool, 3
|
23
|
+
proto3_optional :indexable, :bool, 4
|
24
|
+
end
|
25
|
+
add_message "google.cloud.retail.v2.FulfillmentInfo" do
|
26
|
+
optional :type, :string, 1
|
27
|
+
repeated :place_ids, :string, 2
|
14
28
|
end
|
15
29
|
add_message "google.cloud.retail.v2.Image" do
|
16
30
|
optional :uri, :string, 1
|
17
31
|
optional :height, :int32, 2
|
18
32
|
optional :width, :int32, 3
|
19
33
|
end
|
34
|
+
add_message "google.cloud.retail.v2.Interval" do
|
35
|
+
oneof :min do
|
36
|
+
optional :minimum, :double, 1
|
37
|
+
optional :exclusive_minimum, :double, 2
|
38
|
+
end
|
39
|
+
oneof :max do
|
40
|
+
optional :maximum, :double, 3
|
41
|
+
optional :exclusive_maximum, :double, 4
|
42
|
+
end
|
43
|
+
end
|
20
44
|
add_message "google.cloud.retail.v2.PriceInfo" do
|
21
45
|
optional :currency_code, :string, 1
|
22
46
|
optional :price, :float, 2
|
23
47
|
optional :original_price, :float, 3
|
24
48
|
optional :cost, :float, 4
|
49
|
+
optional :price_effective_time, :message, 5, "google.protobuf.Timestamp"
|
50
|
+
optional :price_expire_time, :message, 6, "google.protobuf.Timestamp"
|
51
|
+
optional :price_range, :message, 7, "google.cloud.retail.v2.PriceInfo.PriceRange"
|
52
|
+
end
|
53
|
+
add_message "google.cloud.retail.v2.PriceInfo.PriceRange" do
|
54
|
+
optional :price, :message, 1, "google.cloud.retail.v2.Interval"
|
55
|
+
optional :original_price, :message, 2, "google.cloud.retail.v2.Interval"
|
56
|
+
end
|
57
|
+
add_message "google.cloud.retail.v2.Rating" do
|
58
|
+
optional :rating_count, :int32, 1
|
59
|
+
optional :average_rating, :float, 2
|
60
|
+
repeated :rating_histogram, :int32, 3
|
25
61
|
end
|
26
62
|
add_message "google.cloud.retail.v2.UserInfo" do
|
27
63
|
optional :user_id, :string, 1
|
@@ -29,6 +65,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
29
65
|
optional :user_agent, :string, 3
|
30
66
|
optional :direct_user_request, :bool, 4
|
31
67
|
end
|
68
|
+
add_message "google.cloud.retail.v2.Promotion" do
|
69
|
+
optional :promotion_id, :string, 1
|
70
|
+
end
|
32
71
|
end
|
33
72
|
end
|
34
73
|
|
@@ -36,10 +75,17 @@ module Google
|
|
36
75
|
module Cloud
|
37
76
|
module Retail
|
38
77
|
module V2
|
78
|
+
Audience = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Audience").msgclass
|
79
|
+
ColorInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ColorInfo").msgclass
|
39
80
|
CustomAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CustomAttribute").msgclass
|
81
|
+
FulfillmentInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.FulfillmentInfo").msgclass
|
40
82
|
Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Image").msgclass
|
83
|
+
Interval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Interval").msgclass
|
41
84
|
PriceInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo").msgclass
|
85
|
+
PriceInfo::PriceRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo.PriceRange").msgclass
|
86
|
+
Rating = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rating").msgclass
|
42
87
|
UserInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserInfo").msgclass
|
88
|
+
Promotion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Promotion").msgclass
|
43
89
|
end
|
44
90
|
end
|
45
91
|
end
|