1import type * as kv from "@distilled.cloud/aws/kinesis-video";
2import type * as kvam from "@distilled.cloud/aws/kinesis-video-archived-media";
3import type * as Effect from "effect/Effect";
4import * as Binding from "../../Binding.ts";
5import type { Stream } from "./Stream.ts";
6
7export interface ListFragmentsRequest extends Omit<
8 kvam.ListFragmentsInput,
9 "StreamName" | "StreamARN"
10> {}
11
12/**
13 * Runtime binding for `kinesisvideo:ListFragments` (archived media data
14 * 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 lists the media fragments stored in the requested timestamp range.
19 * ### Reading Media
20 * **Example:** List Stored Fragments
21 * ```typescript
22 * // init
23 * const listFragments = yield* AWS.KinesisVideo.ListFragments(stream);
24 *
25 * // runtime
26 * const { Fragments } = yield* listFragments({
27 * FragmentSelector: {
28 * FragmentSelectorType: "SERVER_TIMESTAMP",
29 * TimestampRange: { StartTimestamp: start, EndTimestamp: end },
30 * },
31 * });
32 * ```
33 *
34 * @binding
35 */
36export interface ListFragments extends Binding.Service<
37 ListFragments,
38 "AWS.KinesisVideo.ListFragments",
39 <S extends Stream>(
40 stream: S,
41 ) => Effect.Effect<
42 (
43 request?: ListFragmentsRequest,
44 ) => Effect.Effect<
45 kvam.ListFragmentsOutput,
46 kvam.ListFragmentsError | kv.GetDataEndpointError
47 >
48 >
49> {}
50
51export const ListFragments = Binding.Service<ListFragments>(
52 "AWS.KinesisVideo.ListFragments",
53);