GCP.Retail reference
CatalogsBranchesProduct
Section titled “CatalogsBranchesProduct”Source:
src/GCP/Retail/CatalogsBranchesProduct.ts
A Retail product under a catalog branch.
Without labels, ownership rests on the deterministic id: read reports a
resource it finds without prior state as unowned (adopt it with --adopt).
Catalog, location, branch, product id, and type are immutable. Title,
description, categories, price, and tags update in place.
CatalogsBranchesProduct: Creating a Product
Section titled “CatalogsBranchesProduct: Creating a Product”const product = yield* GCP.Retail.CatalogsBranchesProduct("Shirt", { title: "Cotton tee", categories: ["Apparel > T-Shirts"], priceInfo: { currencyCode: "USD", price: 20 },});CatalogsControl
Section titled “CatalogsControl”Source:
src/GCP/Retail/CatalogsControl.ts
A Retail serving control on a catalog.
Without labels, ownership rests on the deterministic id: read reports a
resource it finds without prior state as unowned (adopt it with --adopt).
Parent, control id, and solution types are immutable. Display name and rule
actions update in place unless the action oneof changes, which replaces the
control.
CatalogsControl: Creating a Control
Section titled “CatalogsControl: Creating a Control”const control = yield* GCP.Retail.CatalogsControl("Greetings", { displayName: "greetings", synonyms: ["hello", "hi"],});CatalogsModel
Section titled “CatalogsModel”Source:
src/GCP/Retail/CatalogsModel.ts
A Retail recommendation model on a catalog.
Without labels, ownership rests on the deterministic id: read reports a
resource it finds without prior state as unowned (adopt it with --adopt).
Parent, model id, type, and optimization objective are immutable.
filteringOption and periodicTuningState patch in place; trainingState
is synced with pause/resume.
Creating a model requires Retail Recommendations and enough catalog and user-event data. Create is a long-running operation.
CatalogsModel: Creating a Model
Section titled “CatalogsModel: Creating a Model”const model = yield* GCP.Retail.CatalogsModel("Homepage", { displayName: "homepage recs", type: "recommended-for-you", trainingState: "PAUSED",});CatalogsServingConfig
Section titled “CatalogsServingConfig”Source:
src/GCP/Retail/CatalogsServingConfig.ts
A Retail serving config on a catalog.
Without labels, ownership rests on the deterministic id: read reports a
resource it finds without prior state as unowned (adopt it with --adopt).
Parent, serving config id, and solution types are immutable. Display name,
model id, and control-id lists update in place.
CatalogsServingConfig: Creating a Serving Config
Section titled “CatalogsServingConfig: Creating a Serving Config”const serving = yield* GCP.Retail.CatalogsServingConfig("Preview", { displayName: "preview search",});Predict
Section titled “Predict”Source:
src/GCP/Retail/Predict.ts
Runtime binding for Retail servingConfigs.predict.
Bind this operation to a CatalogsServingConfig in a Function
or Action init phase. Provide PredictHttp.
Predict: Predicting Recommendations
Section titled “Predict: Predicting Recommendations”const predict = yield* GCP.Retail.Predict(serving);const page = yield* predict({ body: { validateOnly: true, userEvent: { eventType: "detail-page-view", visitorId: "visitor-1", }, },});PredictHttp
Section titled “PredictHttp”Source:
src/GCP/Retail/PredictHttp.tsKind: Layer · Provides:GCP.Retail.Predict
HTTP implementation of Predict.
Search
Section titled “Search”Source:
src/GCP/Retail/Search.ts
Runtime binding for Retail servingConfigs.search.
Bind this operation to a CatalogsServingConfig in a Function
or Action init phase. Provide SearchHttp.
Search: Searching a Catalog
Section titled “Search: Searching a Catalog”const search = yield* GCP.Retail.Search(serving);const page = yield* search({ body: { visitorId: "visitor-1", query: "shirt", pageSize: 10 },});SearchHttp
Section titled “SearchHttp”Source:
src/GCP/Retail/SearchHttp.tsKind: Layer · Provides:GCP.Retail.Search
HTTP implementation of Search.