| 1 | import type * as kv from "@distilled.cloud/aws/kinesis-video"; |
| 2 | import type * as kvam from "@distilled.cloud/aws/kinesis-video-archived-media"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import * as Binding from "../../Binding.ts"; |
| 5 | import type { Stream } from "./Stream.ts"; |
| 6 | |
| 7 | export interface GetMediaForFragmentListRequest extends Omit< |
| 8 | kvam.GetMediaForFragmentListInput, |
| 9 | "StreamName" | "StreamARN" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for `kinesisvideo:GetMediaForFragmentList` (archived |
| 14 | * media data plane). |
| 15 | * |
| 16 | * Bind this operation to a `Stream` inside a function runtime to get a |
| 17 | * callable that resolves the per-stream data endpoint (`GetDataEndpoint`) |
| 18 | * and downloads MKV-packaged media for an explicit list of fragment |
| 19 | * numbers (typically discovered via `ListFragments`). The response |
| 20 | * `Payload` is a streaming body. |
| 21 | * ### Reading Media |
| 22 | * **Example:** Fetch Media for Specific Fragments |
| 23 | * ```typescript |
| 24 | * // init |
| 25 | * const getFragmentMedia = |
| 26 | * yield* AWS.KinesisVideo.GetMediaForFragmentList(stream); |
| 27 | * |
| 28 | * // runtime |
| 29 | * const media = yield* getFragmentMedia({ |
| 30 | * Fragments: fragments.map((f) => f.FragmentNumber!), |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetMediaForFragmentList extends Binding.Service< |
| 37 | GetMediaForFragmentList, |
| 38 | "AWS.KinesisVideo.GetMediaForFragmentList", |
| 39 | <S extends Stream>( |
| 40 | stream: S, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: GetMediaForFragmentListRequest, |
| 44 | ) => Effect.Effect< |
| 45 | kvam.GetMediaForFragmentListOutput, |
| 46 | kvam.GetMediaForFragmentListError | kv.GetDataEndpointError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | |
| 51 | export const GetMediaForFragmentList = Binding.Service<GetMediaForFragmentList>( |
| 52 | "AWS.KinesisVideo.GetMediaForFragmentList", |
| 53 | ); |