| 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 `GetSession` request with the binding-injected `botId` and |
| 8 | * `botAliasId` removed. `localeId` selects the conversation language and |
| 9 | * `sessionId` identifies the conversation — both remain caller-supplied. |
| 10 | */ |
| 11 | export interface GetSessionRequest extends Omit< |
| 12 | lexr.GetSessionRequest, |
| 13 | "botId" | "botAliasId" |
| 14 | > {} |
| 15 | |
| 16 | /** |
| 17 | * Runtime binding for `lex:GetSession` — read the session state (active |
| 18 | * intent, slots, session attributes, interpretations) of a conversation |
| 19 | * with an Amazon Lex V2 bot alias. |
| 20 | * |
| 21 | * ### Managing Sessions |
| 22 | * **Example:** Inspect a User's Session |
| 23 | * ```typescript |
| 24 | * // init |
| 25 | * const getSession = yield* AWS.LexV2.GetSession(alias); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const session = yield* getSession({ |
| 29 | * localeId: "en_US", |
| 30 | * sessionId: "user-123", |
| 31 | * }); |
| 32 | * const intent = session.sessionState?.intent?.name; |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | */ |
| 37 | export interface GetSession extends Binding.Service< |
| 38 | GetSession, |
| 39 | "AWS.LexV2.GetSession", |
| 40 | ( |
| 41 | alias: BotAlias, |
| 42 | ) => Effect.Effect< |
| 43 | ( |
| 44 | request: GetSessionRequest, |
| 45 | ) => Effect.Effect<lexr.GetSessionResponse, lexr.GetSessionError> |
| 46 | > |
| 47 | > {} |
| 48 | |
| 49 | export const GetSession = Binding.Service<GetSession>("AWS.LexV2.GetSession"); |