1import type * as kv from "@distilled.cloud/aws/kinesis-video";
2import type * as kvs from "@distilled.cloud/aws/kinesis-video-signaling";
3import type * as Effect from "effect/Effect";
4import * as Binding from "../../Binding.ts";
5import type { SignalingEndpointUnavailable } from "./internal.ts";
6import type { SignalingChannel } from "./SignalingChannel.ts";
7
8export interface SendAlexaOfferToMasterRequest extends Omit<
9 kvs.SendAlexaOfferToMasterRequest,
10 "ChannelARN"
11> {}
12
13/**
14 * Runtime binding for `kinesisvideo:SendAlexaOfferToMaster` (WebRTC
15 * signaling data plane).
16 *
17 * Bind this operation to a `SignalingChannel` inside a function runtime to
18 * get a callable that resolves the per-channel HTTPS signaling endpoint
19 * (`GetSignalingChannelEndpoint`) and delivers a base64-encoded SDP offer
20 * from an Alexa display device to the connected master peer, returning the
21 * master's SDP answer.
22 *
23 * If no master is connected the service holds the offer for redelivery
24 * until the message TTL expires — bound the call with a timeout when the
25 * master may be offline.
26 * ### WebRTC Connectivity
27 * **Example:** Send an Alexa SDP Offer
28 * ```typescript
29 * // init
30 * const sendOffer = yield* AWS.KinesisVideo.SendAlexaOfferToMaster(channel);
31 *
32 * // runtime
33 * const { Answer } = yield* sendOffer({
34 * SenderClientId: "alexa-device-1",
35 * MessagePayload: base64SdpOffer,
36 * });
37 * ```
38 *
39 * @binding
40 */
41export interface SendAlexaOfferToMaster extends Binding.Service<
42 SendAlexaOfferToMaster,
43 "AWS.KinesisVideo.SendAlexaOfferToMaster",
44 <C extends SignalingChannel>(
45 channel: C,
46 ) => Effect.Effect<
47 (
48 request: SendAlexaOfferToMasterRequest,
49 ) => Effect.Effect<
50 kvs.SendAlexaOfferToMasterResponse,
51 | kvs.SendAlexaOfferToMasterError
52 | kv.GetSignalingChannelEndpointError
53 | SignalingEndpointUnavailable
54 >
55 >
56> {}
57
58export const SendAlexaOfferToMaster = Binding.Service<SendAlexaOfferToMaster>(
59 "AWS.KinesisVideo.SendAlexaOfferToMaster",
60);