sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Personalize/ PutItems.ts

import type * as personalizeevents from "@distilled.cloud/aws/personalize-events";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Dataset } from "./Dataset.ts";

/**
 * `PutItems` request with `datasetArn` injected from the bound dataset.
 */
export interface PutItemsRequest extends Omit<personalizeevents.PutItemsRequest, "datasetArn"> {}

/**
 * Runtime binding for `personalize:PutItems`, scoped to one {@link Dataset} —
 * Adds or updates items incrementally in the bound Items {@link Dataset}
 * — the streaming alternative to a bulk dataset import job for keeping
 * the catalog fresh.
 * Provide the implementation with
 * `Effect.provide(AWS.Personalize.PutItemsHttp)`.
 *
 * ### Incremental Imports
 * **Example:** Upsert an Item
 * ```typescript
 * // init
 * const putItems = yield* Personalize.PutItems(itemsDataset);
 *
 * yield* putItems({
 *   items: [{
 *     itemId: "item-42",
 *     properties: JSON.stringify({ category: "books" }),
 *   }],
 * });
 * ```
 *
 * @binding
 */
export interface PutItems extends Binding.Service<
  PutItems,
  "AWS.Personalize.PutItems",
  (
    dataset: Dataset,
  ) => Effect.Effect<
    (
      request: PutItemsRequest,
    ) => Effect.Effect<personalizeevents.PutItemsResponse, personalizeevents.PutItemsError>
  >
> {}
export const PutItems = Binding.Service<PutItems>("AWS.Personalize.PutItems");