| 1 | import type * as ivsrealtime from "@distilled.cloud/aws/ivs-realtime"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Stage } from "./Stage.ts"; |
| 5 | |
| 6 | /** The `stageArn` is injected by the binding from the bound stage. */ |
| 7 | export interface DisconnectParticipantRequest extends Omit< |
| 8 | ivsrealtime.DisconnectParticipantRequest, |
| 9 | "stageArn" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Forcibly disconnect a participant from the bound stage — the moderation |
| 14 | * call made from a deployed Lambda or Task. If the participant is publishing |
| 15 | * via an ingest configuration, its `stageArn` attachment is also cleared. |
| 16 | * |
| 17 | * ### Moderating Participants |
| 18 | * **Example:** Kick a participant from a Lambda |
| 19 | * ```typescript |
| 20 | * // init |
| 21 | * const disconnectParticipant = yield* IVSRealtime.DisconnectParticipant(stage); |
| 22 | * |
| 23 | * // runtime |
| 24 | * yield* disconnectParticipant({ |
| 25 | * participantId: "abcDEF123", |
| 26 | * reason: "moderated", |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface DisconnectParticipant extends Binding.Service< |
| 33 | DisconnectParticipant, |
| 34 | "AWS.IVSRealtime.DisconnectParticipant", |
| 35 | ( |
| 36 | stage: Stage, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: DisconnectParticipantRequest, |
| 40 | ) => Effect.Effect< |
| 41 | ivsrealtime.DisconnectParticipantResponse, |
| 42 | ivsrealtime.DisconnectParticipantError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const DisconnectParticipant = Binding.Service<DisconnectParticipant>( |
| 47 | "AWS.IVSRealtime.DisconnectParticipant", |
| 48 | ); |