theQRL/block-explorer

View on GitHub
private/google/cloud/retail/v2alpha/product_service.proto

Summary

Maintainability
Test Coverage
// Copyright 2020 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.cloud.retail.v2alpha;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/retail/v2alpha/export_config.proto";
import "google/cloud/retail/v2alpha/import_config.proto";
import "google/cloud/retail/v2alpha/product.proto";
import "google/cloud/retail/v2alpha/purge_config.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.Retail.V2Alpha";
option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail";
option java_multiple_files = true;
option java_outer_classname = "ProductServiceProto";
option java_package = "com.google.cloud.retail.v2alpha";
option objc_class_prefix = "RETAIL";
option php_namespace = "Google\\Cloud\\Retail\\V2alpha";
option ruby_package = "Google::Cloud::Retail::V2alpha";

// Service for ingesting [Product][google.cloud.retail.v2alpha.Product]
// information of the customer's website.
service ProductService {
  option (google.api.default_host) = "retail.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Creates a [Product][google.cloud.retail.v2alpha.Product].
  rpc CreateProduct(CreateProductRequest) returns (Product) {
    option (google.api.http) = {
      post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products"
      body: "product"
    };
    option (google.api.method_signature) = "parent,product,product_id";
  }

  // Gets a [Product][google.cloud.retail.v2alpha.Product].
  rpc GetProduct(GetProductRequest) returns (Product) {
    option (google.api.http) = {
      get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Updates a [Product][google.cloud.retail.v2alpha.Product]. Non-existing
  // items will be created.
  rpc UpdateProduct(UpdateProductRequest) returns (Product) {
    option (google.api.http) = {
      patch: "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}"
      body: "product"
    };
    option (google.api.method_signature) = "product,update_mask";
  }

  // Deletes a [Product][google.cloud.retail.v2alpha.Product].
  rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Permanently deletes all [Product][google.cloud.retail.v2alpha.Product]s
  // under a branch.
  //
  // Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s,
  // this operation could take hours to complete. To get a sample of
  // [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set
  // [PurgeProductsRequest.force][] to false.
  rpc PurgeProducts(PurgeProductsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge"
      body: "*"
    };
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.retail.v2alpha.PurgeProductsResponse"
      metadata_type: "google.cloud.retail.v2alpha.PurgeMetadata"
    };
  }

  // Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s.
  //
  // Request processing may be synchronous. No partial updating is supported.
  // Non-existing items are created.
  //
  // Note that it is possible for a subset of the
  // [Product][google.cloud.retail.v2alpha.Product]s to be successfully updated.
  rpc ImportProducts(ImportProductsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import"
      body: "*"
    };
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.retail.v2alpha.ImportProductsResponse"
      metadata_type: "google.cloud.retail.v2alpha.ImportMetadata"
    };
  }

  // Export of multiple [Product][google.cloud.retail.v2alpha.Product]s.
  rpc ExportProducts(ExportProductsRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:export"
      body: "*"
    };
    option (google.longrunning.operation_info) = {
      response_type: "google.cloud.retail.v2alpha.ExportProductsResponse"
      metadata_type: "google.cloud.retail.v2alpha.ExportMetadata"
    };
  }
}

// Request message for [CreateProduct][] method.
message CreateProductRequest {
  // Required. The parent catalog resource name, such as
  //
  // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch".
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" }
  ];

  // Required. The [Product][google.cloud.retail.v2alpha.Product] to create.
  Product product = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The ID to use for the
  // [Product][google.cloud.retail.v2alpha.Product], which will become the final
  // component of the [Product.name][google.cloud.retail.v2alpha.Product.name].
  //
  // If the caller does not have permission to create the
  // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or
  // not it exists, a PERMISSION_DENIED error is returned.
  //
  // This field must be unique among all
  // [Product][google.cloud.retail.v2alpha.Product]s with the same
  // [parent][google.cloud.retail.v2alpha.CreateProductRequest.parent].
  // Otherwise, an ALREADY_EXISTS error is returned.
  //
  // This field must be a UTF-8 encoded string with a length limit of 128
  // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  string product_id = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request message for [GetProduct][] method.
message GetProductRequest {
  // Required. Full resource name of
  // [Product][google.cloud.retail.v2alpha.Product], such as
  //
  // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
  //
  // If the caller does not have permission to access the
  // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or
  // not it exists, a PERMISSION_DENIED error is returned.
  //
  // If the requested [Product][google.cloud.retail.v2alpha.Product] does not
  // exist, a NOT_FOUND error is returned.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "retail.googleapis.com/Product" }
  ];
}

// Request message for [UpdateProduct][] method.
message UpdateProductRequest {
  // Required. The product to update/create.
  //
  // If the caller does not have permission to update the
  // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or
  // not it exists, a PERMISSION_DENIED error is returned.
  //
  // If the [Product][google.cloud.retail.v2alpha.Product] to update does not
  // exist, a NOT_FOUND error is returned.
  Product product = 1 [(google.api.field_behavior) = REQUIRED];

  // Indicates which fields in the provided
  // [Product][google.cloud.retail.v2alpha.Product] to update. The immutable and
  // output only fields are NOT supported. If not set, all supported fields (the
  // fields that are neither immutable nor output only) are updated.
  //
  // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
  // is returned.
  google.protobuf.FieldMask update_mask = 2;
}

// Request message for [DeleteProduct][] method.
message DeleteProductRequest {
  // Required. Full resource name of
  // [Product][google.cloud.retail.v2alpha.Product], such as
  //
  // "projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id".
  //
  // If the caller does not have permission to delete the
  // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or
  // not it exists, a PERMISSION_DENIED error is returned.
  //
  // If the [Product][google.cloud.retail.v2alpha.Product] to delete does not
  // exist, a NOT_FOUND error is returned.
  //
  // The [Product][google.cloud.retail.v2alpha.Product] to delete can neither be
  // a non-empty
  // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]
  // [Product][google.cloud.retail.v2alpha.Product] nor a
  // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY]
  // [Product][google.cloud.retail.v2alpha.Product] with more than one
  // [variants][google.cloud.retail.v2alpha.Product.Type.VARIANT]. Otherwise, a
  // FAILED_PRECONDITION error is returned.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "retail.googleapis.com/Product" }
  ];
}