| 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 PutMetadataRequest extends Omit< |
| 7 | ivs.PutMetadataRequest, |
| 8 | "channelArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `ivs:PutMetadata`. |
| 13 | * |
| 14 | * Inserts timed metadata (max 1 KB) into the bound {@link Channel}'s |
| 15 | * active stream — the payload is embedded in the video and surfaced to |
| 16 | * players in sync with playback. Fails with the typed |
| 17 | * `ChannelNotBroadcasting` tag when the channel is not live. At most 5 |
| 18 | * requests per second per channel. The channel ARN is injected from the |
| 19 | * binding. Provide the implementation with |
| 20 | * `Effect.provide(AWS.IVS.PutMetadataHttp)`. |
| 21 | * ### Embedding Timed Metadata |
| 22 | * **Example:** Push a Poll Question to Viewers |
| 23 | * ```typescript |
| 24 | * // init — bind the operation to the channel |
| 25 | * const putMetadata = yield* AWS.IVS.PutMetadata(channel); |
| 26 | * |
| 27 | * // runtime |
| 28 | * yield* putMetadata({ |
| 29 | * metadata: JSON.stringify({ question: "Who wins?", options: ["A", "B"] }), |
| 30 | * }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface PutMetadata extends Binding.Service< |
| 36 | PutMetadata, |
| 37 | "AWS.IVS.PutMetadata", |
| 38 | ( |
| 39 | channel: Channel, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request: PutMetadataRequest, |
| 43 | ) => Effect.Effect<ivs.PutMetadataResponse, ivs.PutMetadataError> |
| 44 | > |
| 45 | > {} |
| 46 | export const PutMetadata = Binding.Service<PutMetadata>("AWS.IVS.PutMetadata"); |