google-apis-retail_v2alpha 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,776 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module RetailV2alpha
23
+ # Retail API
24
+ #
25
+ # Cloud Retail service enables customers to build end-to-end personalized
26
+ # recommendation systems without requiring a high level of expertise in machine
27
+ # learning, recommendation system, or Google Cloud.
28
+ #
29
+ # @example
30
+ # require 'google/apis/retail_v2alpha'
31
+ #
32
+ # Retail = Google::Apis::RetailV2alpha # Alias the module
33
+ # service = Retail::CloudRetailService.new
34
+ #
35
+ # @see https://cloud.google.com/recommendations
36
+ class CloudRetailService < Google::Apis::Core::BaseService
37
+ # @return [String]
38
+ # API key. Your API key identifies your project and provides you with API access,
39
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
40
+ attr_accessor :key
41
+
42
+ # @return [String]
43
+ # Available to use for quota purposes for server-side applications. Can be any
44
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
45
+ attr_accessor :quota_user
46
+
47
+ def initialize
48
+ super('https://retail.googleapis.com/', '',
49
+ client_name: 'google-apis-retail_v2alpha',
50
+ client_version: Google::Apis::RetailV2alpha::GEM_VERSION)
51
+ @batch_path = 'batch'
52
+ end
53
+
54
+ # Lists all the Catalogs associated with the project.
55
+ # @param [String] parent
56
+ # Required. The account resource name with an associated location. If the caller
57
+ # does not have permission to list Catalogs under this location, regardless of
58
+ # whether or not this location exists, a PERMISSION_DENIED error is returned.
59
+ # @param [Fixnum] page_size
60
+ # Maximum number of Catalogs to return. If unspecified, defaults to 50. The
61
+ # maximum allowed value is 1000. Values above 1000 will be coerced to 1000. If
62
+ # this field is negative, an INVALID_ARGUMENT is returned.
63
+ # @param [String] page_token
64
+ # A page token ListCatalogsResponse.next_page_token, received from a previous
65
+ # CatalogService.ListCatalogs call. Provide this to retrieve the subsequent page.
66
+ # When paginating, all other parameters provided to CatalogService.ListCatalogs
67
+ # must match the call that provided the page token. Otherwise, an
68
+ # INVALID_ARGUMENT error is returned.
69
+ # @param [String] fields
70
+ # Selector specifying which fields to include in a partial response.
71
+ # @param [String] quota_user
72
+ # Available to use for quota purposes for server-side applications. Can be any
73
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
74
+ # @param [Google::Apis::RequestOptions] options
75
+ # Request-specific options
76
+ #
77
+ # @yield [result, err] Result & error if block supplied
78
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaListCatalogsResponse] parsed result object
79
+ # @yieldparam err [StandardError] error object if request failed
80
+ #
81
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaListCatalogsResponse]
82
+ #
83
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
84
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
85
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
86
+ def list_project_location_catalogs(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
87
+ command = make_simple_command(:get, 'v2alpha/{+parent}/catalogs', options)
88
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaListCatalogsResponse::Representation
89
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaListCatalogsResponse
90
+ command.params['parent'] = parent unless parent.nil?
91
+ command.query['pageSize'] = page_size unless page_size.nil?
92
+ command.query['pageToken'] = page_token unless page_token.nil?
93
+ command.query['fields'] = fields unless fields.nil?
94
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
95
+ execute_or_queue_command(command, &block)
96
+ end
97
+
98
+ # Updates the Catalogs.
99
+ # @param [String] name
100
+ # Required. Immutable. The fully qualified resource name of the catalog.
101
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaCatalog] google_cloud_retail_v2alpha_catalog_object
102
+ # @param [String] update_mask
103
+ # Indicates which fields in the provided Catalog to update. If not set, will
104
+ # only update the Catalog.product_level_config field, which is also the only
105
+ # currently supported field to update. If an unsupported or unknown field is
106
+ # provided, an INVALID_ARGUMENT error is returned.
107
+ # @param [String] fields
108
+ # Selector specifying which fields to include in a partial response.
109
+ # @param [String] quota_user
110
+ # Available to use for quota purposes for server-side applications. Can be any
111
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
112
+ # @param [Google::Apis::RequestOptions] options
113
+ # Request-specific options
114
+ #
115
+ # @yield [result, err] Result & error if block supplied
116
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaCatalog] parsed result object
117
+ # @yieldparam err [StandardError] error object if request failed
118
+ #
119
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaCatalog]
120
+ #
121
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
122
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
123
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
124
+ def patch_project_location_catalog(name, google_cloud_retail_v2alpha_catalog_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
125
+ command = make_simple_command(:patch, 'v2alpha/{+name}', options)
126
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaCatalog::Representation
127
+ command.request_object = google_cloud_retail_v2alpha_catalog_object
128
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaCatalog::Representation
129
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaCatalog
130
+ command.params['name'] = name unless name.nil?
131
+ command.query['updateMask'] = update_mask unless update_mask.nil?
132
+ command.query['fields'] = fields unless fields.nil?
133
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
134
+ execute_or_queue_command(command, &block)
135
+ end
136
+
137
+ # Gets the latest state of a long-running operation. Clients can use this method
138
+ # to poll the operation result at intervals as recommended by the API service.
139
+ # @param [String] name
140
+ # The name of the operation resource.
141
+ # @param [String] fields
142
+ # Selector specifying which fields to include in a partial response.
143
+ # @param [String] quota_user
144
+ # Available to use for quota purposes for server-side applications. Can be any
145
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
146
+ # @param [Google::Apis::RequestOptions] options
147
+ # Request-specific options
148
+ #
149
+ # @yield [result, err] Result & error if block supplied
150
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
151
+ # @yieldparam err [StandardError] error object if request failed
152
+ #
153
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
154
+ #
155
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
156
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
157
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
158
+ def get_project_location_catalog_branch_operation(name, fields: nil, quota_user: nil, options: nil, &block)
159
+ command = make_simple_command(:get, 'v2alpha/{+name}', options)
160
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
161
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
162
+ command.params['name'] = name unless name.nil?
163
+ command.query['fields'] = fields unless fields.nil?
164
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
165
+ execute_or_queue_command(command, &block)
166
+ end
167
+
168
+ # Creates a Product.
169
+ # @param [String] parent
170
+ # Required. The parent catalog resource name, such as `projects/*/locations/
171
+ # global/catalogs/default_catalog/branches/default_branch`.
172
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct] google_cloud_retail_v2alpha_product_object
173
+ # @param [String] product_id
174
+ # Required. The ID to use for the Product, which will become the final component
175
+ # of the Product.name. If the caller does not have permission to create the
176
+ # Product, regardless of whether or not it exists, a PERMISSION_DENIED error is
177
+ # returned. This field must be unique among all Products with the same parent.
178
+ # Otherwise, an ALREADY_EXISTS error is returned. This field must be a UTF-8
179
+ # encoded string with a length limit of 128 characters. Otherwise, an
180
+ # INVALID_ARGUMENT error is returned.
181
+ # @param [String] fields
182
+ # Selector specifying which fields to include in a partial response.
183
+ # @param [String] quota_user
184
+ # Available to use for quota purposes for server-side applications. Can be any
185
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
186
+ # @param [Google::Apis::RequestOptions] options
187
+ # Request-specific options
188
+ #
189
+ # @yield [result, err] Result & error if block supplied
190
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct] parsed result object
191
+ # @yieldparam err [StandardError] error object if request failed
192
+ #
193
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct]
194
+ #
195
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
196
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
197
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
198
+ def create_project_location_catalog_branch_product(parent, google_cloud_retail_v2alpha_product_object = nil, product_id: nil, fields: nil, quota_user: nil, options: nil, &block)
199
+ command = make_simple_command(:post, 'v2alpha/{+parent}/products', options)
200
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct::Representation
201
+ command.request_object = google_cloud_retail_v2alpha_product_object
202
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct::Representation
203
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct
204
+ command.params['parent'] = parent unless parent.nil?
205
+ command.query['productId'] = product_id unless product_id.nil?
206
+ command.query['fields'] = fields unless fields.nil?
207
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
208
+ execute_or_queue_command(command, &block)
209
+ end
210
+
211
+ # Deletes a Product.
212
+ # @param [String] name
213
+ # Required. Full resource name of Product, such as `projects/*/locations/global/
214
+ # catalogs/default_catalog/branches/default_branch/products/some_product_id`. If
215
+ # the caller does not have permission to delete the Product, regardless of
216
+ # whether or not it exists, a PERMISSION_DENIED error is returned. If the
217
+ # Product to delete does not exist, a NOT_FOUND error is returned. The Product
218
+ # to delete can neither be a Product.Type.COLLECTION Product member nor a
219
+ # Product.Type.PRIMARY Product with more than one variants. Otherwise, an
220
+ # INVALID_ARGUMENT error is returned.
221
+ # @param [String] fields
222
+ # Selector specifying which fields to include in a partial response.
223
+ # @param [String] quota_user
224
+ # Available to use for quota purposes for server-side applications. Can be any
225
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
226
+ # @param [Google::Apis::RequestOptions] options
227
+ # Request-specific options
228
+ #
229
+ # @yield [result, err] Result & error if block supplied
230
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleProtobufEmpty] parsed result object
231
+ # @yieldparam err [StandardError] error object if request failed
232
+ #
233
+ # @return [Google::Apis::RetailV2alpha::GoogleProtobufEmpty]
234
+ #
235
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
236
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
237
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
238
+ def delete_project_location_catalog_branch_product(name, fields: nil, quota_user: nil, options: nil, &block)
239
+ command = make_simple_command(:delete, 'v2alpha/{+name}', options)
240
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleProtobufEmpty::Representation
241
+ command.response_class = Google::Apis::RetailV2alpha::GoogleProtobufEmpty
242
+ command.params['name'] = name unless name.nil?
243
+ command.query['fields'] = fields unless fields.nil?
244
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
245
+ execute_or_queue_command(command, &block)
246
+ end
247
+
248
+ # Gets a Product.
249
+ # @param [String] name
250
+ # Required. Full resource name of Product, such as `projects/*/locations/global/
251
+ # catalogs/default_catalog/branches/default_branch/products/some_product_id`. If
252
+ # the caller does not have permission to access the Product, regardless of
253
+ # whether or not it exists, a PERMISSION_DENIED error is returned. If the
254
+ # requested Product does not exist, a NOT_FOUND error is returned.
255
+ # @param [String] fields
256
+ # Selector specifying which fields to include in a partial response.
257
+ # @param [String] quota_user
258
+ # Available to use for quota purposes for server-side applications. Can be any
259
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
260
+ # @param [Google::Apis::RequestOptions] options
261
+ # Request-specific options
262
+ #
263
+ # @yield [result, err] Result & error if block supplied
264
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct] parsed result object
265
+ # @yieldparam err [StandardError] error object if request failed
266
+ #
267
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct]
268
+ #
269
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
270
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
271
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
272
+ def get_project_location_catalog_branch_product(name, fields: nil, quota_user: nil, options: nil, &block)
273
+ command = make_simple_command(:get, 'v2alpha/{+name}', options)
274
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct::Representation
275
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct
276
+ command.params['name'] = name unless name.nil?
277
+ command.query['fields'] = fields unless fields.nil?
278
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
279
+ execute_or_queue_command(command, &block)
280
+ end
281
+
282
+ # Bulk import of multiple Products. Request processing may be synchronous. No
283
+ # partial updating is supported. Non-existing items are created. Note that it is
284
+ # possible for a subset of the Products to be successfully updated.
285
+ # @param [String] parent
286
+ # Required. `projects/1234/locations/global/catalogs/default_catalog/branches/
287
+ # default_branch` If no updateMask is specified, requires products.create
288
+ # permission. If updateMask is specified, requires products.update permission.
289
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaImportProductsRequest] google_cloud_retail_v2alpha_import_products_request_object
290
+ # @param [String] fields
291
+ # Selector specifying which fields to include in a partial response.
292
+ # @param [String] quota_user
293
+ # Available to use for quota purposes for server-side applications. Can be any
294
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
295
+ # @param [Google::Apis::RequestOptions] options
296
+ # Request-specific options
297
+ #
298
+ # @yield [result, err] Result & error if block supplied
299
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
300
+ # @yieldparam err [StandardError] error object if request failed
301
+ #
302
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
303
+ #
304
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
305
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
306
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
307
+ def import_project_location_catalog_branch_product(parent, google_cloud_retail_v2alpha_import_products_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
308
+ command = make_simple_command(:post, 'v2alpha/{+parent}/products:import', options)
309
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaImportProductsRequest::Representation
310
+ command.request_object = google_cloud_retail_v2alpha_import_products_request_object
311
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
312
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
313
+ command.params['parent'] = parent unless parent.nil?
314
+ command.query['fields'] = fields unless fields.nil?
315
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
316
+ execute_or_queue_command(command, &block)
317
+ end
318
+
319
+ # Updates a Product.
320
+ # @param [String] name
321
+ # Immutable. Full resource name of the product, such as `projects/*/locations/
322
+ # global/catalogs/default_catalog/branches/default_branch/products/product_id`.
323
+ # The branch ID must be "default_branch".
324
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct] google_cloud_retail_v2alpha_product_object
325
+ # @param [Boolean] allow_missing
326
+ # If set to true, and the Product is not found, a new Product will be created.
327
+ # In this situation, `update_mask` is ignored.
328
+ # @param [String] update_mask
329
+ # Indicates which fields in the provided Product to update. The immutable and
330
+ # output only fields are NOT supported. If not set, all supported fields (the
331
+ # fields that are neither immutable nor output only) are updated. If an
332
+ # unsupported or unknown field is provided, an INVALID_ARGUMENT error is
333
+ # returned.
334
+ # @param [String] fields
335
+ # Selector specifying which fields to include in a partial response.
336
+ # @param [String] quota_user
337
+ # Available to use for quota purposes for server-side applications. Can be any
338
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
339
+ # @param [Google::Apis::RequestOptions] options
340
+ # Request-specific options
341
+ #
342
+ # @yield [result, err] Result & error if block supplied
343
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct] parsed result object
344
+ # @yieldparam err [StandardError] error object if request failed
345
+ #
346
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct]
347
+ #
348
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
349
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
350
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
351
+ def patch_project_location_catalog_branch_product(name, google_cloud_retail_v2alpha_product_object = nil, allow_missing: nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
352
+ command = make_simple_command(:patch, 'v2alpha/{+name}', options)
353
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct::Representation
354
+ command.request_object = google_cloud_retail_v2alpha_product_object
355
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct::Representation
356
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaProduct
357
+ command.params['name'] = name unless name.nil?
358
+ command.query['allowMissing'] = allow_missing unless allow_missing.nil?
359
+ command.query['updateMask'] = update_mask unless update_mask.nil?
360
+ command.query['fields'] = fields unless fields.nil?
361
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
362
+ execute_or_queue_command(command, &block)
363
+ end
364
+
365
+ # Gets the latest state of a long-running operation. Clients can use this method
366
+ # to poll the operation result at intervals as recommended by the API service.
367
+ # @param [String] name
368
+ # The name of the operation resource.
369
+ # @param [String] fields
370
+ # Selector specifying which fields to include in a partial response.
371
+ # @param [String] quota_user
372
+ # Available to use for quota purposes for server-side applications. Can be any
373
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
374
+ # @param [Google::Apis::RequestOptions] options
375
+ # Request-specific options
376
+ #
377
+ # @yield [result, err] Result & error if block supplied
378
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
379
+ # @yieldparam err [StandardError] error object if request failed
380
+ #
381
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
382
+ #
383
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
384
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
385
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
386
+ def get_project_location_catalog_operation(name, fields: nil, quota_user: nil, options: nil, &block)
387
+ command = make_simple_command(:get, 'v2alpha/{+name}', options)
388
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
389
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
390
+ command.params['name'] = name unless name.nil?
391
+ command.query['fields'] = fields unless fields.nil?
392
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
393
+ execute_or_queue_command(command, &block)
394
+ end
395
+
396
+ # Lists operations that match the specified filter in the request. If the server
397
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
398
+ # binding allows API services to override the binding to use different resource
399
+ # name schemes, such as `users/*/operations`. To override the binding, API
400
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
401
+ # service configuration. For backwards compatibility, the default name includes
402
+ # the operations collection id, however overriding users must ensure the name
403
+ # binding is the parent resource, without the operations collection id.
404
+ # @param [String] name
405
+ # The name of the operation's parent resource.
406
+ # @param [String] filter
407
+ # The standard list filter.
408
+ # @param [Fixnum] page_size
409
+ # The standard list page size.
410
+ # @param [String] page_token
411
+ # The standard list page token.
412
+ # @param [String] fields
413
+ # Selector specifying which fields to include in a partial response.
414
+ # @param [String] quota_user
415
+ # Available to use for quota purposes for server-side applications. Can be any
416
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
417
+ # @param [Google::Apis::RequestOptions] options
418
+ # Request-specific options
419
+ #
420
+ # @yield [result, err] Result & error if block supplied
421
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse] parsed result object
422
+ # @yieldparam err [StandardError] error object if request failed
423
+ #
424
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse]
425
+ #
426
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
427
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
428
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
429
+ def list_project_location_catalog_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
430
+ command = make_simple_command(:get, 'v2alpha/{+name}/operations', options)
431
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse::Representation
432
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse
433
+ command.params['name'] = name unless name.nil?
434
+ command.query['filter'] = filter unless filter.nil?
435
+ command.query['pageSize'] = page_size unless page_size.nil?
436
+ command.query['pageToken'] = page_token unless page_token.nil?
437
+ command.query['fields'] = fields unless fields.nil?
438
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
439
+ execute_or_queue_command(command, &block)
440
+ end
441
+
442
+ # Makes a recommendation prediction.
443
+ # @param [String] placement
444
+ # Required. Full resource name of the format: `name=projects/*/locations/global/
445
+ # catalogs/default_catalog/placements/*` The id of the recommendation engine
446
+ # placement. This id is used to identify the set of models that will be used to
447
+ # make the prediction. We currently support three placements with the following
448
+ # IDs by default: * `shopping_cart`: Predicts products frequently bought
449
+ # together with one or more products in the same shopping session. Commonly
450
+ # displayed after `add-to-cart` events, on product detail pages, or on the
451
+ # shopping cart page. * `home_page`: Predicts the next product that a user will
452
+ # most likely engage with or purchase based on the shopping or viewing history
453
+ # of the specified `userId` or `visitorId`. For example - Recommendations for
454
+ # you. * `product_detail`: Predicts the next product that a user will most
455
+ # likely engage with or purchase. The prediction is based on the shopping or
456
+ # viewing history of the specified `userId` or `visitorId` and its relevance to
457
+ # a specified `CatalogItem`. Typically used on product detail pages. For example
458
+ # - More products like this. * `recently_viewed_default`: Returns up to 75
459
+ # products recently viewed by the specified `userId` or `visitorId`, most recent
460
+ # ones first. Returns nothing if neither of them has viewed any products yet.
461
+ # For example - Recently viewed. The full list of available placements can be
462
+ # seen at https://console.cloud.google.com/recommendation/catalogs/
463
+ # default_catalog/placements
464
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPredictRequest] google_cloud_retail_v2alpha_predict_request_object
465
+ # @param [String] fields
466
+ # Selector specifying which fields to include in a partial response.
467
+ # @param [String] quota_user
468
+ # Available to use for quota purposes for server-side applications. Can be any
469
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
470
+ # @param [Google::Apis::RequestOptions] options
471
+ # Request-specific options
472
+ #
473
+ # @yield [result, err] Result & error if block supplied
474
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPredictResponse] parsed result object
475
+ # @yieldparam err [StandardError] error object if request failed
476
+ #
477
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPredictResponse]
478
+ #
479
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
480
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
481
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
482
+ def predict_project_location_catalog_placement(placement, google_cloud_retail_v2alpha_predict_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
483
+ command = make_simple_command(:post, 'v2alpha/{+placement}:predict', options)
484
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPredictRequest::Representation
485
+ command.request_object = google_cloud_retail_v2alpha_predict_request_object
486
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPredictResponse::Representation
487
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPredictResponse
488
+ command.params['placement'] = placement unless placement.nil?
489
+ command.query['fields'] = fields unless fields.nil?
490
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
491
+ execute_or_queue_command(command, &block)
492
+ end
493
+
494
+ # Writes a single user event from the browser. This uses a GET request to due to
495
+ # browser restriction of POST-ing to a 3rd party domain. This method is used
496
+ # only by the Retail API JavaScript pixel and Google Tag Manager. Users should
497
+ # not call this method directly.
498
+ # @param [String] parent
499
+ # Required. The parent catalog name, such as `projects/1234/locations/global/
500
+ # catalogs/default_catalog`.
501
+ # @param [Fixnum] ets
502
+ # The event timestamp in milliseconds. This prevents browser caching of
503
+ # otherwise identical get requests. The name is abbreviated to reduce the
504
+ # payload bytes.
505
+ # @param [String] uri
506
+ # The URL including cgi-parameters but excluding the hash fragment with a length
507
+ # limit of 5,000 characters. This is often more useful than the referer URL,
508
+ # because many browsers only send the domain for 3rd party requests.
509
+ # @param [String] user_event
510
+ # Required. URL encoded UserEvent proto with a length limit of 2,000,000
511
+ # characters.
512
+ # @param [String] fields
513
+ # Selector specifying which fields to include in a partial response.
514
+ # @param [String] quota_user
515
+ # Available to use for quota purposes for server-side applications. Can be any
516
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
517
+ # @param [Google::Apis::RequestOptions] options
518
+ # Request-specific options
519
+ #
520
+ # @yield [result, err] Result & error if block supplied
521
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleApiHttpBody] parsed result object
522
+ # @yieldparam err [StandardError] error object if request failed
523
+ #
524
+ # @return [Google::Apis::RetailV2alpha::GoogleApiHttpBody]
525
+ #
526
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
527
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
528
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
529
+ def collect_project_location_catalog_user_event(parent, ets: nil, uri: nil, user_event: nil, fields: nil, quota_user: nil, options: nil, &block)
530
+ command = make_simple_command(:get, 'v2alpha/{+parent}/userEvents:collect', options)
531
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleApiHttpBody::Representation
532
+ command.response_class = Google::Apis::RetailV2alpha::GoogleApiHttpBody
533
+ command.params['parent'] = parent unless parent.nil?
534
+ command.query['ets'] = ets unless ets.nil?
535
+ command.query['uri'] = uri unless uri.nil?
536
+ command.query['userEvent'] = user_event unless user_event.nil?
537
+ command.query['fields'] = fields unless fields.nil?
538
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
539
+ execute_or_queue_command(command, &block)
540
+ end
541
+
542
+ # Bulk import of User events. Request processing might be synchronous. Events
543
+ # that already exist are skipped. Use this method for backfilling historical
544
+ # user events. Operation.response is of type ImportResponse. Note that it is
545
+ # possible for a subset of the items to be successfully inserted. Operation.
546
+ # metadata is of type ImportMetadata.
547
+ # @param [String] parent
548
+ # Required. `projects/1234/locations/global/catalogs/default_catalog`
549
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaImportUserEventsRequest] google_cloud_retail_v2alpha_import_user_events_request_object
550
+ # @param [String] fields
551
+ # Selector specifying which fields to include in a partial response.
552
+ # @param [String] quota_user
553
+ # Available to use for quota purposes for server-side applications. Can be any
554
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
555
+ # @param [Google::Apis::RequestOptions] options
556
+ # Request-specific options
557
+ #
558
+ # @yield [result, err] Result & error if block supplied
559
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
560
+ # @yieldparam err [StandardError] error object if request failed
561
+ #
562
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
563
+ #
564
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
565
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
566
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
567
+ def import_project_location_catalog_user_event(parent, google_cloud_retail_v2alpha_import_user_events_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
568
+ command = make_simple_command(:post, 'v2alpha/{+parent}/userEvents:import', options)
569
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaImportUserEventsRequest::Representation
570
+ command.request_object = google_cloud_retail_v2alpha_import_user_events_request_object
571
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
572
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
573
+ command.params['parent'] = parent unless parent.nil?
574
+ command.query['fields'] = fields unless fields.nil?
575
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
576
+ execute_or_queue_command(command, &block)
577
+ end
578
+
579
+ # Deletes permanently all user events specified by the filter provided.
580
+ # Depending on the number of events specified by the filter, this operation
581
+ # could take hours or days to complete. To test a filter, use the list command
582
+ # first.
583
+ # @param [String] parent
584
+ # Required. The resource name of the catalog under which the events are created.
585
+ # The format is `projects/$`projectId`/locations/global/catalogs/$`catalogId``
586
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPurgeUserEventsRequest] google_cloud_retail_v2alpha_purge_user_events_request_object
587
+ # @param [String] fields
588
+ # Selector specifying which fields to include in a partial response.
589
+ # @param [String] quota_user
590
+ # Available to use for quota purposes for server-side applications. Can be any
591
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
592
+ # @param [Google::Apis::RequestOptions] options
593
+ # Request-specific options
594
+ #
595
+ # @yield [result, err] Result & error if block supplied
596
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
597
+ # @yieldparam err [StandardError] error object if request failed
598
+ #
599
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
600
+ #
601
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
602
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
603
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
604
+ def purge_project_location_catalog_user_event(parent, google_cloud_retail_v2alpha_purge_user_events_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
605
+ command = make_simple_command(:post, 'v2alpha/{+parent}/userEvents:purge', options)
606
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaPurgeUserEventsRequest::Representation
607
+ command.request_object = google_cloud_retail_v2alpha_purge_user_events_request_object
608
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
609
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
610
+ command.params['parent'] = parent unless parent.nil?
611
+ command.query['fields'] = fields unless fields.nil?
612
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
613
+ execute_or_queue_command(command, &block)
614
+ end
615
+
616
+ # Triggers a user event rejoin operation with latest product catalog. Events
617
+ # will not be annotated with detailed product information if product is missing
618
+ # from the catalog at the time the user event is ingested, and these events are
619
+ # stored as unjoined events with a limited usage on training and serving. This
620
+ # API can be used to trigger a 'join' operation on specified events with latest
621
+ # version of product catalog. It can also be used to correct events joined with
622
+ # wrong product catalog.
623
+ # @param [String] parent
624
+ # Required. The parent catalog resource name, such as `projects/1234/locations/
625
+ # global/catalogs/default_catalog`.
626
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaRejoinUserEventsRequest] google_cloud_retail_v2alpha_rejoin_user_events_request_object
627
+ # @param [String] fields
628
+ # Selector specifying which fields to include in a partial response.
629
+ # @param [String] quota_user
630
+ # Available to use for quota purposes for server-side applications. Can be any
631
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
632
+ # @param [Google::Apis::RequestOptions] options
633
+ # Request-specific options
634
+ #
635
+ # @yield [result, err] Result & error if block supplied
636
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
637
+ # @yieldparam err [StandardError] error object if request failed
638
+ #
639
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
640
+ #
641
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
642
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
643
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
644
+ def rejoin_project_location_catalog_user_event(parent, google_cloud_retail_v2alpha_rejoin_user_events_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
645
+ command = make_simple_command(:post, 'v2alpha/{+parent}/userEvents:rejoin', options)
646
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaRejoinUserEventsRequest::Representation
647
+ command.request_object = google_cloud_retail_v2alpha_rejoin_user_events_request_object
648
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
649
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
650
+ command.params['parent'] = parent unless parent.nil?
651
+ command.query['fields'] = fields unless fields.nil?
652
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
653
+ execute_or_queue_command(command, &block)
654
+ end
655
+
656
+ # Writes a single user event.
657
+ # @param [String] parent
658
+ # Required. The parent catalog resource name, such as `projects/1234/locations/
659
+ # global/catalogs/default_catalog`.
660
+ # @param [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaUserEvent] google_cloud_retail_v2alpha_user_event_object
661
+ # @param [String] fields
662
+ # Selector specifying which fields to include in a partial response.
663
+ # @param [String] quota_user
664
+ # Available to use for quota purposes for server-side applications. Can be any
665
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
666
+ # @param [Google::Apis::RequestOptions] options
667
+ # Request-specific options
668
+ #
669
+ # @yield [result, err] Result & error if block supplied
670
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaUserEvent] parsed result object
671
+ # @yieldparam err [StandardError] error object if request failed
672
+ #
673
+ # @return [Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaUserEvent]
674
+ #
675
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
676
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
677
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
678
+ def write_project_location_catalog_user_event(parent, google_cloud_retail_v2alpha_user_event_object = nil, fields: nil, quota_user: nil, options: nil, &block)
679
+ command = make_simple_command(:post, 'v2alpha/{+parent}/userEvents:write', options)
680
+ command.request_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaUserEvent::Representation
681
+ command.request_object = google_cloud_retail_v2alpha_user_event_object
682
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaUserEvent::Representation
683
+ command.response_class = Google::Apis::RetailV2alpha::GoogleCloudRetailV2alphaUserEvent
684
+ command.params['parent'] = parent unless parent.nil?
685
+ command.query['fields'] = fields unless fields.nil?
686
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
687
+ execute_or_queue_command(command, &block)
688
+ end
689
+
690
+ # Gets the latest state of a long-running operation. Clients can use this method
691
+ # to poll the operation result at intervals as recommended by the API service.
692
+ # @param [String] name
693
+ # The name of the operation resource.
694
+ # @param [String] fields
695
+ # Selector specifying which fields to include in a partial response.
696
+ # @param [String] quota_user
697
+ # Available to use for quota purposes for server-side applications. Can be any
698
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
699
+ # @param [Google::Apis::RequestOptions] options
700
+ # Request-specific options
701
+ #
702
+ # @yield [result, err] Result & error if block supplied
703
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningOperation] parsed result object
704
+ # @yieldparam err [StandardError] error object if request failed
705
+ #
706
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningOperation]
707
+ #
708
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
709
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
710
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
711
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
712
+ command = make_simple_command(:get, 'v2alpha/{+name}', options)
713
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningOperation::Representation
714
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningOperation
715
+ command.params['name'] = name unless name.nil?
716
+ command.query['fields'] = fields unless fields.nil?
717
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
718
+ execute_or_queue_command(command, &block)
719
+ end
720
+
721
+ # Lists operations that match the specified filter in the request. If the server
722
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
723
+ # binding allows API services to override the binding to use different resource
724
+ # name schemes, such as `users/*/operations`. To override the binding, API
725
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
726
+ # service configuration. For backwards compatibility, the default name includes
727
+ # the operations collection id, however overriding users must ensure the name
728
+ # binding is the parent resource, without the operations collection id.
729
+ # @param [String] name
730
+ # The name of the operation's parent resource.
731
+ # @param [String] filter
732
+ # The standard list filter.
733
+ # @param [Fixnum] page_size
734
+ # The standard list page size.
735
+ # @param [String] page_token
736
+ # The standard list page token.
737
+ # @param [String] fields
738
+ # Selector specifying which fields to include in a partial response.
739
+ # @param [String] quota_user
740
+ # Available to use for quota purposes for server-side applications. Can be any
741
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
742
+ # @param [Google::Apis::RequestOptions] options
743
+ # Request-specific options
744
+ #
745
+ # @yield [result, err] Result & error if block supplied
746
+ # @yieldparam result [Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse] parsed result object
747
+ # @yieldparam err [StandardError] error object if request failed
748
+ #
749
+ # @return [Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse]
750
+ #
751
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
752
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
753
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
754
+ def list_project_location_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
755
+ command = make_simple_command(:get, 'v2alpha/{+name}/operations', options)
756
+ command.response_representation = Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse::Representation
757
+ command.response_class = Google::Apis::RetailV2alpha::GoogleLongrunningListOperationsResponse
758
+ command.params['name'] = name unless name.nil?
759
+ command.query['filter'] = filter unless filter.nil?
760
+ command.query['pageSize'] = page_size unless page_size.nil?
761
+ command.query['pageToken'] = page_token unless page_token.nil?
762
+ command.query['fields'] = fields unless fields.nil?
763
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
764
+ execute_or_queue_command(command, &block)
765
+ end
766
+
767
+ protected
768
+
769
+ def apply_command_defaults(command)
770
+ command.query['key'] = key unless key.nil?
771
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
772
+ end
773
+ end
774
+ end
775
+ end
776
+ end