| 1 | import type * as lexr from "@distilled.cloud/aws/lex-runtime-v2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { BotAlias } from "./BotAlias.ts"; |
| 5 | |
| 6 | /** |
| 7 | * The `PutSession` request with the binding-injected `botId` and |
| 8 | * `botAliasId` removed. `sessionState` is the new state of the conversation |
| 9 | * (active intent, slots, dialog action, session attributes). |
| 10 | */ |
| 11 | export interface PutSessionRequest extends Omit< |
| 12 | lexr.PutSessionRequest, |
| 13 | "botId" | "botAliasId" |
| 14 | > {} |
| 15 | |
| 16 | /** |
| 17 | * Runtime binding for `lex:PutSession` — create or overwrite the session |
| 18 | * state of a conversation with an Amazon Lex V2 bot alias, letting your |
| 19 | * application steer the dialog (e.g. pre-fill slots or elicit a specific |
| 20 | * intent). |
| 21 | * |
| 22 | * ### Managing Sessions |
| 23 | * **Example:** Steer the Conversation |
| 24 | * ```typescript |
| 25 | * // init |
| 26 | * const putSession = yield* AWS.LexV2.PutSession(alias); |
| 27 | * |
| 28 | * // runtime |
| 29 | * yield* putSession({ |
| 30 | * localeId: "en_US", |
| 31 | * sessionId: "user-123", |
| 32 | * sessionState: { |
| 33 | * intent: { name: "OrderPizza", slots: {} }, |
| 34 | * dialogAction: { type: "ElicitSlot", slotToElicit: "Size" }, |
| 35 | * }, |
| 36 | * }); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface PutSession extends Binding.Service< |
| 42 | PutSession, |
| 43 | "AWS.LexV2.PutSession", |
| 44 | ( |
| 45 | alias: BotAlias, |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: PutSessionRequest, |
| 49 | ) => Effect.Effect<lexr.PutSessionResponse, lexr.PutSessionError> |
| 50 | > |
| 51 | > {} |
| 52 | |
| 53 | export const PutSession = Binding.Service<PutSession>("AWS.LexV2.PutSession"); |