Skip to content

GCP.Retail reference

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 },
});

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.

const control = yield* GCP.Retail.CatalogsControl("Greetings", {
displayName: "greetings",
synonyms: ["hello", "hi"],
});

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.

const model = yield* GCP.Retail.CatalogsModel("Homepage", {
displayName: "homepage recs",
type: "recommended-for-you",
trainingState: "PAUSED",
});

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",
});

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.

const predict = yield* GCP.Retail.Predict(serving);
const page = yield* predict({
body: {
validateOnly: true,
userEvent: {
eventType: "detail-page-view",
visitorId: "visitor-1",
},
},
});

Source: src/GCP/Retail/PredictHttp.ts Kind: Layer · Provides: GCP.Retail.Predict

HTTP implementation of Predict.

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.

const search = yield* GCP.Retail.Search(serving);
const page = yield* search({
body: { visitorId: "visitor-1", query: "shirt", pageSize: 10 },
});

Source: src/GCP/Retail/SearchHttp.ts Kind: Layer · Provides: GCP.Retail.Search

HTTP implementation of Search.