| 1 | import type * as qapps from "@distilled.cloud/aws/qapps"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { QApp } from "./QApp.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link GetQAppSession} — `instanceId` is injected from the bound Q App. |
| 8 | */ |
| 9 | export interface GetQAppSessionRequest extends Omit< |
| 10 | qapps.GetQAppSessionInput, |
| 11 | "instanceId" | "appId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for `qapps:GetQAppSession`. |
| 16 | * |
| 17 | * Retrieves the current state of a Q App session — execution status plus the per-card status map. Provide the implementation with |
| 18 | * `Effect.provide(AWS.QApps.GetQAppSessionHttp)`. |
| 19 | * ### Sessions |
| 20 | * **Example:** Poll a Session Until It Completes |
| 21 | * ```typescript |
| 22 | * // init — bind the operation to the Q App |
| 23 | * const getQAppSession = yield* AWS.QApps.GetQAppSession(app); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const state = yield* getQAppSession({ sessionId }); |
| 27 | * if (state.status === "COMPLETED") console.log(state.cardStatus); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetQAppSession extends Binding.Service< |
| 33 | GetQAppSession, |
| 34 | "AWS.QApps.GetQAppSession", |
| 35 | ( |
| 36 | app: QApp, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: GetQAppSessionRequest, |
| 40 | ) => Effect.Effect<qapps.GetQAppSessionOutput, qapps.GetQAppSessionError> |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const GetQAppSession = Binding.Service<GetQAppSession>( |
| 45 | "AWS.QApps.GetQAppSession", |
| 46 | ); |