From 03e16263ceb8e1cbfd570c4e49d23dc2ecd3a5b8 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Thu, 11 Apr 2024 09:17:57 -0700 Subject: [PATCH] feat: Initial LFP sub-API publication PiperOrigin-RevId: 623847465 --- .../shopping/merchant/lfp/v1beta/BUILD.bazel | 406 ++++++++++++++++++ .../lfp/v1beta/lfp_grpc_service_config.json | 17 + .../merchant/lfp/v1beta/lfpinventory.proto | 149 +++++++ .../merchant/lfp/v1beta/lfpsale.proto | 122 ++++++ .../merchant/lfp/v1beta/lfpstore.proto | 249 +++++++++++ .../lfp/v1beta/merchantapi_v1beta.yaml | 66 +++ 6 files changed, 1009 insertions(+) create mode 100644 google/shopping/merchant/lfp/v1beta/BUILD.bazel create mode 100644 google/shopping/merchant/lfp/v1beta/lfp_grpc_service_config.json create mode 100644 google/shopping/merchant/lfp/v1beta/lfpinventory.proto create mode 100644 google/shopping/merchant/lfp/v1beta/lfpsale.proto create mode 100644 google/shopping/merchant/lfp/v1beta/lfpstore.proto create mode 100644 google/shopping/merchant/lfp/v1beta/merchantapi_v1beta.yaml diff --git a/google/shopping/merchant/lfp/v1beta/BUILD.bazel b/google/shopping/merchant/lfp/v1beta/BUILD.bazel new file mode 100644 index 0000000000..d3178f62a8 --- /dev/null +++ b/google/shopping/merchant/lfp/v1beta/BUILD.bazel @@ -0,0 +1,406 @@ +# This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/rules_gapic/tree/master/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * extra_protoc_file_parameters +# The complete list of preserved parameters can be found in the source code. + +# buildifier: disable=load-on-top + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +# buildifier: disable=same-origin-load +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") +load("@rules_proto//proto:defs.bzl", "proto_library") + +proto_library( + name = "lfp_proto", + srcs = [ + "lfpinventory.proto", + "lfpsale.proto", + "lfpstore.proto", + ], + deps = [ + "//google/api:annotations_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/api:field_info_proto", + "//google/api:resource_proto", + "//google/shopping/type:type_proto", # Manual fix. Original :types_proto + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library_with_info( + name = "lfp_proto_with_info", + deps = [ + ":lfp_proto", + "//google/cloud:common_resources_proto", + ], +) + +############################################################################## +# Java +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "java_gapic_assembly_gradle_pkg", + "java_gapic_library", + "java_gapic_test", + "java_grpc_library", + "java_proto_library", +) + +java_proto_library( + name = "lfp_java_proto", + deps = [":lfp_proto"], +) + +java_grpc_library( + name = "lfp_java_grpc", + srcs = [":lfp_proto"], + deps = [":lfp_java_proto"], +) + +java_gapic_library( + name = "lfp_java_gapic", + srcs = [":lfp_proto_with_info"], + gapic_yaml = None, + grpc_service_config = "lfp_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + test_deps = [ + ":lfp_java_grpc", + "//google/shopping/type:type_proto" + ], + transport = "grpc+rest", + deps = [ + ":lfp_java_proto", + "//google/shopping/type:type_java_proto", # Added manually + ], +) + +java_gapic_test( + name = "lfp_java_gapic_test_suite", + test_classes = [ + "com.google.shopping.merchant.lfp.v1beta.LfpInventoryServiceClientHttpJsonTest", + "com.google.shopping.merchant.lfp.v1beta.LfpInventoryServiceClientTest", + "com.google.shopping.merchant.lfp.v1beta.LfpSaleServiceClientHttpJsonTest", + "com.google.shopping.merchant.lfp.v1beta.LfpSaleServiceClientTest", + "com.google.shopping.merchant.lfp.v1beta.LfpStoreServiceClientHttpJsonTest", + "com.google.shopping.merchant.lfp.v1beta.LfpStoreServiceClientTest", + ], + runtime_deps = [":lfp_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-merchant-lfp-v1beta-java", + include_samples = True, + transport = "grpc+rest", + deps = [ + ":lfp_java_gapic", + ":lfp_java_grpc", + ":lfp_java_proto", + ":lfp_proto", + ], +) + +############################################################################## +# Go +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", +) + +go_proto_library( + name = "lfp_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb", + protos = [":lfp_proto"], + deps = [ + "//google/api:annotations_go_proto", + "//google/shopping/type:type_go_proto", # Manual fix. Original :types_go_proto + ], +) + +go_gapic_library( + name = "lfp_go_gapic", + srcs = [":lfp_proto_with_info"], + grpc_service_config = "lfp_grpc_service_config.json", + importpath = "cloud.google.com/go/shopping/merchant/lfp/apiv1beta;lfp", + metadata = True, + release_level = "beta", + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + transport = "grpc+rest", + deps = [ + ":lfp_go_proto", + ], +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-merchant-lfp-v1beta-go", + deps = [ + ":lfp_go_gapic", + ":lfp_go_gapic_srcjar-metadata.srcjar", + ":lfp_go_gapic_srcjar-snippets.srcjar", + ":lfp_go_gapic_srcjar-test.srcjar", + ":lfp_go_proto", + ], +) + +############################################################################## +# Python +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "py_gapic_assembly_pkg", + "py_gapic_library", + "py_import", +) + +py_import( + name = "shopping_type", + srcs = [ + "//google/shopping/type:type_py_gapic", +], +) + +py_gapic_library( + name = "lfp_py_gapic", + srcs = [":lfp_proto"], + grpc_service_config = "lfp_grpc_service_config.json", + opt_args = [ + "proto-plus-deps=google.shopping.type", # Added manually + ], + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + transport = "grpc+rest", + deps = [ + ":shopping_type", # Added manually + ], +) + +py_test( + name = "lfp_py_gapic_test", + srcs = [ + "lfp_py_gapic_pytest.py", + "lfp_py_gapic_test.py", + ], + legacy_create_init = False, + deps = [":lfp_py_gapic"], +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "merchant-lfp-v1beta-py", + deps = [ + ":lfp_py_gapic", + ], +) + +############################################################################## +# PHP +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_proto_library", +) + +php_proto_library( + name = "lfp_php_proto", + deps = [":lfp_proto"], +) + +php_gapic_library( + name = "lfp_php_gapic", + srcs = [":lfp_proto_with_info"], + grpc_service_config = "lfp_grpc_service_config.json", + migration_mode = "NEW_SURFACE_ONLY", + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + transport = "grpc+rest", + deps = [ + ":lfp_php_proto", + ], +) + +# Open Source Packages +php_gapic_assembly_pkg( + name = "google-cloud-merchant-lfp-v1beta-php", + deps = [ + ":lfp_php_gapic", + ":lfp_php_proto", + ], +) + +############################################################################## +# Node.js +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "nodejs_gapic_assembly_pkg", + "nodejs_gapic_library", +) + +nodejs_gapic_library( + name = "lfp_nodejs_gapic", + package_name = "@google-cloud/lfp", + src = ":lfp_proto_with_info", + extra_protoc_parameters = ["metadata"], + grpc_service_config = "lfp_grpc_service_config.json", + package = "google.shopping.merchant.lfp.v1beta", + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + transport = "grpc+rest", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "merchant-lfp-v1beta-nodejs", + deps = [ + ":lfp_nodejs_gapic", + ":lfp_proto", + "//google/shopping/type:type_proto" # Added manually + ], +) + +############################################################################## +# Ruby +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "ruby_cloud_gapic_library", + "ruby_gapic_assembly_pkg", + "ruby_grpc_library", + "ruby_proto_library", +) + +ruby_proto_library( + name = "lfp_ruby_proto", + deps = [":lfp_proto"], +) + +ruby_grpc_library( + name = "lfp_ruby_grpc", + srcs = [":lfp_proto"], + deps = [":lfp_ruby_proto"], +) + +ruby_cloud_gapic_library( + name = "lfp_ruby_gapic", + srcs = [":lfp_proto_with_info"], + extra_protoc_parameters = [ + "ruby-cloud-gem-name=google-cloud-merchant-lfp-v1beta", + ], + grpc_service_config = "lfp_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + transport = "grpc+rest", + deps = [ + ":lfp_ruby_grpc", + ":lfp_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-merchant-lfp-v1beta-ruby", + deps = [ + ":lfp_ruby_gapic", + ":lfp_ruby_grpc", + ":lfp_ruby_proto", + ], +) + +############################################################################## +# C# +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "csharp_gapic_assembly_pkg", + "csharp_gapic_library", + "csharp_grpc_library", + "csharp_proto_library", +) + +csharp_proto_library( + name = "lfp_csharp_proto", + extra_opts = [], + deps = [":lfp_proto"], +) + +csharp_grpc_library( + name = "lfp_csharp_grpc", + srcs = [":lfp_proto"], + deps = [":lfp_csharp_proto"], +) + +csharp_gapic_library( + name = "lfp_csharp_gapic", + srcs = [":lfp_proto_with_info"], + common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json", + grpc_service_config = "lfp_grpc_service_config.json", + rest_numeric_enums = True, + service_yaml = "merchantapi_v1beta.yaml", + transport = "grpc+rest", + deps = [ + ":lfp_csharp_grpc", + ":lfp_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-merchant-lfp-v1beta-csharp", + deps = [ + ":lfp_csharp_gapic", + ":lfp_csharp_grpc", + ":lfp_csharp_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +# buildifier: disable=same-origin-load +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_grpc_library", + "cc_proto_library", +) + +cc_proto_library( + name = "lfp_cc_proto", + deps = [":lfp_proto"], +) + +cc_grpc_library( + name = "lfp_cc_grpc", + srcs = [":lfp_proto"], + grpc_only = True, + deps = [":lfp_cc_proto"], +) diff --git a/google/shopping/merchant/lfp/v1beta/lfp_grpc_service_config.json b/google/shopping/merchant/lfp/v1beta/lfp_grpc_service_config.json new file mode 100644 index 0000000000..0e2eeac0d3 --- /dev/null +++ b/google/shopping/merchant/lfp/v1beta/lfp_grpc_service_config.json @@ -0,0 +1,17 @@ +{ + "methodConfig": [{ + "name": [ + { "service": "google.shopping.merchant.lfp.v1beta.LfpInventoryService" }, + { "service": "google.shopping.merchant.lfp.v1beta.LfpStoreService" }, + { "service": "google.shopping.merchant.lfp.v1beta.LfpSaleService" } + ], + "timeout": "60s", + "retryPolicy": { + "maxAttempts": 5, + "initialBackoff": "1s", + "maxBackoff": "10s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": ["UNAVAILABLE"] + } + }] +} diff --git a/google/shopping/merchant/lfp/v1beta/lfpinventory.proto b/google/shopping/merchant/lfp/v1beta/lfpinventory.proto new file mode 100644 index 0000000000..9030d69a9d --- /dev/null +++ b/google/shopping/merchant/lfp/v1beta/lfpinventory.proto @@ -0,0 +1,149 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.shopping.merchant.lfp.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/shopping/type/types.proto"; + +option go_package = "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb;lfppb"; +option java_multiple_files = true; +option java_outer_classname = "LfpInventoryProto"; +option java_package = "com.google.shopping.merchant.lfp.v1beta"; +option (google.api.resource_definition) = { + type: "merchantapi.googleapis.com/Account" + pattern: "accounts/{account}" +}; + +// Service for a [LFP +// partner](https://support.google.com/merchants/answer/7676652) to submit local +// inventories for a merchant. +service LfpInventoryService { + option (google.api.default_host) = "merchantapi.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content"; + + // Inserts a `LfpInventory` resource for the given target merchant account. If + // the resource already exists, it will be replaced. The inventory + // automatically expires after 30 days. + rpc InsertLfpInventory(InsertLfpInventoryRequest) returns (LfpInventory) { + option (google.api.http) = { + post: "/lfp/v1beta/{parent=accounts/*}/lfpInventories:insert" + body: "lfp_inventory" + }; + } +} + +// Local Inventory for the merchant. +message LfpInventory { + option (google.api.resource) = { + type: "merchantapi.googleapis.com/LfpInventory" + pattern: "accounts/{account}/lfpInventories/{target_merchant}~{store_code}~{offer}" + plural: "lfpInventories" + singular: "lfpInventory" + }; + + // Output only. Identifier. The name for the `LfpInventory` resource. + // Format: + // `accounts/{account}/lfpInventories/{target_merchant}~{store_code}~{offer}` + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IDENTIFIER + ]; + + // Required. The Merchant Center ID of the merchant to submit the inventory + // for. + int64 target_account = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The identifier of the merchant's store. Either the store code + // inserted through `InsertLfpStore` or the store code in the Business + // Profile. + string store_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Immutable. A unique identifier for the product. If both + // inventories and sales are submitted for a merchant, this id should match + // for the same product. + // + // **Note**: if the merchant sells the same product new and used, they should + // have different IDs. + string offer_id = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. The [CLDR territory + // code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml) + // for the country where the product is sold. + string region_code = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The two-letter ISO 639-1 language code for the item. + string content_language = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The Global Trade Item Number of the product. + optional string gtin = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The current price of the product. + google.shopping.type.Price price = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Availability of the product at this store. + // For accepted attribute values, see the [local product inventory feed + // specification](https://support.google.com/merchants/answer/3061342) + string availability = 9 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Quantity of the product available at this store. Must be greater + // than or equal to zero. + optional int64 quantity = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The time when the inventory is collected. If not set, it will be + // set to the time when the inventory is submitted. + google.protobuf.Timestamp collection_time = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Supported pickup method for this offer. Unless the value is "not + // supported", this field must be submitted together with `pickupSla`. For + // accepted attribute values, see the [local product inventory feed + // specification](https://support.google.com/merchants/answer/3061342). + optional string pickup_method = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Expected date that an order will be ready for pickup relative to + // the order date. Must be submitted together with `pickupMethod`. For + // accepted attribute values, see the [local product inventory feed + // specification](https://support.google.com/merchants/answer/3061342). + optional string pickup_sla = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [feed + // label](https://developers.google.com/shopping-content/guides/products/feed-labels) + // for the product. If this is not set, it will default to `regionCode`. + optional string feed_label = 14 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for the `InsertLfpInventory` method. +message InsertLfpInventoryRequest { + // Required. The LFP provider account. + // Format: `accounts/{account}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "merchantapi.googleapis.com/LfpInventory" + } + ]; + + // Required. The inventory to insert. + LfpInventory lfp_inventory = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/google/shopping/merchant/lfp/v1beta/lfpsale.proto b/google/shopping/merchant/lfp/v1beta/lfpsale.proto new file mode 100644 index 0000000000..8540eb6cc7 --- /dev/null +++ b/google/shopping/merchant/lfp/v1beta/lfpsale.proto @@ -0,0 +1,122 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.shopping.merchant.lfp.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/field_info.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/shopping/type/types.proto"; + +option go_package = "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb;lfppb"; +option java_multiple_files = true; +option java_outer_classname = "LfpSaleProto"; +option java_package = "com.google.shopping.merchant.lfp.v1beta"; + +// Service for a [LFP +// partner](https://support.google.com/merchants/answer/7676652) to submit sales +// data for a merchant. +service LfpSaleService { + option (google.api.default_host) = "merchantapi.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content"; + + // Inserts a `LfpSale` for the given merchant. + rpc InsertLfpSale(InsertLfpSaleRequest) returns (LfpSale) { + option (google.api.http) = { + post: "/lfp/v1beta/{parent=accounts/*}/lfpSales:insert" + body: "lfp_sale" + }; + } +} + +// A sale for the merchant. +message LfpSale { + option (google.api.resource) = { + type: "merchantapi.googleapis.com/LfpSale" + pattern: "accounts/{account}/lfpSales/{sale}" + plural: "lfpSales" + singular: "lfpSale" + }; + + // Output only. Identifier. The name of the `LfpSale` resource. + // Format: + // `accounts/{account}/lfpSales/{sale}` + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IDENTIFIER + ]; + + // Required. The Merchant Center ID of the merchant to submit the sale for. + int64 target_account = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The identifier of the merchant's store. Either a `storeCode` + // inserted through the API or the code of the store in the Business Profile. + string store_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. A unique identifier for the product. If both inventories and + // sales are submitted for a merchant, this id should match for the same + // product. + // + // **Note**: if the merchant sells the same product new and used, they should + // have different IDs. + string offer_id = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The [CLDR territory + // code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml) + // for the country where the product is sold. + string region_code = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. The two-letter ISO 639-1 language code for the item. + string content_language = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Global Trade Item Number of the sold product. + string gtin = 7 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unit price of the product. + google.shopping.type.Price price = 8 [(google.api.field_behavior) = REQUIRED]; + + // Required. The relative change of the available quantity. Negative for items + // returned. + int64 quantity = 9 [(google.api.field_behavior) = REQUIRED]; + + // Required. The timestamp for the sale. + google.protobuf.Timestamp sale_time = 10 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. System generated globally unique ID for the `LfpSale`. + optional string uid = 11 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Optional. The [feed + // label](https://developers.google.com/shopping-content/guides/products/feed-labels) + // for the product. If this is not set, it will default to `regionCode`. + optional string feed_label = 12 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for the InsertLfpSale method. +message InsertLfpSaleRequest { + // Required. The LFP provider account. + // Format: `accounts/{lfp_partner}` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The sale to insert. + LfpSale lfp_sale = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/google/shopping/merchant/lfp/v1beta/lfpstore.proto b/google/shopping/merchant/lfp/v1beta/lfpstore.proto new file mode 100644 index 0000000000..c8eff1f485 --- /dev/null +++ b/google/shopping/merchant/lfp/v1beta/lfpstore.proto @@ -0,0 +1,249 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.shopping.merchant.lfp.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "cloud.google.com/go/shopping/merchant/lfp/apiv1beta/lfppb;lfppb"; +option java_multiple_files = true; +option java_outer_classname = "LfpStoreProto"; +option java_package = "com.google.shopping.merchant.lfp.v1beta"; + +// Service for a [LFP +// partner](https://support.google.com/merchants/answer/7676652) to submit local +// stores for a merchant. +service LfpStoreService { + option (google.api.default_host) = "merchantapi.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content"; + + // Retrieves information about a store. + rpc GetLfpStore(GetLfpStoreRequest) returns (LfpStore) { + option (google.api.http) = { + get: "/lfp/v1beta/{name=accounts/*/lfpStores/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Inserts a store for the target merchant. If the store with the same store + // code already exists, it will be replaced. + rpc InsertLfpStore(InsertLfpStoreRequest) returns (LfpStore) { + option (google.api.http) = { + post: "/lfp/v1beta/{parent=accounts/*}/lfpStores:insert" + body: "lfp_store" + }; + option (google.api.method_signature) = "parent,lfp_store"; + } + + // Deletes a store for a target merchant. + rpc DeleteLfpStore(DeleteLfpStoreRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/lfp/v1beta/{name=accounts/*/lfpStores/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists the stores of the target merchant, specified by the filter in + // `ListLfpStoresRequest`. + rpc ListLfpStores(ListLfpStoresRequest) returns (ListLfpStoresResponse) { + option (google.api.http) = { + get: "/lfp/v1beta/{parent=accounts/*}/lfpStores" + }; + option (google.api.method_signature) = "parent"; + } +} + +// A store for the merchant. This will be used to match to a Google Business +// Profile listing for the target merchant. If a matching listing can't be +// found, the inventories or sales submitted with the store code will not be +// used. +message LfpStore { + option (google.api.resource) = { + type: "merchantapi.googleapis.com/LfpStore" + pattern: "accounts/{account}/lfpStores/{target_merchant}~{store_code}" + plural: "lfpStores" + singular: "lfpStore" + }; + + // The state of matching `LfpStore` to a Google Business Profile listing. + enum StoreMatchingState { + // Store matching state unspecified. + STORE_MATCHING_STATE_UNSPECIFIED = 0; + + // The `LfpStore` is successfully matched with a Google Business Profile + // store. + STORE_MATCHING_STATE_MATCHED = 1; + + // The `LfpStore` is not matched with a Google Business Profile store. + STORE_MATCHING_STATE_FAILED = 2; + } + + // Output only. Identifier. The name of the `LfpStore` resource. + // Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IDENTIFIER + ]; + + // Required. The Merchant Center id of the merchant to submit the store for. + int64 target_account = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Immutable. A store identifier that is unique for the target + // merchant. + string store_code = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. The street address of the store. + // Example: 1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA. + string store_address = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The merchant or store name. + optional string store_name = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The store phone number in + // [E.164](https://en.wikipedia.org/wiki/E.164) format. Example: + // `+15556767888` + optional string phone_number = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The website URL for the store or merchant. + optional string website_uri = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. [Google My Business category + // id](https://gcid-explorer.corp.google.com/static/gcid.html). + repeated string gcid_category = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The [Google Place + // Id](https://developers.google.com/maps/documentation/places/web-service/place-id#id-overview) + // of the store location. + optional string place_id = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Output only. The state of matching to a Google Business Profile + // listing. See + // [matchingStateHint][google.shopping.merchant.lfp.v1beta.LfpStore.matching_state_hint] + // for further details if no match is found. + StoreMatchingState matching_state = 10 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Optional. Output only. The hint of why the matching has failed. This is + // only set when + // [matchingState][google.shopping.merchant.lfp.v1beta.LfpStore.matching_state]=`STORE_MATCHING_STATE_FAILED`. + // + // Possible values are: + // + // - "`linked-store-not-found`": There aren't any Google Business + // Profile stores available for matching. + // - "`store-match-not-found`": The provided `LfpStore` couldn't be matched to + // any of the connected Google Business Profile stores. Merchant Center + // account is connected correctly and stores are available on Google Business + // Profile, but the `LfpStore` location address does not match with Google + // Business Profile stores' addresses. Update the `LfpStore` address or Google + // Business Profile store address to match correctly. + // - "`store-match-unverified`": The provided `LfpStore` couldn't be matched + // to any of the connected Google Business Profile stores, as the matched + // Google Business Profile store is unverified. Go through the Google Business + // Profile verification process to match correctly. + optional string matching_state_hint = 11 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; +} + +// Request message for the `GetLfpStore` method. +message GetLfpStoreRequest { + // Required. The name of the store to retrieve. + // Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "merchantapi.googleapis.com/LfpStore" + } + ]; +} + +// Request message for the InsertLfpStore method. +message InsertLfpStoreRequest { + // Required. The LFP provider account + // Format: `accounts/{account}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "merchantapi.googleapis.com/LfpStore" + } + ]; + + // Required. The store to insert. + LfpStore lfp_store = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for the DeleteLfpStore method. +message DeleteLfpStoreRequest { + // Required. The name of the store to delete for the target merchant account. + // Format: `accounts/{account}/lfpStores/{target_merchant}~{store_code}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "merchantapi.googleapis.com/LfpStore" + } + ]; +} + +// Request message for the ListLfpStores method. +message ListLfpStoresRequest { + // Required. The LFP partner. + // Format: `accounts/{account}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "merchantapi.googleapis.com/LfpStore" + } + ]; + + // Required. The Merchant Center id of the merchant to list stores for. + int64 target_account = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The maximum number of `LfpStore` resources for the given account + // to return. The service returns fewer than this value if the number of + // stores for the given account is less than the `pageSize`. The default value + // is 250. The maximum value is 1000; If a value higher than the maximum is + // specified, then the `pageSize` will default to the maximum. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token, received from a previous `ListLfpStoresRequest` + // call. Provide the page token to retrieve the subsequent page. When + // paginating, all other parameters provided to `ListLfpStoresRequest` must + // match the call that provided the page token. The token returned as + // [nextPageToken][google.shopping.merchant.lfp.v1beta.ListLfpStoresResponse.next_page_token] + // in the response to the previous request. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for the ListLfpStores method. +message ListLfpStoresResponse { + // The stores from the specified merchant. + repeated LfpStore lfp_stores = 1; + + // A token, which can be sent as `pageToken` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} diff --git a/google/shopping/merchant/lfp/v1beta/merchantapi_v1beta.yaml b/google/shopping/merchant/lfp/v1beta/merchantapi_v1beta.yaml new file mode 100644 index 0000000000..13914dccdc --- /dev/null +++ b/google/shopping/merchant/lfp/v1beta/merchantapi_v1beta.yaml @@ -0,0 +1,66 @@ +type: google.api.Service +config_version: 3 +name: merchantapi.googleapis.com +title: Merchant API + +apis: +- name: google.shopping.merchant.lfp.v1beta.LfpInventoryService +- name: google.shopping.merchant.lfp.v1beta.LfpSaleService +- name: google.shopping.merchant.lfp.v1beta.LfpStoreService + +documentation: + summary: Programmatically manage your Merchant Center accounts. + +authentication: + rules: + - selector: google.shopping.merchant.lfp.v1beta.LfpInventoryService.InsertLfpInventory + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/content + - selector: google.shopping.merchant.lfp.v1beta.LfpSaleService.InsertLfpSale + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/content + - selector: 'google.shopping.merchant.lfp.v1beta.LfpStoreService.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/content + +publishing: + new_issue_uri: https://issuetracker.google.com/issues/new?component=171084&template=555201 + documentation_uri: https://developers.google.com/merchant/api + api_short_name: merchantapi + github_label: 'api: merchantapi' + doc_tag_prefix: merchantapi + organization: SHOPPING + library_settings: + - version: google.shopping.merchant.lfp.v1beta + launch_stage: BETA + java_settings: + common: + destinations: + - PACKAGE_MANAGER + php_settings: + common: + destinations: + - PACKAGE_MANAGER + python_settings: + common: + destinations: + - PACKAGE_MANAGER + node_settings: + common: + destinations: + - PACKAGE_MANAGER + dotnet_settings: + common: + destinations: + - PACKAGE_MANAGER + ruby_settings: + common: + destinations: + - PACKAGE_MANAGER + go_settings: + common: + destinations: + - PACKAGE_MANAGER