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.
Files changed (50) 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 +205 -9
  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 +46 -0
  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 +546 -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 +655 -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 +36 -38
  20. data/lib/google/cloud/retail/v2/product_pb.rb +21 -0
  21. data/lib/google/cloud/retail/v2/product_service/client.rb +634 -9
  22. data/lib/google/cloud/retail/v2/product_service/operations.rb +4 -4
  23. data/lib/google/cloud/retail/v2/product_service_pb.rb +56 -0
  24. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +75 -0
  25. data/lib/google/cloud/retail/v2/search_service.rb +53 -0
  26. data/lib/google/cloud/retail/v2/search_service/client.rb +536 -0
  27. data/lib/google/cloud/retail/v2/search_service/credentials.rb +51 -0
  28. data/lib/google/cloud/retail/v2/search_service/paths.rb +54 -0
  29. data/lib/google/cloud/retail/v2/search_service_pb.rb +131 -0
  30. data/lib/google/cloud/retail/v2/search_service_services_pb.rb +53 -0
  31. data/lib/google/cloud/retail/v2/user_event_pb.rb +11 -0
  32. data/lib/google/cloud/retail/v2/user_event_service/client.rb +3 -6
  33. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +4 -4
  34. data/lib/google/cloud/retail/v2/user_event_service/paths.rb +19 -0
  35. data/lib/google/cloud/retail/v2/version.rb +1 -1
  36. data/proto_docs/google/api/field_behavior.rb +7 -1
  37. data/proto_docs/google/api/httpbody.rb +4 -3
  38. data/proto_docs/google/cloud/retail/v2/catalog.rb +6 -6
  39. data/proto_docs/google/cloud/retail/v2/catalog_service.rb +53 -4
  40. data/proto_docs/google/cloud/retail/v2/common.rb +272 -4
  41. data/proto_docs/google/cloud/retail/v2/completion_service.rb +162 -0
  42. data/proto_docs/google/cloud/retail/v2/import_config.rb +122 -6
  43. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +32 -31
  44. data/proto_docs/google/cloud/retail/v2/product.rb +266 -10
  45. data/proto_docs/google/cloud/retail/v2/product_service.rb +362 -2
  46. data/proto_docs/google/cloud/retail/v2/purge_config.rb +1 -1
  47. data/proto_docs/google/cloud/retail/v2/search_service.rb +681 -0
  48. data/proto_docs/google/cloud/retail/v2/user_event.rb +95 -3
  49. data/proto_docs/google/type/date.rb +53 -0
  50. metadata +29 -7
@@ -0,0 +1,52 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module Retail
23
+ module V2
24
+ module CompletionService
25
+ # Path helper methods for the CompletionService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Catalog resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/catalogs/{catalog}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param catalog [String]
37
+ #
38
+ # @return [::String]
39
+ def catalog_path project:, location:, catalog:
40
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42
+
43
+ "projects/#{project}/locations/#{location}/catalogs/#{catalog}"
44
+ end
45
+
46
+ extend self
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,50 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/retail/v2/completion_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
8
+ require 'google/api/field_behavior_pb'
9
+ require 'google/api/resource_pb'
10
+ require 'google/cloud/retail/v2/common_pb'
11
+ require 'google/cloud/retail/v2/import_config_pb'
12
+ require 'google/longrunning/operations_pb'
13
+ Google::Protobuf::DescriptorPool.generated_pool.build do
14
+ add_file("google/cloud/retail/v2/completion_service.proto", :syntax => :proto3) do
15
+ add_message "google.cloud.retail.v2.CompleteQueryRequest" do
16
+ optional :catalog, :string, 1
17
+ optional :query, :string, 2
18
+ optional :visitor_id, :string, 7
19
+ repeated :language_codes, :string, 3
20
+ optional :device_type, :string, 4
21
+ optional :dataset, :string, 6
22
+ optional :max_suggestions, :int32, 5
23
+ end
24
+ add_message "google.cloud.retail.v2.CompleteQueryResponse" do
25
+ repeated :completion_results, :message, 1, "google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
26
+ optional :attribution_token, :string, 2
27
+ repeated :recent_search_results, :message, 3, "google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
28
+ end
29
+ add_message "google.cloud.retail.v2.CompleteQueryResponse.CompletionResult" do
30
+ optional :suggestion, :string, 1
31
+ map :attributes, :string, :message, 2, "google.cloud.retail.v2.CustomAttribute"
32
+ end
33
+ add_message "google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult" do
34
+ optional :recent_search, :string, 1
35
+ end
36
+ end
37
+ end
38
+
39
+ module Google
40
+ module Cloud
41
+ module Retail
42
+ module V2
43
+ CompleteQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryRequest").msgclass
44
+ CompleteQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse").msgclass
45
+ CompleteQueryResponse::CompletionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.CompletionResult").msgclass
46
+ CompleteQueryResponse::RecentSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult").msgclass
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,61 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/retail/v2/completion_service.proto for package 'Google.Cloud.Retail.V2'
3
+ # Original file comments:
4
+ # Copyright 2020 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/retail/v2/completion_service_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Retail
25
+ module V2
26
+ module CompletionService
27
+ # Auto-completion service for retail.
28
+ #
29
+ # This feature is only available for users who have Retail Search enabled.
30
+ # Contact Retail Support (retail-search-support@google.com) if you are
31
+ # interested in using Retail Search.
32
+ class Service
33
+
34
+ include GRPC::GenericService
35
+
36
+ self.marshal_class_method = :encode
37
+ self.unmarshal_class_method = :decode
38
+ self.service_name = 'google.cloud.retail.v2.CompletionService'
39
+
40
+ # Completes the specified prefix with keyword suggestions.
41
+ #
42
+ # This feature is only available for users who have Retail Search enabled.
43
+ # Contact Retail Support (retail-search-support@google.com) if you are
44
+ # interested in using Retail Search.
45
+ rpc :CompleteQuery, ::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Google::Cloud::Retail::V2::CompleteQueryResponse
46
+ # Bulk import of processed completion dataset.
47
+ #
48
+ # Request processing may be synchronous. Partial updating is not supported.
49
+ #
50
+ # This feature is only available for users who have Retail Search enabled.
51
+ # Contact Retail Support (retail-search-support@google.com) if you are
52
+ # interested in using Retail Search.
53
+ rpc :ImportCompletionData, ::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Google::Longrunning::Operation
54
+ end
55
+
56
+ Stub = Service.rpc_stub_class
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -5,11 +5,13 @@ require 'google/protobuf'
5
5
 
6
6
  require 'google/api/annotations_pb'
7
7
  require 'google/api/field_behavior_pb'
8
+ require 'google/api/resource_pb'
8
9
  require 'google/cloud/retail/v2/product_pb'
9
10
  require 'google/cloud/retail/v2/user_event_pb'
10
11
  require 'google/protobuf/field_mask_pb'
11
12
  require 'google/protobuf/timestamp_pb'
12
13
  require 'google/rpc/status_pb'
14
+ require 'google/type/date_pb'
13
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
14
16
  add_file("google/cloud/retail/v2/import_config.proto", :syntax => :proto3) do
15
17
  add_message "google.cloud.retail.v2.GcsSource" do
@@ -22,6 +24,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
22
24
  optional :table_id, :string, 2
23
25
  optional :gcs_staging_dir, :string, 3
24
26
  optional :data_schema, :string, 4
27
+ oneof :partition do
28
+ optional :partition_date, :message, 6, "google.type.Date"
29
+ end
25
30
  end
26
31
  add_message "google.cloud.retail.v2.ProductInlineSource" do
27
32
  repeated :products, :message, 1, "google.cloud.retail.v2.Product"
@@ -36,15 +41,28 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
36
41
  end
37
42
  add_message "google.cloud.retail.v2.ImportProductsRequest" do
38
43
  optional :parent, :string, 1
44
+ optional :request_id, :string, 6
39
45
  optional :input_config, :message, 2, "google.cloud.retail.v2.ProductInputConfig"
40
46
  optional :errors_config, :message, 3, "google.cloud.retail.v2.ImportErrorsConfig"
41
47
  optional :update_mask, :message, 4, "google.protobuf.FieldMask"
48
+ optional :reconciliation_mode, :enum, 5, "google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode"
49
+ optional :notification_pubsub_topic, :string, 7
50
+ end
51
+ add_enum "google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode" do
52
+ value :RECONCILIATION_MODE_UNSPECIFIED, 0
53
+ value :INCREMENTAL, 1
54
+ value :FULL, 2
42
55
  end
43
56
  add_message "google.cloud.retail.v2.ImportUserEventsRequest" do
44
57
  optional :parent, :string, 1
45
58
  optional :input_config, :message, 2, "google.cloud.retail.v2.UserEventInputConfig"
46
59
  optional :errors_config, :message, 3, "google.cloud.retail.v2.ImportErrorsConfig"
47
60
  end
61
+ add_message "google.cloud.retail.v2.ImportCompletionDataRequest" do
62
+ optional :parent, :string, 1
63
+ optional :input_config, :message, 2, "google.cloud.retail.v2.CompletionDataInputConfig"
64
+ optional :notification_pubsub_topic, :string, 3
65
+ end
48
66
  add_message "google.cloud.retail.v2.ProductInputConfig" do
49
67
  oneof :source do
50
68
  optional :product_inline_source, :message, 1, "google.cloud.retail.v2.ProductInlineSource"
@@ -59,11 +77,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
59
77
  optional :big_query_source, :message, 3, "google.cloud.retail.v2.BigQuerySource"
60
78
  end
61
79
  end
80
+ add_message "google.cloud.retail.v2.CompletionDataInputConfig" do
81
+ oneof :source do
82
+ optional :big_query_source, :message, 1, "google.cloud.retail.v2.BigQuerySource"
83
+ end
84
+ end
62
85
  add_message "google.cloud.retail.v2.ImportMetadata" do
63
86
  optional :create_time, :message, 1, "google.protobuf.Timestamp"
64
87
  optional :update_time, :message, 2, "google.protobuf.Timestamp"
65
88
  optional :success_count, :int64, 3
66
89
  optional :failure_count, :int64, 4
90
+ optional :request_id, :string, 5
91
+ optional :notification_pubsub_topic, :string, 6
67
92
  end
68
93
  add_message "google.cloud.retail.v2.ImportProductsResponse" do
69
94
  repeated :error_samples, :message, 1, "google.rpc.Status"
@@ -78,6 +103,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
78
103
  optional :joined_events_count, :int64, 1
79
104
  optional :unjoined_events_count, :int64, 2
80
105
  end
106
+ add_message "google.cloud.retail.v2.ImportCompletionDataResponse" do
107
+ repeated :error_samples, :message, 1, "google.rpc.Status"
108
+ end
81
109
  end
82
110
  end
83
111
 
@@ -91,13 +119,17 @@ module Google
91
119
  UserEventInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInlineSource").msgclass
92
120
  ImportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportErrorsConfig").msgclass
93
121
  ImportProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest").msgclass
122
+ ImportProductsRequest::ReconciliationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode").enummodule
94
123
  ImportUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsRequest").msgclass
124
+ ImportCompletionDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataRequest").msgclass
95
125
  ProductInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInputConfig").msgclass
96
126
  UserEventInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInputConfig").msgclass
127
+ CompletionDataInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionDataInputConfig").msgclass
97
128
  ImportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportMetadata").msgclass
98
129
  ImportProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsResponse").msgclass
99
130
  ImportUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsResponse").msgclass
100
131
  UserEventImportSummary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventImportSummary").msgclass
132
+ ImportCompletionDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataResponse").msgclass
101
133
  end
102
134
  end
103
135
  end
@@ -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
@@ -179,30 +176,10 @@ module Google
179
176
  # @param placement [::String]
180
177
  # Required. Full resource name of the format:
181
178
  # \\{name=projects/*/locations/global/catalogs/default_catalog/placements/*}
182
- # The id of the recommendation engine placement. This id is used to identify
183
- # the set of models that will be used to make the prediction.
184
- #
185
- # We currently support three placements with the following IDs by default:
186
- #
187
- # * `shopping_cart`: Predicts products frequently bought together with one or
188
- # more products in the same shopping session. Commonly displayed after
189
- # `add-to-cart` events, on product detail pages, or on the shopping cart
190
- # page.
191
- #
192
- # * `home_page`: Predicts the next product that a user will most likely
193
- # engage with or purchase based on the shopping or viewing history of the
194
- # specified `userId` or `visitorId`. For example - Recommendations for you.
195
- #
196
- # * `product_detail`: Predicts the next product that a user will most likely
197
- # engage with or purchase. The prediction is based on the shopping or
198
- # viewing history of the specified `userId` or `visitorId` and its
199
- # relevance to a specified `CatalogItem`. Typically used on product detail
200
- # pages. For example - More products like this.
201
- #
202
- # * `recently_viewed_default`: Returns up to 75 products recently viewed by
203
- # the specified `userId` or `visitorId`, most recent ones first. Returns
204
- # nothing if neither of them has viewed any products yet. For example -
205
- # Recently viewed.
179
+ # The ID of the Recommendations AI placement. Before you can request
180
+ # predictions from your model, you must create at least one placement for it.
181
+ # For more information, see [Managing
182
+ # placements](https://cloud.google.com/retail/recommendations-ai/docs/manage-placements).
206
183
  #
207
184
  # The full list of available placements can be seen at
208
185
  # https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements
@@ -229,6 +206,9 @@ module Google
229
206
  # `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
230
207
  # with a size limit of 1,000 characters.
231
208
  #
209
+ # Note: "Recently viewed" models don't support tag filtering at the
210
+ # moment.
211
+ #
232
212
  # * filterOutOfStockItems. Restricts predictions to products that do not
233
213
  # have a
234
214
  # stockState value of OUT_OF_STOCK.
@@ -263,16 +243,34 @@ module Google
263
243
  # * `strictFiltering`: Boolean. True by default. If set to false, the service
264
244
  # will return generic (unfiltered) popular products instead of empty if
265
245
  # your filter blocks all prediction results.
246
+ # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
247
+ # it needs to be one of {'no-price-reranking', 'low-price-reranking',
248
+ # 'medium-price-reranking', 'high-price-reranking'}. This gives
249
+ # request-level control and adjusts prediction results based on product
250
+ # price.
251
+ # * `diversityLevel`: String. Default empty. If set to be non-empty, then
252
+ # it needs to be one of {'no-diversity', 'low-diversity',
253
+ # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
254
+ # request-level control and adjusts prediction results based on product
255
+ # category.
266
256
  # @param labels [::Hash{::String => ::String}]
267
- # The labels for the predict request.
268
- #
269
- # * Label keys can contain lowercase letters, digits and hyphens, must start
270
- # with a letter, and must end with a letter or digit.
271
- # * Non-zero label values can contain lowercase letters, digits and hyphens,
272
- # must start with a letter, and must end with a letter or digit.
273
- # * No more than 64 labels can be associated with a given request.
274
- #
275
- # See https://goo.gl/xmQnxf for more information on and examples of labels.
257
+ # The labels applied to a resource must meet the following requirements:
258
+ #
259
+ # * Each resource can have multiple labels, up to a maximum of 64.
260
+ # * Each label must be a key-value pair.
261
+ # * Keys have a minimum length of 1 character and a maximum length of 63
262
+ # characters, and cannot be empty. Values can be empty, and have a maximum
263
+ # length of 63 characters.
264
+ # * Keys and values can contain only lowercase letters, numeric characters,
265
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
266
+ # international characters are allowed.
267
+ # * The key portion of a label must be unique. However, you can use the same
268
+ # key with multiple resources.
269
+ # * Keys must start with a lowercase letter or international character.
270
+ #
271
+ # See [Google Cloud
272
+ # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
273
+ # for more details.
276
274
  #
277
275
  # @yield [response, operation] Access the result along with the RPC operation
278
276
  # @yieldparam response [::Google::Cloud::Retail::V2::PredictResponse]
@@ -7,6 +7,7 @@ require 'google/api/annotations_pb'
7
7
  require 'google/api/field_behavior_pb'
8
8
  require 'google/api/resource_pb'
9
9
  require 'google/cloud/retail/v2/common_pb'
10
+ require 'google/protobuf/duration_pb'
10
11
  require 'google/protobuf/field_mask_pb'
11
12
  require 'google/protobuf/timestamp_pb'
12
13
  require 'google/protobuf/wrappers_pb'
@@ -17,17 +18,37 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
17
18
  optional :id, :string, 2
18
19
  optional :type, :enum, 3, "google.cloud.retail.v2.Product.Type"
19
20
  optional :primary_product_id, :string, 4
21
+ repeated :collection_member_ids, :string, 5
22
+ optional :gtin, :string, 6
20
23
  repeated :categories, :string, 7
21
24
  optional :title, :string, 8
25
+ repeated :brands, :string, 9
22
26
  optional :description, :string, 10
27
+ optional :language_code, :string, 11
23
28
  map :attributes, :string, :message, 12, "google.cloud.retail.v2.CustomAttribute"
24
29
  repeated :tags, :string, 13
25
30
  optional :price_info, :message, 14, "google.cloud.retail.v2.PriceInfo"
31
+ optional :rating, :message, 15, "google.cloud.retail.v2.Rating"
26
32
  optional :available_time, :message, 18, "google.protobuf.Timestamp"
27
33
  optional :availability, :enum, 19, "google.cloud.retail.v2.Product.Availability"
28
34
  optional :available_quantity, :message, 20, "google.protobuf.Int32Value"
35
+ repeated :fulfillment_info, :message, 21, "google.cloud.retail.v2.FulfillmentInfo"
29
36
  optional :uri, :string, 22
30
37
  repeated :images, :message, 23, "google.cloud.retail.v2.Image"
38
+ optional :audience, :message, 24, "google.cloud.retail.v2.Audience"
39
+ optional :color_info, :message, 25, "google.cloud.retail.v2.ColorInfo"
40
+ repeated :sizes, :string, 26
41
+ repeated :materials, :string, 27
42
+ repeated :patterns, :string, 28
43
+ repeated :conditions, :string, 29
44
+ repeated :promotions, :message, 34, "google.cloud.retail.v2.Promotion"
45
+ optional :publish_time, :message, 33, "google.protobuf.Timestamp"
46
+ optional :retrievable_fields, :message, 30, "google.protobuf.FieldMask"
47
+ repeated :variants, :message, 31, "google.cloud.retail.v2.Product"
48
+ oneof :expiration do
49
+ optional :expire_time, :message, 16, "google.protobuf.Timestamp"
50
+ optional :ttl, :message, 17, "google.protobuf.Duration"
51
+ end
31
52
  end
32
53
  add_enum "google.cloud.retail.v2.Product.Type" do
33
54
  value :TYPE_UNSPECIFIED, 0
@@ -68,10 +68,7 @@ module Google
68
68
 
69
69
  default_config.timeout = 60.0
70
70
  default_config.retry_policy = {
71
- initial_delay: 0.1,
72
- max_delay: 60.0,
73
- multiplier: 1.3,
74
- retry_codes: [14, 4]
71
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
75
72
  }
76
73
 
77
74
  default_config
@@ -142,7 +139,7 @@ module Google
142
139
  !@config.endpoint.split(".").first.include?("-")
143
140
  credentials ||= Credentials.default scope: @config.scope,
144
141
  enable_self_signed_jwt: enable_self_signed_jwt
145
- if credentials.is_a?(String) || credentials.is_a?(Hash)
142
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
143
  credentials = Credentials.new credentials, scope: @config.scope
147
144
  end
148
145
  @quota_project_id = @config.quota_project
@@ -331,6 +328,144 @@ module Google
331
328
  raise ::Google::Cloud::Error.from_error(e)
332
329
  end
333
330
 
331
+ ##
332
+ # Gets a list of {::Google::Cloud::Retail::V2::Product Product}s.
333
+ #
334
+ # @overload list_products(request, options = nil)
335
+ # Pass arguments to `list_products` via a request object, either of type
336
+ # {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash.
337
+ #
338
+ # @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash]
339
+ # A request object representing the call parameters. Required. To specify no
340
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
341
+ # @param options [::Gapic::CallOptions, ::Hash]
342
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
343
+ #
344
+ # @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil)
345
+ # Pass arguments to `list_products` via keyword arguments. Note that at
346
+ # least one keyword argument is required. To specify no parameters, or to keep all
347
+ # the default parameter values, pass an empty Hash as a request object (see above).
348
+ #
349
+ # @param parent [::String]
350
+ # Required. The parent branch resource name, such as
351
+ # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
352
+ # `default_branch` as the branch ID, to list products under the default
353
+ # branch.
354
+ #
355
+ # If the caller does not have permission to list
356
+ # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of
357
+ # whether or not this branch exists, a PERMISSION_DENIED error is returned.
358
+ # @param page_size [::Integer]
359
+ # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If
360
+ # unspecified, defaults to 100. The maximum allowed value is 1000. Values
361
+ # above 1000 will be coerced to 1000.
362
+ #
363
+ # If this field is negative, an INVALID_ARGUMENT error is returned.
364
+ # @param page_token [::String]
365
+ # A page token
366
+ # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token},
367
+ # received from a previous
368
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}
369
+ # call. Provide this to retrieve the subsequent page.
370
+ #
371
+ # When paginating, all other parameters provided to
372
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}
373
+ # must match the call that provided the page token. Otherwise, an
374
+ # INVALID_ARGUMENT error is returned.
375
+ # @param filter [::String]
376
+ # A filter to apply on the list results. Supported features:
377
+ #
378
+ # * List all the products under the parent branch if
379
+ # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset.
380
+ # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT}
381
+ # {::Google::Cloud::Retail::V2::Product Product}s sharing the same
382
+ # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
383
+ # {::Google::Cloud::Retail::V2::Product Product}. For example:
384
+ # `primary_product_id = "some_product_id"`
385
+ # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a
386
+ # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
387
+ # {::Google::Cloud::Retail::V2::Product Product}.
388
+ # For example:
389
+ # `collection_product_id = "some_product_id"`
390
+ # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type.
391
+ # For example:
392
+ # `type = "PRIMARY"`
393
+ # `type = "VARIANT"`
394
+ # `type = "COLLECTION"`
395
+ #
396
+ # If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
397
+ #
398
+ # If the specified
399
+ # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
400
+ # {::Google::Cloud::Retail::V2::Product Product} or
401
+ # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
402
+ # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error
403
+ # is returned.
404
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
405
+ # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the
406
+ # responses. If not set or empty, the following fields are returned:
407
+ #
408
+ # * {::Google::Cloud::Retail::V2::Product#name Product.name}
409
+ # * {::Google::Cloud::Retail::V2::Product#id Product.id}
410
+ # * {::Google::Cloud::Retail::V2::Product#title Product.title}
411
+ # * {::Google::Cloud::Retail::V2::Product#uri Product.uri}
412
+ # * {::Google::Cloud::Retail::V2::Product#images Product.images}
413
+ # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
414
+ # * {::Google::Cloud::Retail::V2::Product#brands Product.brands}
415
+ #
416
+ # If "*" is provided, all fields are returned.
417
+ # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no
418
+ # matter what mask is set.
419
+ #
420
+ # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
421
+ # is returned.
422
+ #
423
+ # @yield [response, operation] Access the result along with the RPC operation
424
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>]
425
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
426
+ #
427
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>]
428
+ #
429
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
430
+ #
431
+ def list_products request, options = nil
432
+ raise ::ArgumentError, "request must be provided" if request.nil?
433
+
434
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest
435
+
436
+ # Converts hash and nil to an options object
437
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
438
+
439
+ # Customize the options with defaults
440
+ metadata = @config.rpcs.list_products.metadata.to_h
441
+
442
+ # Set x-goog-api-client and x-goog-user-project headers
443
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
444
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
445
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
446
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
447
+
448
+ header_params = {
449
+ "parent" => request.parent
450
+ }
451
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
452
+ metadata[:"x-goog-request-params"] ||= request_params_header
453
+
454
+ options.apply_defaults timeout: @config.rpcs.list_products.timeout,
455
+ metadata: metadata,
456
+ retry_policy: @config.rpcs.list_products.retry_policy
457
+ options.apply_defaults metadata: @config.metadata,
458
+ retry_policy: @config.retry_policy
459
+
460
+ @product_service_stub.call_rpc :list_products, request, options: options do |response, operation|
461
+ response = ::Gapic::PagedEnumerable.new @product_service_stub, :list_products, request, response, operation, options
462
+ yield response, operation if block_given?
463
+ return response
464
+ end
465
+ rescue ::GRPC::BadStatus => e
466
+ raise ::Google::Cloud::Error.from_error(e)
467
+ end
468
+
334
469
  ##
335
470
  # Updates a {::Google::Cloud::Retail::V2::Product Product}.
336
471
  #
@@ -344,7 +479,7 @@ module Google
344
479
  # @param options [::Gapic::CallOptions, ::Hash]
345
480
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
346
481
  #
347
- # @overload update_product(product: nil, update_mask: nil)
482
+ # @overload update_product(product: nil, update_mask: nil, allow_missing: nil)
348
483
  # Pass arguments to `update_product` via keyword arguments. Note that at
349
484
  # least one keyword argument is required. To specify no parameters, or to keep all
350
485
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -356,8 +491,10 @@ module Google
356
491
  # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
357
492
  # exists, a PERMISSION_DENIED error is returned.
358
493
  #
359
- # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist,
360
- # a NOT_FOUND error is returned.
494
+ # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist
495
+ # and
496
+ # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing}
497
+ # is not set, a NOT_FOUND error is returned.
361
498
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
362
499
  # Indicates which fields in the provided
363
500
  # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and
@@ -366,6 +503,10 @@ module Google
366
503
  #
367
504
  # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
368
505
  # is returned.
506
+ # @param allow_missing [::Boolean]
507
+ # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
508
+ # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In
509
+ # this situation, `update_mask` is ignored.
369
510
  #
370
511
  # @yield [response, operation] Access the result along with the RPC operation
371
512
  # @yieldparam response [::Google::Cloud::Retail::V2::Product]
@@ -442,6 +583,17 @@ module Google
442
583
  # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist,
443
584
  # a NOT_FOUND error is returned.
444
585
  #
586
+ # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a
587
+ # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION}
588
+ # {::Google::Cloud::Retail::V2::Product Product} member nor a
589
+ # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY}
590
+ # {::Google::Cloud::Retail::V2::Product Product} with more than one
591
+ # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an
592
+ # INVALID_ARGUMENT error is returned.
593
+ #
594
+ # All inventory information for the named
595
+ # {::Google::Cloud::Retail::V2::Product Product} will be deleted.
596
+ #
445
597
  # @yield [response, operation] Access the result along with the RPC operation
446
598
  # @yieldparam response [::Google::Protobuf::Empty]
447
599
  # @yieldparam operation [::GRPC::ActiveCall::Operation]
@@ -506,7 +658,7 @@ module Google
506
658
  # @param options [::Gapic::CallOptions, ::Hash]
507
659
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
508
660
  #
509
- # @overload import_products(parent: nil, input_config: nil, errors_config: nil, update_mask: nil)
661
+ # @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil)
510
662
  # Pass arguments to `import_products` via keyword arguments. Note that at
511
663
  # least one keyword argument is required. To specify no parameters, or to keep all
512
664
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -517,6 +669,16 @@ module Google
517
669
  #
518
670
  # If no updateMask is specified, requires products.create permission.
519
671
  # If updateMask is specified, requires products.update permission.
672
+ # @param request_id [::String]
673
+ # Unique identifier provided by client, within the ancestor
674
+ # dataset scope. Ensures idempotency and used for request deduplication.
675
+ # Server-generated if unspecified. Up to 128 characters long and must match
676
+ # the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in
677
+ # {::Google::Cloud::Retail::V2::ImportMetadata ImportMetadata}.
678
+ #
679
+ # Only supported when
680
+ # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode}
681
+ # is set to `FULL`.
520
682
  # @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash]
521
683
  # Required. The desired input location of the data.
522
684
  # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
@@ -524,6 +686,20 @@ module Google
524
686
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
525
687
  # Indicates which fields in the provided imported 'products' to update. If
526
688
  # not set, will by default update all fields.
689
+ # @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode]
690
+ # The mode of reconciliation between existing products and the products to be
691
+ # imported. Defaults to
692
+ # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
693
+ # @param notification_pubsub_topic [::String]
694
+ # Pub/Sub topic for receiving notification. If this field is set,
695
+ # when the import is finished, a notification will be sent to
696
+ # specified Pub/Sub topic. The message data will be JSON string of a
697
+ # {::Google::Longrunning::Operation Operation}.
698
+ # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
699
+ #
700
+ # Only supported when
701
+ # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode}
702
+ # is set to `FULL`.
527
703
  #
528
704
  # @yield [response, operation] Access the result along with the RPC operation
529
705
  # @yieldparam response [::Gapic::Operation]
@@ -571,6 +747,427 @@ module Google
571
747
  raise ::Google::Cloud::Error.from_error(e)
572
748
  end
573
749
 
750
+ ##
751
+ # Updates inventory information for a
752
+ # {::Google::Cloud::Retail::V2::Product Product} while respecting the last update
753
+ # timestamps of each inventory field.
754
+ #
755
+ # This process is asynchronous and does not require the
756
+ # {::Google::Cloud::Retail::V2::Product Product} to exist before updating
757
+ # fulfillment information. If the request is valid, the update will be
758
+ # enqueued and processed downstream. As a consequence, when a response is
759
+ # returned, updates are not immediately manifested in the
760
+ # {::Google::Cloud::Retail::V2::Product Product} queried by
761
+ # {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
762
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
763
+ #
764
+ # When inventory is updated with
765
+ # {::Google::Cloud::Retail::V2::ProductService::Client#create_product CreateProduct} and
766
+ # {::Google::Cloud::Retail::V2::ProductService::Client#update_product UpdateProduct}, the
767
+ # specified inventory field value(s) will overwrite any existing value(s)
768
+ # while ignoring the last update time for this field. Furthermore, the last
769
+ # update time for the specified inventory fields will be overwritten to the
770
+ # time of the
771
+ # {::Google::Cloud::Retail::V2::ProductService::Client#create_product CreateProduct} or
772
+ # {::Google::Cloud::Retail::V2::ProductService::Client#update_product UpdateProduct}
773
+ # request.
774
+ #
775
+ # If no inventory fields are set in
776
+ # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product},
777
+ # then any pre-existing inventory information for this product will be used.
778
+ #
779
+ # If no inventory fields are set in [UpdateProductRequest.set_mask][],
780
+ # then any existing inventory information will be preserved.
781
+ #
782
+ # Pre-existing inventory information can only be updated with
783
+ # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory SetInventory},
784
+ # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places AddFulfillmentPlaces},
785
+ # and
786
+ # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places RemoveFulfillmentPlaces}.
787
+ #
788
+ # This feature is only available for users who have Retail Search enabled.
789
+ # Contact Retail Support (retail-search-support@google.com) if you are
790
+ # interested in using Retail Search.
791
+ #
792
+ # @overload set_inventory(request, options = nil)
793
+ # Pass arguments to `set_inventory` via a request object, either of type
794
+ # {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash.
795
+ #
796
+ # @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash]
797
+ # A request object representing the call parameters. Required. To specify no
798
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
799
+ # @param options [::Gapic::CallOptions, ::Hash]
800
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
801
+ #
802
+ # @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil)
803
+ # Pass arguments to `set_inventory` via keyword arguments. Note that at
804
+ # least one keyword argument is required. To specify no parameters, or to keep all
805
+ # the default parameter values, pass an empty Hash as a request object (see above).
806
+ #
807
+ # @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash]
808
+ # Required. The inventory information to update. The allowable fields to
809
+ # update are:
810
+ # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
811
+ # * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
812
+ # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity}
813
+ # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info}
814
+ # The updated inventory fields must be specified in
815
+ # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}.
816
+ #
817
+ # If [SetInventoryRequest.inventory.name][] is empty or invalid, an
818
+ # INVALID_ARGUMENT error is returned.
819
+ #
820
+ # If the caller does not have permission to update the
821
+ # {::Google::Cloud::Retail::V2::Product Product} named in
822
+ # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether
823
+ # or not it exists, a PERMISSION_DENIED error is returned.
824
+ #
825
+ # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have
826
+ # existing inventory information, the provided inventory information will be
827
+ # inserted.
828
+ #
829
+ # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing
830
+ # inventory information, the provided inventory information will be merged
831
+ # while respecting the last update time for each inventory field, using the
832
+ # provided or default value for
833
+ # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}.
834
+ #
835
+ # The last update time is recorded for the following inventory fields:
836
+ # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
837
+ # * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
838
+ # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity}
839
+ # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info}
840
+ #
841
+ # If a full overwrite of inventory information while ignoring timestamps is
842
+ # needed, [UpdateProduct][] should be invoked instead.
843
+ # @param set_mask [::Google::Protobuf::FieldMask, ::Hash]
844
+ # Indicates which inventory fields in the provided
845
+ # {::Google::Cloud::Retail::V2::Product Product} to update. If not set or set with
846
+ # empty paths, all inventory fields will be updated.
847
+ #
848
+ # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
849
+ # is returned and the entire update will be ignored.
850
+ # @param set_time [::Google::Protobuf::Timestamp, ::Hash]
851
+ # The time when the request is issued, used to prevent
852
+ # out-of-order updates on inventory fields with the last update time
853
+ # recorded. If not provided, the internal system time will be used.
854
+ # @param allow_missing [::Boolean]
855
+ # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name
856
+ # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the
857
+ # inventory update will still be processed and retained for at most 1 day
858
+ # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to
859
+ # false, an INVALID_ARGUMENT error is returned if the
860
+ # {::Google::Cloud::Retail::V2::Product Product} is not found.
861
+ #
862
+ # @yield [response, operation] Access the result along with the RPC operation
863
+ # @yieldparam response [::Gapic::Operation]
864
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
865
+ #
866
+ # @return [::Gapic::Operation]
867
+ #
868
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
869
+ #
870
+ def set_inventory request, options = nil
871
+ raise ::ArgumentError, "request must be provided" if request.nil?
872
+
873
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest
874
+
875
+ # Converts hash and nil to an options object
876
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
877
+
878
+ # Customize the options with defaults
879
+ metadata = @config.rpcs.set_inventory.metadata.to_h
880
+
881
+ # Set x-goog-api-client and x-goog-user-project headers
882
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
883
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
884
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
885
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
886
+
887
+ header_params = {
888
+ "inventory.name" => request.inventory.name
889
+ }
890
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
891
+ metadata[:"x-goog-request-params"] ||= request_params_header
892
+
893
+ options.apply_defaults timeout: @config.rpcs.set_inventory.timeout,
894
+ metadata: metadata,
895
+ retry_policy: @config.rpcs.set_inventory.retry_policy
896
+ options.apply_defaults metadata: @config.metadata,
897
+ retry_policy: @config.retry_policy
898
+
899
+ @product_service_stub.call_rpc :set_inventory, request, options: options do |response, operation|
900
+ response = ::Gapic::Operation.new response, @operations_client, options: options
901
+ yield response, operation if block_given?
902
+ return response
903
+ end
904
+ rescue ::GRPC::BadStatus => e
905
+ raise ::Google::Cloud::Error.from_error(e)
906
+ end
907
+
908
+ ##
909
+ # Incrementally adds place IDs to
910
+ # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}.
911
+ #
912
+ # This process is asynchronous and does not require the
913
+ # {::Google::Cloud::Retail::V2::Product Product} to exist before updating
914
+ # fulfillment information. If the request is valid, the update will be
915
+ # enqueued and processed downstream. As a consequence, when a response is
916
+ # returned, the added place IDs are not immediately manifested in the
917
+ # {::Google::Cloud::Retail::V2::Product Product} queried by
918
+ # {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
919
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
920
+ #
921
+ # This feature is only available for users who have Retail Search enabled.
922
+ # Contact Retail Support (retail-search-support@google.com) if you are
923
+ # interested in using Retail Search.
924
+ #
925
+ # @overload add_fulfillment_places(request, options = nil)
926
+ # Pass arguments to `add_fulfillment_places` via a request object, either of type
927
+ # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash.
928
+ #
929
+ # @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash]
930
+ # A request object representing the call parameters. Required. To specify no
931
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
932
+ # @param options [::Gapic::CallOptions, ::Hash]
933
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
934
+ #
935
+ # @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil)
936
+ # Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at
937
+ # least one keyword argument is required. To specify no parameters, or to keep all
938
+ # the default parameter values, pass an empty Hash as a request object (see above).
939
+ #
940
+ # @param product [::String]
941
+ # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
942
+ # such as
943
+ # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
944
+ #
945
+ # If the caller does not have permission to access the
946
+ # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
947
+ # exists, a PERMISSION_DENIED error is returned.
948
+ # @param type [::String]
949
+ # Required. The fulfillment type, including commonly used types (such as
950
+ # pickup in store and same day delivery), and custom types.
951
+ #
952
+ # Supported values:
953
+ #
954
+ # * "pickup-in-store"
955
+ # * "ship-to-store"
956
+ # * "same-day-delivery"
957
+ # * "next-day-delivery"
958
+ # * "custom-type-1"
959
+ # * "custom-type-2"
960
+ # * "custom-type-3"
961
+ # * "custom-type-4"
962
+ # * "custom-type-5"
963
+ #
964
+ # If this field is set to an invalid value other than these, an
965
+ # INVALID_ARGUMENT error is returned.
966
+ #
967
+ # This field directly corresponds to [Product.fulfillment_info.type][].
968
+ # @param place_ids [::Array<::String>]
969
+ # Required. The IDs for this
970
+ # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as
971
+ # the store IDs for "pickup-in-store" or the region IDs for
972
+ # "same-day-delivery" to be added for this
973
+ # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate
974
+ # IDs will be automatically ignored.
975
+ #
976
+ # At least 1 value is required, and a maximum of 2000 values are allowed.
977
+ # Each value must be a string with a length limit of 10 characters, matching
978
+ # the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an
979
+ # INVALID_ARGUMENT error is returned.
980
+ #
981
+ # If the total number of place IDs exceeds 2000 for this
982
+ # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after
983
+ # adding, then the update will be rejected.
984
+ # @param add_time [::Google::Protobuf::Timestamp, ::Hash]
985
+ # The time when the fulfillment updates are issued, used to prevent
986
+ # out-of-order updates on fulfillment information. If not provided, the
987
+ # internal system time will be used.
988
+ # @param allow_missing [::Boolean]
989
+ # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
990
+ # found, the fulfillment information will still be processed and retained for
991
+ # at most 1 day and processed once the
992
+ # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, an
993
+ # INVALID_ARGUMENT error is returned if the
994
+ # {::Google::Cloud::Retail::V2::Product Product} is not found.
995
+ #
996
+ # @yield [response, operation] Access the result along with the RPC operation
997
+ # @yieldparam response [::Gapic::Operation]
998
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
999
+ #
1000
+ # @return [::Gapic::Operation]
1001
+ #
1002
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1003
+ #
1004
+ def add_fulfillment_places request, options = nil
1005
+ raise ::ArgumentError, "request must be provided" if request.nil?
1006
+
1007
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest
1008
+
1009
+ # Converts hash and nil to an options object
1010
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1011
+
1012
+ # Customize the options with defaults
1013
+ metadata = @config.rpcs.add_fulfillment_places.metadata.to_h
1014
+
1015
+ # Set x-goog-api-client and x-goog-user-project headers
1016
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1017
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1018
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
1019
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1020
+
1021
+ header_params = {
1022
+ "product" => request.product
1023
+ }
1024
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1025
+ metadata[:"x-goog-request-params"] ||= request_params_header
1026
+
1027
+ options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout,
1028
+ metadata: metadata,
1029
+ retry_policy: @config.rpcs.add_fulfillment_places.retry_policy
1030
+ options.apply_defaults metadata: @config.metadata,
1031
+ retry_policy: @config.retry_policy
1032
+
1033
+ @product_service_stub.call_rpc :add_fulfillment_places, request, options: options do |response, operation|
1034
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1035
+ yield response, operation if block_given?
1036
+ return response
1037
+ end
1038
+ rescue ::GRPC::BadStatus => e
1039
+ raise ::Google::Cloud::Error.from_error(e)
1040
+ end
1041
+
1042
+ ##
1043
+ # Incrementally removes place IDs from a
1044
+ # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}.
1045
+ #
1046
+ # This process is asynchronous and does not require the
1047
+ # {::Google::Cloud::Retail::V2::Product Product} to exist before updating
1048
+ # fulfillment information. If the request is valid, the update will be
1049
+ # enqueued and processed downstream. As a consequence, when a response is
1050
+ # returned, the removed place IDs are not immediately manifested in the
1051
+ # {::Google::Cloud::Retail::V2::Product Product} queried by
1052
+ # {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
1053
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
1054
+ #
1055
+ # This feature is only available for users who have Retail Search enabled.
1056
+ # Contact Retail Support (retail-search-support@google.com) if you are
1057
+ # interested in using Retail Search.
1058
+ #
1059
+ # @overload remove_fulfillment_places(request, options = nil)
1060
+ # Pass arguments to `remove_fulfillment_places` via a request object, either of type
1061
+ # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash.
1062
+ #
1063
+ # @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash]
1064
+ # A request object representing the call parameters. Required. To specify no
1065
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1066
+ # @param options [::Gapic::CallOptions, ::Hash]
1067
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1068
+ #
1069
+ # @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil)
1070
+ # Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at
1071
+ # least one keyword argument is required. To specify no parameters, or to keep all
1072
+ # the default parameter values, pass an empty Hash as a request object (see above).
1073
+ #
1074
+ # @param product [::String]
1075
+ # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
1076
+ # such as
1077
+ # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
1078
+ #
1079
+ # If the caller does not have permission to access the
1080
+ # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
1081
+ # exists, a PERMISSION_DENIED error is returned.
1082
+ # @param type [::String]
1083
+ # Required. The fulfillment type, including commonly used types (such as
1084
+ # pickup in store and same day delivery), and custom types.
1085
+ #
1086
+ # Supported values:
1087
+ #
1088
+ # * "pickup-in-store"
1089
+ # * "ship-to-store"
1090
+ # * "same-day-delivery"
1091
+ # * "next-day-delivery"
1092
+ # * "custom-type-1"
1093
+ # * "custom-type-2"
1094
+ # * "custom-type-3"
1095
+ # * "custom-type-4"
1096
+ # * "custom-type-5"
1097
+ #
1098
+ # If this field is set to an invalid value other than these, an
1099
+ # INVALID_ARGUMENT error is returned.
1100
+ #
1101
+ # This field directly corresponds to [Product.fulfillment_info.type][].
1102
+ # @param place_ids [::Array<::String>]
1103
+ # Required. The IDs for this
1104
+ # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as
1105
+ # the store IDs for "pickup-in-store" or the region IDs for
1106
+ # "same-day-delivery", to be removed for this
1107
+ # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}.
1108
+ #
1109
+ # At least 1 value is required, and a maximum of 2000 values are allowed.
1110
+ # Each value must be a string with a length limit of 10 characters, matching
1111
+ # the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an
1112
+ # INVALID_ARGUMENT error is returned.
1113
+ # @param remove_time [::Google::Protobuf::Timestamp, ::Hash]
1114
+ # The time when the fulfillment updates are issued, used to prevent
1115
+ # out-of-order updates on fulfillment information. If not provided, the
1116
+ # internal system time will be used.
1117
+ # @param allow_missing [::Boolean]
1118
+ # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
1119
+ # found, the fulfillment information will still be processed and retained for
1120
+ # at most 1 day and processed once the
1121
+ # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, an
1122
+ # INVALID_ARGUMENT error is returned if the
1123
+ # {::Google::Cloud::Retail::V2::Product Product} is not found.
1124
+ #
1125
+ # @yield [response, operation] Access the result along with the RPC operation
1126
+ # @yieldparam response [::Gapic::Operation]
1127
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1128
+ #
1129
+ # @return [::Gapic::Operation]
1130
+ #
1131
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1132
+ #
1133
+ def remove_fulfillment_places request, options = nil
1134
+ raise ::ArgumentError, "request must be provided" if request.nil?
1135
+
1136
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest
1137
+
1138
+ # Converts hash and nil to an options object
1139
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1140
+
1141
+ # Customize the options with defaults
1142
+ metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h
1143
+
1144
+ # Set x-goog-api-client and x-goog-user-project headers
1145
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1146
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1147
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
1148
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1149
+
1150
+ header_params = {
1151
+ "product" => request.product
1152
+ }
1153
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1154
+ metadata[:"x-goog-request-params"] ||= request_params_header
1155
+
1156
+ options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout,
1157
+ metadata: metadata,
1158
+ retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy
1159
+ options.apply_defaults metadata: @config.metadata,
1160
+ retry_policy: @config.retry_policy
1161
+
1162
+ @product_service_stub.call_rpc :remove_fulfillment_places, request, options: options do |response, operation|
1163
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1164
+ yield response, operation if block_given?
1165
+ return response
1166
+ end
1167
+ rescue ::GRPC::BadStatus => e
1168
+ raise ::Google::Cloud::Error.from_error(e)
1169
+ end
1170
+
574
1171
  ##
575
1172
  # Configuration class for the ProductService API.
576
1173
  #
@@ -718,6 +1315,11 @@ module Google
718
1315
  #
719
1316
  attr_reader :get_product
720
1317
  ##
1318
+ # RPC-specific configuration for `list_products`
1319
+ # @return [::Gapic::Config::Method]
1320
+ #
1321
+ attr_reader :list_products
1322
+ ##
721
1323
  # RPC-specific configuration for `update_product`
722
1324
  # @return [::Gapic::Config::Method]
723
1325
  #
@@ -732,6 +1334,21 @@ module Google
732
1334
  # @return [::Gapic::Config::Method]
733
1335
  #
734
1336
  attr_reader :import_products
1337
+ ##
1338
+ # RPC-specific configuration for `set_inventory`
1339
+ # @return [::Gapic::Config::Method]
1340
+ #
1341
+ attr_reader :set_inventory
1342
+ ##
1343
+ # RPC-specific configuration for `add_fulfillment_places`
1344
+ # @return [::Gapic::Config::Method]
1345
+ #
1346
+ attr_reader :add_fulfillment_places
1347
+ ##
1348
+ # RPC-specific configuration for `remove_fulfillment_places`
1349
+ # @return [::Gapic::Config::Method]
1350
+ #
1351
+ attr_reader :remove_fulfillment_places
735
1352
 
736
1353
  # @private
737
1354
  def initialize parent_rpcs = nil
@@ -739,12 +1356,20 @@ module Google
739
1356
  @create_product = ::Gapic::Config::Method.new create_product_config
740
1357
  get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
741
1358
  @get_product = ::Gapic::Config::Method.new get_product_config
1359
+ list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
1360
+ @list_products = ::Gapic::Config::Method.new list_products_config
742
1361
  update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
743
1362
  @update_product = ::Gapic::Config::Method.new update_product_config
744
1363
  delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
745
1364
  @delete_product = ::Gapic::Config::Method.new delete_product_config
746
1365
  import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products
747
1366
  @import_products = ::Gapic::Config::Method.new import_products_config
1367
+ set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory
1368
+ @set_inventory = ::Gapic::Config::Method.new set_inventory_config
1369
+ add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places
1370
+ @add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config
1371
+ remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places
1372
+ @remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config
748
1373
 
749
1374
  yield self if block_given?
750
1375
  end