Skip to content

Commit

Permalink
feat: Added force option for Purge APIs
Browse files Browse the repository at this point in the history
feat: Added API service description
fix!: Renamed ProductLevelConfig enum names in CatalogService
BREAKING CHANGE: the renaming is a breaking change but since the API is not used anywhere and client libraries generation has not started, it's a safe change.
fix: a few minor API doc changes.

PiperOrigin-RevId: 339268186
  • Loading branch information
Google APIs authored and copybara-github committed Oct 27, 2020
1 parent c9d7721 commit 6516b52
Show file tree
Hide file tree
Showing 12 changed files with 162 additions and 123 deletions.
49 changes: 31 additions & 18 deletions google/cloud/retail/v2/catalog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,54 @@ option ruby_package = "Google::Cloud::Retail::V2";
// Configures what level the product should be uploaded with regards to
// how users will be send events and how predictions will be made.
message ProductLevelConfig {
// The level of a [Catalog][google.cloud.retail.v2.Catalog] at which the
// [UserEvent][google.cloud.retail.v2.UserEvent]s are uploaded. Acceptable
// values are:
// * `primary`
// * `variant`
// The type of [Product][google.cloud.retail.v2.Product]s allowed to be
// ingested into the catalog. Acceptable values are:
//
// * `primary` (default): You can only ingest PRIMARY
// [Product][google.cloud.retail.v2.Product]s. This means
// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
// can only be empty or set to the same value as
// [Product.id][google.cloud.retail.v2.Product.id].
// * `variant`: You can only ingest VARIANT
// [Product][google.cloud.retail.v2.Product]s. This means
// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
// cannot be empty.
//
// If this field is set to an invalid value other than these, an
// INVALID_ARGUMENT error is returned.
//
// If this field is `primary` and
// [predict_product_level][google.cloud.retail.v2.ProductLevelConfig.predict_product_level]
// is `variant`, an INVALID_ARGUMENT error is returned.
// If this field is `variant` and
// [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
// is `itemGroupId`, an INVALID_ARGUMENT error is returned.
//
// See
// https://cloud.google.com/recommendations-ai/docs/catalog#catalog-levels
// for more details.
string event_product_level = 1;
string ingestion_product_type = 1;

// The level of a [Catalog][google.cloud.retail.v2.Catalog] at which the
// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict]
// is called. Acceptable values are:
// * `primary`
// * `variant`
// Which field of [Merchant Center
//
// Product](https:
// //cloud.google.com/bigquery-transfer/docs/merchant-center-products-schema)
// should be imported as [Product.id][google.cloud.retail.v2.Product.id].
// Acceptable values are:
//
// * `offerId` (default): Import `offerId` as the product ID.
// * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
// API will choose one item from the ones with the same `itemGroupId`, and
// use it to represent the item group.
//
// If this field is set to an invalid value other than these, an
// INVALID_ARGUMENT error is returned.
//
// If this field is `variant` and
// [event_product_level][google.cloud.retail.v2.ProductLevelConfig.event_product_level]
// is `primary`, an INVALID_ARGUMENT error is returned.
// If this field is `itemGroupId` and
// [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
// is `variant`, an INVALID_ARGUMENT error is returned.
//
// See
// https://cloud.google.com/recommendations-ai/docs/catalog#catalog-levels
// for more details.
string predict_product_level = 2;
string merchant_center_product_id_field = 2;
}

// The catalog configuration.
Expand Down
30 changes: 9 additions & 21 deletions google/cloud/retail/v2/product.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,14 @@ message Product {
// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
// this product. Otherwise, an error is thrown.
//
// The primary product may be empty during the creation, but cannot be updated
// from a non-empty string to an empty one. Otherwise an INVALID_ARGUMENT
// error is returned.
// For [Type.PRIMARY][] [Product][google.cloud.retail.v2.Product]s, this field
// can only be empty or set to the same value as
// [id][google.cloud.retail.v2.Product.id].
//
// Should only be set for [Type.VARIANT][]
// [Product][google.cloud.retail.v2.Product]s. A maximum of 2000 products are
// allowed to share the same [Type.PRIMARY][]
// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
// error is returned.
// For [Type.VARIANT][] [Product][google.cloud.retail.v2.Product]s, this field
// cannot be empty. A maximum of 2000 products are allowed to share the same
// [Type.PRIMARY][] [Product][google.cloud.retail.v2.Product]. Otherwise, an
// INVALID_ARGUMENT error is returned.
//
// Google Merchant Center Property
// [item_group_id](https://support.google.com/merchants/answer/6324507).
Expand Down Expand Up @@ -166,19 +165,6 @@ message Product {
// schema.org property [Product.description](https://schema.org/description).
string description = 10;

// Language of the title/description and other string attributes. Use language
// tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt].
//
// The model automatically detects the text language. The
// [Product][google.cloud.retail.v2.Product] can include text in different
// languages, but duplicating [Product][google.cloud.retail.v2.Product]s to
// provide text in multiple languages can result in degraded model
// performance.
//
// Currently, recommendation supports all language codes, while the only
// supported language code for search is "en-US".
string language_code = 11;

// Highly encouraged. Extra product attributes to be included. For example,
// for products, this could include the store name, vendor, style, color, etc.
// These are very strong signals for recommendation model, thus we highly
Expand Down Expand Up @@ -248,6 +234,8 @@ message Product {

// Product images for the product.
//
// A maximum of 300 images are allowed.
//
// Google Merchant Center property
// [image_link](https://support.google.com/merchants/answer/6324350).
// Schema.org property [Product.image](https://schema.org/image).
Expand Down
5 changes: 5 additions & 0 deletions google/cloud/retail/v2/purge_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ message PurgeUserEventsRequest {
//
// The filtering fields are assumed to have an implicit AND.
string filter = 2 [(google.api.field_behavior) = REQUIRED];

// Actually perform the purge.
// If `force` is set to false, the method will return the expected purge count
// without deleting any user events.
bool force = 3;
}

// Response of the PurgeUserEventsRequest. If the long running operation is
Expand Down
7 changes: 5 additions & 2 deletions google/cloud/retail/v2/retail_v2.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type: google.api.Service
config_version: 3
name: retail.googleapis.com
title: Cloud Retail Solution
title: Cloud Retail

apis:
- name: google.cloud.retail.v2.CatalogService
Expand All @@ -20,7 +20,10 @@ types:
- name: google.cloud.retail.v2.RejoinUserEventsResponse

documentation:
summary: TBD
summary: |-
Cloud Retail service enables customers to build end-to-end personalized
recommendation systems without requiring a high level of expertise in
machine learning, recommendation system, or Google Cloud.
backend:
rules:
Expand Down
49 changes: 31 additions & 18 deletions google/cloud/retail/v2alpha/catalog.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,54 @@ option ruby_package = "Google::Cloud::Retail::V2alpha";
// Configures what level the product should be uploaded with regards to
// how users will be send events and how predictions will be made.
message ProductLevelConfig {
// The level of a [Catalog][google.cloud.retail.v2alpha.Catalog] at which the
// [UserEvent][google.cloud.retail.v2alpha.UserEvent]s are uploaded.
// Acceptable values are:
// * `primary`
// * `variant`
// The type of [Product][google.cloud.retail.v2alpha.Product]s allowed to be
// ingested into the catalog. Acceptable values are:
//
// * `primary` (default): You can only ingest PRIMARY
// [Product][google.cloud.retail.v2alpha.Product]s. This means
// [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]
// can only be empty or set to the same value as
// [Product.id][google.cloud.retail.v2alpha.Product.id].
// * `variant`: You can only ingest VARIANT
// [Product][google.cloud.retail.v2alpha.Product]s. This means
// [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]
// cannot be empty.
//
// If this field is set to an invalid value other than these, an
// INVALID_ARGUMENT error is returned.
//
// If this field is `primary` and
// [predict_product_level][google.cloud.retail.v2alpha.ProductLevelConfig.predict_product_level]
// is `variant`, an INVALID_ARGUMENT error is returned.
// If this field is `variant` and
// [merchant_center_product_id_field][google.cloud.retail.v2alpha.ProductLevelConfig.merchant_center_product_id_field]
// is `itemGroupId`, an INVALID_ARGUMENT error is returned.
//
// See
// https://cloud.google.com/recommendations-ai/docs/catalog#catalog-levels
// for more details.
string event_product_level = 1;
string ingestion_product_type = 1;

// The level of a [Catalog][google.cloud.retail.v2alpha.Catalog] at which the
// [PredictionService.Predict][google.cloud.retail.v2alpha.PredictionService.Predict]
// is called. Acceptable values are:
// * `primary`
// * `variant`
// Which field of [Merchant Center
//
// Product](https:
// //cloud.google.com/bigquery-transfer/docs/merchant-center-products-schema)
// should be imported as [Product.id][google.cloud.retail.v2alpha.Product.id].
// Acceptable values are:
//
// * `offerId` (default): Import `offerId` as the product ID.
// * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
// API will choose one item from the ones with the same `itemGroupId`, and
// use it to represent the item group.
//
// If this field is set to an invalid value other than these, an
// INVALID_ARGUMENT error is returned.
//
// If this field is `variant` and
// [event_product_level][google.cloud.retail.v2alpha.ProductLevelConfig.event_product_level]
// is `primary`, an INVALID_ARGUMENT error is returned.
// If this field is `itemGroupId` and
// [ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type]
// is `variant`, an INVALID_ARGUMENT error is returned.
//
// See
// https://cloud.google.com/recommendations-ai/docs/catalog#catalog-levels
// for more details.
string predict_product_level = 2;
string merchant_center_product_id_field = 2;
}

// The catalog configuration.
Expand Down
31 changes: 10 additions & 21 deletions google/cloud/retail/v2alpha/product.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ message Product {
// [id][google.cloud.retail.v2alpha.Product.id], with the same parent branch
// with this product. Otherwise, an error is thrown.
//
// The primary product may be empty during the creation, but cannot be updated
// from a non-empty string to an empty one. Otherwise an INVALID_ARGUMENT
// error is returned.
//
// Should only be set for
// [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]
// [Product][google.cloud.retail.v2alpha.Product]s. A maximum of 2000 products
// are allowed to share the same
// For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY]
// [Product][google.cloud.retail.v2alpha.Product]s, this field can only be
// empty or set to the same value as
// [id][google.cloud.retail.v2alpha.Product.id].
//
// For [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]
// [Product][google.cloud.retail.v2alpha.Product]s, this field cannot be
// empty. A maximum of 2000 products are allowed to share the same
// [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY]
// [Product][google.cloud.retail.v2alpha.Product]. Otherwise, an
// INVALID_ARGUMENT error is returned.
Expand Down Expand Up @@ -168,19 +168,6 @@ message Product {
// schema.org property [Product.description](https://schema.org/description).
string description = 10;

// Language of the title/description and other string attributes. Use language
// tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt].
//
// The model automatically detects the text language. The
// [Product][google.cloud.retail.v2alpha.Product] can include text in
// different languages, but duplicating
// [Product][google.cloud.retail.v2alpha.Product]s to provide text in multiple
// languages can result in degraded model performance.
//
// Currently, recommendation supports all language codes, while the only
// supported language code for search is "en-US".
string language_code = 11;

// Highly encouraged. Extra product attributes to be included. For example,
// for products, this could include the store name, vendor, style, color, etc.
// These are very strong signals for recommendation model, thus we highly
Expand Down Expand Up @@ -253,6 +240,8 @@ message Product {

// Product images for the product.
//
// A maximum of 300 images are allowed.
//
// Google Merchant Center property
// [image_link](https://support.google.com/merchants/answer/6324350).
// Schema.org property [Product.image](https://schema.org/image).
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/retail/v2alpha/purge_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ message PurgeProductsRequest {
// Required. Filter matching the products to be purged. Only supported value
// at the moment is "*" (all items).
string filter = 2 [(google.api.field_behavior) = REQUIRED];

// Actually perform the purge.
// If `force` is set to false, the method will return the expected purge count
// without deleting any products.
bool force = 3;
}

// Response of the PurgeProductsRequest. If the long running operation is
Expand Down Expand Up @@ -82,6 +87,11 @@ message PurgeUserEventsRequest {
//
// The filtering fields are assumed to have an implicit AND.
string filter = 2 [(google.api.field_behavior) = REQUIRED];

// Actually perform the purge.
// If `force` is set to false, the method will return the expected purge count
// without deleting any user events.
bool force = 3;
}

// Response of the PurgeUserEventsRequest. If the long running operation is
Expand Down
7 changes: 5 additions & 2 deletions google/cloud/retail/v2alpha/retail_v2alpha.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type: google.api.Service
config_version: 3
name: retail.googleapis.com
title: Cloud Retail Solution
title: Cloud Retail

apis:
- name: google.cloud.retail.v2alpha.CatalogService
Expand All @@ -24,7 +24,10 @@ types:
- name: google.cloud.retail.v2alpha.RejoinUserEventsResponse

documentation:
summary: TBD
summary: |-
Cloud Retail service enables customers to build end-to-end personalized
recommendation systems without requiring a high level of expertise in
machine learning, recommendation system, or Google Cloud.
backend:
rules:
Expand Down
Loading

0 comments on commit 6516b52

Please sign in to comment.