| 1 | import type * as personalizeevents from "@distilled.cloud/aws/personalize-events"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { EventTracker } from "./EventTracker.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `PutActionInteractions` request with `trackingId` injected from the bound tracker. |
| 8 | */ |
| 9 | export interface PutActionInteractionsRequest extends Omit< |
| 10 | personalizeevents.PutActionInteractionsRequest, |
| 11 | "trackingId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for `personalize:PutActionInteractions`, scoped to one {@link EventTracker} — |
| 16 | * Records action-interaction events (Taken, Not Taken, Viewed) for the |
| 17 | * NEXT_BEST_ACTION recipe through the bound {@link EventTracker}. Events |
| 18 | * stream into the dataset group's Action interactions dataset. |
| 19 | * Provide the implementation with |
| 20 | * `Effect.provide(AWS.Personalize.PutActionInteractionsHttp)`. |
| 21 | * |
| 22 | * ### Streaming Events |
| 23 | * **Example:** Record an Action Interaction |
| 24 | * ```typescript |
| 25 | * // init |
| 26 | * const putActionInteractions = yield* Personalize.PutActionInteractions(tracker); |
| 27 | * |
| 28 | * yield* putActionInteractions({ |
| 29 | * actionInteractions: [{ |
| 30 | * actionId: "action-1", |
| 31 | * userId: "user-1", |
| 32 | * sessionId: "session-1", |
| 33 | * eventType: "Taken", |
| 34 | * timestamp: new Date(), |
| 35 | * }], |
| 36 | * }); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface PutActionInteractions extends Binding.Service< |
| 42 | PutActionInteractions, |
| 43 | "AWS.Personalize.PutActionInteractions", |
| 44 | ( |
| 45 | tracker: EventTracker, |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: PutActionInteractionsRequest, |
| 49 | ) => Effect.Effect< |
| 50 | personalizeevents.PutActionInteractionsResponse, |
| 51 | personalizeevents.PutActionInteractionsError |
| 52 | > |
| 53 | > |
| 54 | > {} |
| 55 | export const PutActionInteractions = Binding.Service<PutActionInteractions>( |
| 56 | "AWS.Personalize.PutActionInteractions", |
| 57 | ); |