sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ QApps/ StartQAppSession.ts

import type * as qapps from "@distilled.cloud/aws/qapps";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { QApp } from "./QApp.ts";

/**
 * Request for {@link StartQAppSession} — `instanceId` and `appId` are injected from the bound Q App.
 */
export interface StartQAppSessionRequest extends Omit<
  qapps.StartQAppSessionInput,
  "instanceId" | "appId"
> {}

/**
 * Runtime binding for `qapps:StartQAppSession`.
 *
 * Starts a new session of the bound Q App, optionally seeding initial card values. Provide the implementation with
 * `Effect.provide(AWS.QApps.StartQAppSessionHttp)`.
 * ### Sessions
 * **Example:** Start a Session
 * ```typescript
 * // init — bind the operation to the Q App
 * const startQAppSession = yield* AWS.QApps.StartQAppSession(app);
 *
 * // runtime
 * const session = yield* startQAppSession({ appVersion: 1 });
 * console.log(session.sessionId);
 * ```
 *
 * @binding
 */
export interface StartQAppSession extends Binding.Service<
  StartQAppSession,
  "AWS.QApps.StartQAppSession",
  (
    app: QApp,
  ) => Effect.Effect<
    (
      request: StartQAppSessionRequest,
    ) => Effect.Effect<qapps.StartQAppSessionOutput, qapps.StartQAppSessionError>
  >
> {}

export const StartQAppSession = Binding.Service<StartQAppSession>("AWS.QApps.StartQAppSession");