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 SearchRequest extends Omit<
8 retail.SearchProjectsLocationsCatalogsServingConfigsRequest,
9 "placement"
10> {}
11
12/**
13 * Runtime binding for Retail `servingConfigs.search`.
14 *
15 * Bind this operation to a {@link CatalogsServingConfig} in a Function
16 * or Action init phase. Provide {@link SearchHttp}.
17 *
18 * ### Searching a Catalog
19 * **Example:** Search products
20 * ```typescript
21 * const search = yield* GCP.Retail.Search(serving);
22 * const page = yield* search({
23 * body: { visitorId: "visitor-1", query: "shirt", pageSize: 10 },
24 * });
25 * ```
26 *
27 * @binding
28 * @category Retail
29 */
30export interface Search extends Binding.Service<
31 Search,
32 "GCP.Retail.Search",
33 (
34 servingConfig: CatalogsServingConfig,
35 ) => Effect.Effect<
36 (
37 request: SearchRequest,
38 ) => Effect.Effect<
39 retail.GoogleCloudRetailV2SearchResponse,
40 retail.SearchProjectsLocationsCatalogsServingConfigsError,
41 RuntimeContext
42 >
43 >
44> {}
45
46export const Search = Binding.Service<Search>("GCP.Retail.Search");