| 1 | import type * as ivs from "@distilled.cloud/aws/ivs"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Channel } from "./Channel.ts"; |
| 5 | |
| 6 | export interface InsertAdBreakRequest extends Omit< |
| 7 | ivs.InsertAdBreakRequest, |
| 8 | "channelArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `ivs:InsertAdBreak`. |
| 13 | * |
| 14 | * Triggers a server-side ad break of the requested duration in the bound |
| 15 | * {@link Channel}'s active stream (the channel must have an ad |
| 16 | * configuration attached). Fails with the typed `ChannelNotBroadcasting` |
| 17 | * tag when the channel is not live. The channel ARN is injected from the |
| 18 | * binding. Provide the implementation with |
| 19 | * `Effect.provide(AWS.IVS.InsertAdBreakHttp)`. |
| 20 | * ### Inserting Ad Breaks |
| 21 | * **Example:** Trigger a 30-Second Ad Break |
| 22 | * ```typescript |
| 23 | * // init — bind the operation to the channel |
| 24 | * const insertAdBreak = yield* AWS.IVS.InsertAdBreak(channel); |
| 25 | * |
| 26 | * // runtime |
| 27 | * const { adBreakId } = yield* insertAdBreak({ durationSeconds: 30 }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface InsertAdBreak extends Binding.Service< |
| 33 | InsertAdBreak, |
| 34 | "AWS.IVS.InsertAdBreak", |
| 35 | ( |
| 36 | channel: Channel, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: InsertAdBreakRequest, |
| 40 | ) => Effect.Effect<ivs.InsertAdBreakResponse, ivs.InsertAdBreakError> |
| 41 | > |
| 42 | > {} |
| 43 | export const InsertAdBreak = Binding.Service<InsertAdBreak>( |
| 44 | "AWS.IVS.InsertAdBreak", |
| 45 | ); |