1import type * as retail from "@distilled.cloud/gcp/retail_v2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { CatalogsServingConfig } from "./CatalogsServingConfig.ts";
6
7export interface PredictRequest extends Omit<
8 retail.PredictProjectsLocationsCatalogsServingConfigsRequest,
9 "placement"
10> {}
11
12/**
13 * Runtime binding for Retail `servingConfigs.predict`.
14 *
15 * Bind this operation to a {@link CatalogsServingConfig} in a Function
16 * or Action init phase. Provide {@link PredictHttp}.
17 *
18 * ### Predicting Recommendations
19 * **Example:** Predict with validate-only
20 * ```typescript
21 * const predict = yield* GCP.Retail.Predict(serving);
22 * const page = yield* predict({
23 * body: {
24 * validateOnly: true,
25 * userEvent: {
26 * eventType: "detail-page-view",
27 * visitorId: "visitor-1",
28 * },
29 * },
30 * });
31 * ```
32 *
33 * @binding
34 * @category Retail
35 */
36export interface Predict extends Binding.Service<
37 Predict,
38 "GCP.Retail.Predict",
39 (
40 servingConfig: CatalogsServingConfig,
41 ) => Effect.Effect<
42 (
43 request: PredictRequest,
44 ) => Effect.Effect<
45 retail.GoogleCloudRetailV2PredictResponse,
46 retail.PredictProjectsLocationsCatalogsServingConfigsError,
47 RuntimeContext
48 >
49 >
50> {}
51
52export const Predict = Binding.Service<Predict>("GCP.Retail.Predict");