google-cloud-retail-v2 0.6.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -6
  3. data/lib/google/cloud/retail/v2/catalog_pb.rb +2 -4
  4. data/lib/google/cloud/retail/v2/catalog_service/client.rb +9 -9
  5. data/lib/google/cloud/retail/v2/catalog_service_pb.rb +3 -1
  6. data/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +0 -8
  7. data/lib/google/cloud/retail/v2/common_pb.rb +8 -5
  8. data/lib/google/cloud/retail/v2/completion_service/client.rb +20 -21
  9. data/lib/google/cloud/retail/v2/completion_service/operations.rb +3 -0
  10. data/lib/google/cloud/retail/v2/completion_service.rb +1 -2
  11. data/lib/google/cloud/retail/v2/completion_service_pb.rb +2 -1
  12. data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +7 -7
  13. data/lib/google/cloud/retail/v2/import_config_pb.rb +2 -2
  14. data/lib/google/cloud/retail/v2/prediction_service/client.rb +17 -4
  15. data/lib/google/cloud/retail/v2/prediction_service_pb.rb +2 -1
  16. data/lib/google/cloud/retail/v2/product_pb.rb +3 -2
  17. data/lib/google/cloud/retail/v2/product_service/client.rb +337 -23
  18. data/lib/google/cloud/retail/v2/product_service/operations.rb +3 -0
  19. data/lib/google/cloud/retail/v2/product_service_pb.rb +29 -2
  20. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +47 -9
  21. data/lib/google/cloud/retail/v2/promotion_pb.rb +22 -0
  22. data/lib/google/cloud/retail/v2/purge_config_pb.rb +3 -2
  23. data/lib/google/cloud/retail/v2/search_service/client.rb +56 -19
  24. data/lib/google/cloud/retail/v2/search_service.rb +1 -2
  25. data/lib/google/cloud/retail/v2/search_service_pb.rb +28 -3
  26. data/lib/google/cloud/retail/v2/search_service_services_pb.rb +2 -4
  27. data/lib/google/cloud/retail/v2/user_event_pb.rb +2 -2
  28. data/lib/google/cloud/retail/v2/user_event_service/client.rb +4 -3
  29. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +3 -0
  30. data/lib/google/cloud/retail/v2/user_event_service_pb.rb +3 -1
  31. data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +4 -3
  32. data/lib/google/cloud/retail/v2/version.rb +1 -1
  33. data/lib/google/cloud/retail/v2.rb +2 -0
  34. data/proto_docs/google/cloud/retail/v2/catalog.rb +8 -8
  35. data/proto_docs/google/cloud/retail/v2/catalog_service.rb +9 -0
  36. data/proto_docs/google/cloud/retail/v2/common.rb +100 -25
  37. data/proto_docs/google/cloud/retail/v2/completion_service.rb +28 -18
  38. data/proto_docs/google/cloud/retail/v2/import_config.rb +38 -23
  39. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +19 -6
  40. data/proto_docs/google/cloud/retail/v2/product.rb +50 -41
  41. data/proto_docs/google/cloud/retail/v2/product_service.rb +154 -6
  42. data/proto_docs/google/cloud/retail/v2/promotion.rb +43 -0
  43. data/proto_docs/google/cloud/retail/v2/search_service.rb +162 -28
  44. data/proto_docs/google/cloud/retail/v2/user_event.rb +30 -14
  45. data/proto_docs/google/protobuf/any.rb +3 -3
  46. data/proto_docs/google/protobuf/struct.rb +2 -2
  47. metadata +14 -12
@@ -566,6 +566,11 @@ module Google
566
566
  #
567
567
  # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
568
568
  # is returned.
569
+ #
570
+ # The attribute key can be updated by setting the mask path as
571
+ # "attributes.$\\{key_name}". If a key name is present in the mask but not in
572
+ # the patching product from the request, this key will be deleted after the
573
+ # update.
569
574
  # @param allow_missing [::Boolean]
570
575
  # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
571
576
  # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In
@@ -743,7 +748,7 @@ module Google
743
748
  ##
744
749
  # Bulk import of multiple {::Google::Cloud::Retail::V2::Product Product}s.
745
750
  #
746
- # Request processing may be synchronous. No partial updating is supported.
751
+ # Request processing may be synchronous.
747
752
  # Non-existing items are created.
748
753
  #
749
754
  # Note that it is possible for a subset of the
@@ -771,15 +776,7 @@ module Google
771
776
  # If no updateMask is specified, requires products.create permission.
772
777
  # If updateMask is specified, requires products.update permission.
773
778
  # @param request_id [::String]
774
- # Unique identifier provided by client, within the ancestor
775
- # dataset scope. Ensures idempotency and used for request deduplication.
776
- # Server-generated if unspecified. Up to 128 characters long and must match
777
- # the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in
778
- # {::Google::Cloud::Retail::V2::ImportMetadata ImportMetadata}.
779
- #
780
- # Only supported when
781
- # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode}
782
- # is set to `FULL`.
779
+ # Deprecated. This field has no effect.
783
780
  # @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash]
784
781
  # Required. The desired input location of the data.
785
782
  # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash]
@@ -792,11 +789,18 @@ module Google
792
789
  # imported. Defaults to
793
790
  # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
794
791
  # @param notification_pubsub_topic [::String]
795
- # Pub/Sub topic for receiving notification. If this field is set,
792
+ # Full Pub/Sub topic name for receiving notification. If this field is set,
796
793
  # when the import is finished, a notification will be sent to
797
794
  # specified Pub/Sub topic. The message data will be JSON string of a
798
795
  # {::Google::Longrunning::Operation Operation}.
799
- # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
796
+ #
797
+ # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
798
+ # to be within the same project as
799
+ # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}.
800
+ # Make sure that both
801
+ # `cloud-retail-customer-data-access@system.gserviceaccount.com` and
802
+ # `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
803
+ # have the `pubsub.topics.publish` IAM permission on the topic.
800
804
  #
801
805
  # Only supported when
802
806
  # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode}
@@ -903,18 +907,18 @@ module Google
903
907
  # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product},
904
908
  # then any pre-existing inventory information for this product will be used.
905
909
  #
906
- # If no inventory fields are set in [UpdateProductRequest.set_mask][],
910
+ # If no inventory fields are set in
911
+ # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask},
907
912
  # then any existing inventory information will be preserved.
908
913
  #
909
914
  # Pre-existing inventory information can only be updated with
910
915
  # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory SetInventory},
911
- # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places AddFulfillmentPlaces},
916
+ # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces},
912
917
  # and
913
918
  # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places RemoveFulfillmentPlaces}.
914
919
  #
915
920
  # This feature is only available for users who have Retail Search enabled.
916
- # Please submit a form [here](https://cloud.google.com/contact) to contact
917
- # cloud sales if you are interested in using Retail Search.
921
+ # Please enable Retail Search on Cloud Console before using this feature.
918
922
  #
919
923
  # @overload set_inventory(request, options = nil)
920
924
  # Pass arguments to `set_inventory` via a request object, either of type
@@ -959,6 +963,24 @@ module Google
959
963
  # provided or default value for
960
964
  # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}.
961
965
  #
966
+ # The caller can replace place IDs for a subset of fulfillment types in the
967
+ # following ways:
968
+ #
969
+ # * Adds "fulfillment_info" in
970
+ # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}
971
+ # * Specifies only the desired fulfillment types and corresponding place IDs
972
+ # to update in [SetInventoryRequest.inventory.fulfillment_info][]
973
+ #
974
+ # The caller can clear all place IDs from a subset of fulfillment types in
975
+ # the following ways:
976
+ #
977
+ # * Adds "fulfillment_info" in
978
+ # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}
979
+ # * Specifies only the desired fulfillment types to clear in
980
+ # [SetInventoryRequest.inventory.fulfillment_info][]
981
+ # * Checks that only the desired fulfillment info types have empty
982
+ # [SetInventoryRequest.inventory.fulfillment_info.place_ids][]
983
+ #
962
984
  # The last update time is recorded for the following inventory fields:
963
985
  # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info}
964
986
  # * {::Google::Cloud::Retail::V2::Product#availability Product.availability}
@@ -969,8 +991,9 @@ module Google
969
991
  # needed, [UpdateProduct][] should be invoked instead.
970
992
  # @param set_mask [::Google::Protobuf::FieldMask, ::Hash]
971
993
  # Indicates which inventory fields in the provided
972
- # {::Google::Cloud::Retail::V2::Product Product} to update. If not set or set with
973
- # empty paths, all inventory fields will be updated.
994
+ # {::Google::Cloud::Retail::V2::Product Product} to update.
995
+ #
996
+ # At least one field must be provided.
974
997
  #
975
998
  # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
976
999
  # is returned and the entire update will be ignored.
@@ -1072,8 +1095,7 @@ module Google
1072
1095
  # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
1073
1096
  #
1074
1097
  # This feature is only available for users who have Retail Search enabled.
1075
- # Please submit a form [here](https://cloud.google.com/contact) to contact
1076
- # cloud sales if you are interested in using Retail Search.
1098
+ # Please enable Retail Search on Cloud Console before using this feature.
1077
1099
  #
1078
1100
  # @overload add_fulfillment_places(request, options = nil)
1079
1101
  # Pass arguments to `add_fulfillment_places` via a request object, either of type
@@ -1232,8 +1254,7 @@ module Google
1232
1254
  # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
1233
1255
  #
1234
1256
  # This feature is only available for users who have Retail Search enabled.
1235
- # Please submit a form [here](https://cloud.google.com/contact) to contact
1236
- # cloud sales if you are interested in using Retail Search.
1257
+ # Please enable Retail Search on Cloud Console before using this feature.
1237
1258
  #
1238
1259
  # @overload remove_fulfillment_places(request, options = nil)
1239
1260
  # Pass arguments to `remove_fulfillment_places` via a request object, either of type
@@ -1277,7 +1298,8 @@ module Google
1277
1298
  # If this field is set to an invalid value other than these, an
1278
1299
  # INVALID_ARGUMENT error is returned.
1279
1300
  #
1280
- # This field directly corresponds to [Product.fulfillment_info.type][].
1301
+ # This field directly corresponds to
1302
+ # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}.
1281
1303
  # @param place_ids [::Array<::String>]
1282
1304
  # Required. The IDs for this
1283
1305
  # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as
@@ -1373,6 +1395,284 @@ module Google
1373
1395
  raise ::Google::Cloud::Error.from_error(e)
1374
1396
  end
1375
1397
 
1398
+ ##
1399
+ # Updates local inventory information for a
1400
+ # {::Google::Cloud::Retail::V2::Product Product} at a list of places, while
1401
+ # respecting the last update timestamps of each inventory field.
1402
+ #
1403
+ # This process is asynchronous and does not require the
1404
+ # {::Google::Cloud::Retail::V2::Product Product} to exist before updating
1405
+ # inventory information. If the request is valid, the update will be enqueued
1406
+ # and processed downstream. As a consequence, when a response is returned,
1407
+ # updates are not immediately manifested in the
1408
+ # {::Google::Cloud::Retail::V2::Product Product} queried by
1409
+ # {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
1410
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
1411
+ #
1412
+ # Local inventory information can only be modified using this method.
1413
+ # {::Google::Cloud::Retail::V2::ProductService::Client#create_product CreateProduct} and
1414
+ # {::Google::Cloud::Retail::V2::ProductService::Client#update_product UpdateProduct} has no
1415
+ # effect on local inventories.
1416
+ #
1417
+ # This feature is only available for users who have Retail Search enabled.
1418
+ # Please enable Retail Search on Cloud Console before using this feature.
1419
+ #
1420
+ # @overload add_local_inventories(request, options = nil)
1421
+ # Pass arguments to `add_local_inventories` via a request object, either of type
1422
+ # {::Google::Cloud::Retail::V2::AddLocalInventoriesRequest} or an equivalent Hash.
1423
+ #
1424
+ # @param request [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash]
1425
+ # A request object representing the call parameters. Required. To specify no
1426
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1427
+ # @param options [::Gapic::CallOptions, ::Hash]
1428
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1429
+ #
1430
+ # @overload add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil)
1431
+ # Pass arguments to `add_local_inventories` via keyword arguments. Note that at
1432
+ # least one keyword argument is required. To specify no parameters, or to keep all
1433
+ # the default parameter values, pass an empty Hash as a request object (see above).
1434
+ #
1435
+ # @param product [::String]
1436
+ # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
1437
+ # such as
1438
+ # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
1439
+ #
1440
+ # If the caller does not have permission to access the
1441
+ # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
1442
+ # exists, a PERMISSION_DENIED error is returned.
1443
+ # @param local_inventories [::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>]
1444
+ # Required. A list of inventory information at difference places. Each place
1445
+ # is identified by its place ID. At most 3000 inventories are allowed per
1446
+ # request.
1447
+ # @param add_mask [::Google::Protobuf::FieldMask, ::Hash]
1448
+ # Indicates which inventory fields in the provided list of
1449
+ # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The
1450
+ # field is updated to the provided value.
1451
+ #
1452
+ # If a field is set while the place does not have a previous local inventory,
1453
+ # the local inventory at that store is created.
1454
+ #
1455
+ # If a field is set while the value of that field is not provided, the
1456
+ # original field value, if it exists, is deleted.
1457
+ #
1458
+ # If the mask is not set or set with empty paths, all inventory fields will
1459
+ # be updated.
1460
+ #
1461
+ # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
1462
+ # is returned and the entire update will be ignored.
1463
+ # @param add_time [::Google::Protobuf::Timestamp, ::Hash]
1464
+ # The time when the inventory updates are issued. Used to prevent
1465
+ # out-of-order updates on local inventory fields. If not provided, the
1466
+ # internal system time will be used.
1467
+ # @param allow_missing [::Boolean]
1468
+ # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
1469
+ # found, the local inventory will still be processed and retained for at most
1470
+ # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is
1471
+ # created. If set to false, a NOT_FOUND error is returned if the
1472
+ # {::Google::Cloud::Retail::V2::Product Product} is not found.
1473
+ #
1474
+ # @yield [response, operation] Access the result along with the RPC operation
1475
+ # @yieldparam response [::Gapic::Operation]
1476
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1477
+ #
1478
+ # @return [::Gapic::Operation]
1479
+ #
1480
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1481
+ #
1482
+ # @example Basic example
1483
+ # require "google/cloud/retail/v2"
1484
+ #
1485
+ # # Create a client object. The client can be reused for multiple calls.
1486
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
1487
+ #
1488
+ # # Create a request. To set request fields, pass in keyword arguments.
1489
+ # request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new
1490
+ #
1491
+ # # Call the add_local_inventories method.
1492
+ # result = client.add_local_inventories request
1493
+ #
1494
+ # # The returned object is of type Gapic::Operation. You can use this
1495
+ # # object to check the status of an operation, cancel it, or wait
1496
+ # # for results. Here is how to block until completion:
1497
+ # result.wait_until_done! timeout: 60
1498
+ # if result.response?
1499
+ # p result.response
1500
+ # else
1501
+ # puts "Error!"
1502
+ # end
1503
+ #
1504
+ def add_local_inventories request, options = nil
1505
+ raise ::ArgumentError, "request must be provided" if request.nil?
1506
+
1507
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest
1508
+
1509
+ # Converts hash and nil to an options object
1510
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1511
+
1512
+ # Customize the options with defaults
1513
+ metadata = @config.rpcs.add_local_inventories.metadata.to_h
1514
+
1515
+ # Set x-goog-api-client and x-goog-user-project headers
1516
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1517
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1518
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
1519
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1520
+
1521
+ header_params = {}
1522
+ if request.product
1523
+ header_params["product"] = request.product
1524
+ end
1525
+
1526
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1527
+ metadata[:"x-goog-request-params"] ||= request_params_header
1528
+
1529
+ options.apply_defaults timeout: @config.rpcs.add_local_inventories.timeout,
1530
+ metadata: metadata,
1531
+ retry_policy: @config.rpcs.add_local_inventories.retry_policy
1532
+
1533
+ options.apply_defaults timeout: @config.timeout,
1534
+ metadata: @config.metadata,
1535
+ retry_policy: @config.retry_policy
1536
+
1537
+ @product_service_stub.call_rpc :add_local_inventories, request, options: options do |response, operation|
1538
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1539
+ yield response, operation if block_given?
1540
+ return response
1541
+ end
1542
+ rescue ::GRPC::BadStatus => e
1543
+ raise ::Google::Cloud::Error.from_error(e)
1544
+ end
1545
+
1546
+ ##
1547
+ # Remove local inventory information for a
1548
+ # {::Google::Cloud::Retail::V2::Product Product} at a list of places at a removal
1549
+ # timestamp.
1550
+ #
1551
+ # This process is asynchronous. If the request is valid, the removal will be
1552
+ # enqueued and processed downstream. As a consequence, when a response is
1553
+ # returned, removals are not immediately manifested in the
1554
+ # {::Google::Cloud::Retail::V2::Product Product} queried by
1555
+ # {::Google::Cloud::Retail::V2::ProductService::Client#get_product GetProduct} or
1556
+ # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ListProducts}.
1557
+ #
1558
+ # Local inventory information can only be removed using this method.
1559
+ # {::Google::Cloud::Retail::V2::ProductService::Client#create_product CreateProduct} and
1560
+ # {::Google::Cloud::Retail::V2::ProductService::Client#update_product UpdateProduct} has no
1561
+ # effect on local inventories.
1562
+ #
1563
+ # This feature is only available for users who have Retail Search enabled.
1564
+ # Please enable Retail Search on Cloud Console before using this feature.
1565
+ #
1566
+ # @overload remove_local_inventories(request, options = nil)
1567
+ # Pass arguments to `remove_local_inventories` via a request object, either of type
1568
+ # {::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest} or an equivalent Hash.
1569
+ #
1570
+ # @param request [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash]
1571
+ # A request object representing the call parameters. Required. To specify no
1572
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1573
+ # @param options [::Gapic::CallOptions, ::Hash]
1574
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1575
+ #
1576
+ # @overload remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil)
1577
+ # Pass arguments to `remove_local_inventories` via keyword arguments. Note that at
1578
+ # least one keyword argument is required. To specify no parameters, or to keep all
1579
+ # the default parameter values, pass an empty Hash as a request object (see above).
1580
+ #
1581
+ # @param product [::String]
1582
+ # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product},
1583
+ # such as
1584
+ # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
1585
+ #
1586
+ # If the caller does not have permission to access the
1587
+ # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it
1588
+ # exists, a PERMISSION_DENIED error is returned.
1589
+ # @param place_ids [::Array<::String>]
1590
+ # Required. A list of place IDs to have their inventory deleted.
1591
+ # At most 3000 place IDs are allowed per request.
1592
+ # @param remove_time [::Google::Protobuf::Timestamp, ::Hash]
1593
+ # The time when the inventory deletions are issued. Used to prevent
1594
+ # out-of-order updates and deletions on local inventory fields. If not
1595
+ # provided, the internal system time will be used.
1596
+ # @param allow_missing [::Boolean]
1597
+ # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not
1598
+ # found, the local inventory removal request will still be processed and
1599
+ # retained for at most 1 day and processed once the
1600
+ # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a
1601
+ # NOT_FOUND error is returned if the
1602
+ # {::Google::Cloud::Retail::V2::Product Product} is not found.
1603
+ #
1604
+ # @yield [response, operation] Access the result along with the RPC operation
1605
+ # @yieldparam response [::Gapic::Operation]
1606
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1607
+ #
1608
+ # @return [::Gapic::Operation]
1609
+ #
1610
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1611
+ #
1612
+ # @example Basic example
1613
+ # require "google/cloud/retail/v2"
1614
+ #
1615
+ # # Create a client object. The client can be reused for multiple calls.
1616
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
1617
+ #
1618
+ # # Create a request. To set request fields, pass in keyword arguments.
1619
+ # request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new
1620
+ #
1621
+ # # Call the remove_local_inventories method.
1622
+ # result = client.remove_local_inventories request
1623
+ #
1624
+ # # The returned object is of type Gapic::Operation. You can use this
1625
+ # # object to check the status of an operation, cancel it, or wait
1626
+ # # for results. Here is how to block until completion:
1627
+ # result.wait_until_done! timeout: 60
1628
+ # if result.response?
1629
+ # p result.response
1630
+ # else
1631
+ # puts "Error!"
1632
+ # end
1633
+ #
1634
+ def remove_local_inventories request, options = nil
1635
+ raise ::ArgumentError, "request must be provided" if request.nil?
1636
+
1637
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest
1638
+
1639
+ # Converts hash and nil to an options object
1640
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1641
+
1642
+ # Customize the options with defaults
1643
+ metadata = @config.rpcs.remove_local_inventories.metadata.to_h
1644
+
1645
+ # Set x-goog-api-client and x-goog-user-project headers
1646
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1647
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1648
+ gapic_version: ::Google::Cloud::Retail::V2::VERSION
1649
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1650
+
1651
+ header_params = {}
1652
+ if request.product
1653
+ header_params["product"] = request.product
1654
+ end
1655
+
1656
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1657
+ metadata[:"x-goog-request-params"] ||= request_params_header
1658
+
1659
+ options.apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout,
1660
+ metadata: metadata,
1661
+ retry_policy: @config.rpcs.remove_local_inventories.retry_policy
1662
+
1663
+ options.apply_defaults timeout: @config.timeout,
1664
+ metadata: @config.metadata,
1665
+ retry_policy: @config.retry_policy
1666
+
1667
+ @product_service_stub.call_rpc :remove_local_inventories, request, options: options do |response, operation|
1668
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1669
+ yield response, operation if block_given?
1670
+ return response
1671
+ end
1672
+ rescue ::GRPC::BadStatus => e
1673
+ raise ::Google::Cloud::Error.from_error(e)
1674
+ end
1675
+
1376
1676
  ##
1377
1677
  # Configuration class for the ProductService API.
1378
1678
  #
@@ -1553,6 +1853,16 @@ module Google
1553
1853
  # @return [::Gapic::Config::Method]
1554
1854
  #
1555
1855
  attr_reader :remove_fulfillment_places
1856
+ ##
1857
+ # RPC-specific configuration for `add_local_inventories`
1858
+ # @return [::Gapic::Config::Method]
1859
+ #
1860
+ attr_reader :add_local_inventories
1861
+ ##
1862
+ # RPC-specific configuration for `remove_local_inventories`
1863
+ # @return [::Gapic::Config::Method]
1864
+ #
1865
+ attr_reader :remove_local_inventories
1556
1866
 
1557
1867
  # @private
1558
1868
  def initialize parent_rpcs = nil
@@ -1574,6 +1884,10 @@ module Google
1574
1884
  @add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config
1575
1885
  remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places
1576
1886
  @remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config
1887
+ add_local_inventories_config = parent_rpcs.add_local_inventories if parent_rpcs.respond_to? :add_local_inventories
1888
+ @add_local_inventories = ::Gapic::Config::Method.new add_local_inventories_config
1889
+ remove_local_inventories_config = parent_rpcs.remove_local_inventories if parent_rpcs.respond_to? :remove_local_inventories
1890
+ @remove_local_inventories = ::Gapic::Config::Method.new remove_local_inventories_config
1577
1891
 
1578
1892
  yield self if block_given?
1579
1893
  end
@@ -95,6 +95,9 @@ module Google
95
95
  channel_args: @config.channel_args,
96
96
  interceptors: @config.interceptors
97
97
  )
98
+
99
+ # Used by an LRO wrapper for some methods of this service
100
+ @operations_client = self
98
101
  end
99
102
 
100
103
  # Service calls
@@ -1,6 +1,8 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/retail/v2/product_service.proto
3
3
 
4
+ require 'google/protobuf'
5
+
4
6
  require 'google/api/annotations_pb'
5
7
  require 'google/api/client_pb'
6
8
  require 'google/api/field_behavior_pb'
@@ -8,12 +10,10 @@ require 'google/api/resource_pb'
8
10
  require 'google/cloud/retail/v2/common_pb'
9
11
  require 'google/cloud/retail/v2/import_config_pb'
10
12
  require 'google/cloud/retail/v2/product_pb'
11
- require 'google/cloud/retail/v2/purge_config_pb'
12
13
  require 'google/longrunning/operations_pb'
13
14
  require 'google/protobuf/empty_pb'
14
15
  require 'google/protobuf/field_mask_pb'
15
16
  require 'google/protobuf/timestamp_pb'
16
- require 'google/protobuf'
17
17
 
18
18
  Google::Protobuf::DescriptorPool.generated_pool.build do
19
19
  add_file("google/cloud/retail/v2/product_service.proto", :syntax => :proto3) do
@@ -65,6 +65,27 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
65
65
  end
66
66
  add_message "google.cloud.retail.v2.AddFulfillmentPlacesResponse" do
67
67
  end
68
+ add_message "google.cloud.retail.v2.AddLocalInventoriesRequest" do
69
+ optional :product, :string, 1
70
+ repeated :local_inventories, :message, 2, "google.cloud.retail.v2.LocalInventory"
71
+ optional :add_mask, :message, 4, "google.protobuf.FieldMask"
72
+ optional :add_time, :message, 5, "google.protobuf.Timestamp"
73
+ optional :allow_missing, :bool, 6
74
+ end
75
+ add_message "google.cloud.retail.v2.AddLocalInventoriesMetadata" do
76
+ end
77
+ add_message "google.cloud.retail.v2.AddLocalInventoriesResponse" do
78
+ end
79
+ add_message "google.cloud.retail.v2.RemoveLocalInventoriesRequest" do
80
+ optional :product, :string, 1
81
+ repeated :place_ids, :string, 2
82
+ optional :remove_time, :message, 5, "google.protobuf.Timestamp"
83
+ optional :allow_missing, :bool, 3
84
+ end
85
+ add_message "google.cloud.retail.v2.RemoveLocalInventoriesMetadata" do
86
+ end
87
+ add_message "google.cloud.retail.v2.RemoveLocalInventoriesResponse" do
88
+ end
68
89
  add_message "google.cloud.retail.v2.RemoveFulfillmentPlacesRequest" do
69
90
  optional :product, :string, 1
70
91
  optional :type, :string, 2
@@ -95,6 +116,12 @@ module Google
95
116
  AddFulfillmentPlacesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesRequest").msgclass
96
117
  AddFulfillmentPlacesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesMetadata").msgclass
97
118
  AddFulfillmentPlacesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesResponse").msgclass
119
+ AddLocalInventoriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesRequest").msgclass
120
+ AddLocalInventoriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesMetadata").msgclass
121
+ AddLocalInventoriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesResponse").msgclass
122
+ RemoveLocalInventoriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesRequest").msgclass
123
+ RemoveLocalInventoriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesMetadata").msgclass
124
+ RemoveLocalInventoriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesResponse").msgclass
98
125
  RemoveFulfillmentPlacesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesRequest").msgclass
99
126
  RemoveFulfillmentPlacesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata").msgclass
100
127
  RemoveFulfillmentPlacesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesResponse").msgclass
@@ -46,7 +46,7 @@ module Google
46
46
  rpc :DeleteProduct, ::Google::Cloud::Retail::V2::DeleteProductRequest, ::Google::Protobuf::Empty
47
47
  # Bulk import of multiple [Product][google.cloud.retail.v2.Product]s.
48
48
  #
49
- # Request processing may be synchronous. No partial updating is supported.
49
+ # Request processing may be synchronous.
50
50
  # Non-existing items are created.
51
51
  #
52
52
  # Note that it is possible for a subset of the
@@ -80,18 +80,18 @@ module Google
80
80
  # [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product],
81
81
  # then any pre-existing inventory information for this product will be used.
82
82
  #
83
- # If no inventory fields are set in [UpdateProductRequest.set_mask][],
83
+ # If no inventory fields are set in
84
+ # [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask],
84
85
  # then any existing inventory information will be preserved.
85
86
  #
86
87
  # Pre-existing inventory information can only be updated with
87
88
  # [SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
88
- # [AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
89
+ # [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces],
89
90
  # and
90
91
  # [RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
91
92
  #
92
93
  # This feature is only available for users who have Retail Search enabled.
93
- # Please submit a form [here](https://cloud.google.com/contact) to contact
94
- # cloud sales if you are interested in using Retail Search.
94
+ # Please enable Retail Search on Cloud Console before using this feature.
95
95
  rpc :SetInventory, ::Google::Cloud::Retail::V2::SetInventoryRequest, ::Google::Longrunning::Operation
96
96
  # Incrementally adds place IDs to
97
97
  # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids].
@@ -106,8 +106,7 @@ module Google
106
106
  # [ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
107
107
  #
108
108
  # This feature is only available for users who have Retail Search enabled.
109
- # Please submit a form [here](https://cloud.google.com/contact) to contact
110
- # cloud sales if you are interested in using Retail Search.
109
+ # Please enable Retail Search on Cloud Console before using this feature.
111
110
  rpc :AddFulfillmentPlaces, ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Google::Longrunning::Operation
112
111
  # Incrementally removes place IDs from a
113
112
  # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids].
@@ -122,9 +121,48 @@ module Google
122
121
  # [ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
123
122
  #
124
123
  # This feature is only available for users who have Retail Search enabled.
125
- # Please submit a form [here](https://cloud.google.com/contact) to contact
126
- # cloud sales if you are interested in using Retail Search.
124
+ # Please enable Retail Search on Cloud Console before using this feature.
127
125
  rpc :RemoveFulfillmentPlaces, ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Google::Longrunning::Operation
126
+ # Updates local inventory information for a
127
+ # [Product][google.cloud.retail.v2.Product] at a list of places, while
128
+ # respecting the last update timestamps of each inventory field.
129
+ #
130
+ # This process is asynchronous and does not require the
131
+ # [Product][google.cloud.retail.v2.Product] to exist before updating
132
+ # inventory information. If the request is valid, the update will be enqueued
133
+ # and processed downstream. As a consequence, when a response is returned,
134
+ # updates are not immediately manifested in the
135
+ # [Product][google.cloud.retail.v2.Product] queried by
136
+ # [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or
137
+ # [ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
138
+ #
139
+ # Local inventory information can only be modified using this method.
140
+ # [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and
141
+ # [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no
142
+ # effect on local inventories.
143
+ #
144
+ # This feature is only available for users who have Retail Search enabled.
145
+ # Please enable Retail Search on Cloud Console before using this feature.
146
+ rpc :AddLocalInventories, ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Google::Longrunning::Operation
147
+ # Remove local inventory information for a
148
+ # [Product][google.cloud.retail.v2.Product] at a list of places at a removal
149
+ # timestamp.
150
+ #
151
+ # This process is asynchronous. If the request is valid, the removal will be
152
+ # enqueued and processed downstream. As a consequence, when a response is
153
+ # returned, removals are not immediately manifested in the
154
+ # [Product][google.cloud.retail.v2.Product] queried by
155
+ # [GetProduct][google.cloud.retail.v2.ProductService.GetProduct] or
156
+ # [ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
157
+ #
158
+ # Local inventory information can only be removed using this method.
159
+ # [CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] and
160
+ # [UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] has no
161
+ # effect on local inventories.
162
+ #
163
+ # This feature is only available for users who have Retail Search enabled.
164
+ # Please enable Retail Search on Cloud Console before using this feature.
165
+ rpc :RemoveLocalInventories, ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Google::Longrunning::Operation
128
166
  end
129
167
 
130
168
  Stub = Service.rpc_stub_class
@@ -0,0 +1,22 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/cloud/retail/v2/promotion.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("google/cloud/retail/v2/promotion.proto", :syntax => :proto3) do
8
+ add_message "google.cloud.retail.v2.Promotion" do
9
+ optional :promotion_id, :string, 1
10
+ end
11
+ end
12
+ end
13
+
14
+ module Google
15
+ module Cloud
16
+ module Retail
17
+ module V2
18
+ Promotion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Promotion").msgclass
19
+ end
20
+ end
21
+ end
22
+ end