sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ IVSRealtime/ GetParticipant.ts

import type * as ivsrealtime from "@distilled.cloud/aws/ivs-realtime";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Stage } from "./Stage.ts";

/** The `stageArn` is injected by the binding from the bound stage. */
export interface GetParticipantRequest extends Omit<
  ivsrealtime.GetParticipantRequest,
  "stageArn"
> {}

/**
 * Read a participant's detail (state, join time, attributes, publish state,
 * recording state, connection metadata) for a session of the bound stage.
 *
 * ### Inspecting Participants
 * **Example:** Look up a participant
 * ```typescript
 * // init
 * const getParticipant = yield* IVSRealtime.GetParticipant(stage);
 *
 * // runtime
 * const { participant } = yield* getParticipant({
 *   sessionId: "st-a1b2c3d4e5f6",
 *   participantId: "abcDEF123",
 * });
 * ```
 *
 * @binding
 */
export interface GetParticipant extends Binding.Service<
  GetParticipant,
  "AWS.IVSRealtime.GetParticipant",
  (
    stage: Stage,
  ) => Effect.Effect<
    (
      request: GetParticipantRequest,
    ) => Effect.Effect<ivsrealtime.GetParticipantResponse, ivsrealtime.GetParticipantError>
  >
> {}
export const GetParticipant = Binding.Service<GetParticipant>("AWS.IVSRealtime.GetParticipant");