1import * as S3 from "@distilled.cloud/aws/s3";
2import * as Effect from "effect/Effect";
3
4import * as Binding from "../../Binding.ts";
5import type { Bucket } from "./Bucket.ts";
6
7export interface ListPartsRequest extends Omit<S3.ListPartsRequest, "Bucket"> {}
8
9/**
10 * Runtime binding for `s3:ListParts` (`s3:ListMultipartUploadParts`).
11 *
12 * Bind this operation to a bucket to get a callable that lists the parts
13 * uploaded for an in-progress multipart upload — the bucket name is injected
14 * automatically and `s3:ListMultipartUploadParts` is granted on the bucket's
15 * objects. Provide the implementation with
16 * `Effect.provide(AWS.S3.ListPartsHttp)`.
17 * ### Multipart Uploads
18 * **Example:** List Uploaded Parts
19 * ```typescript
20 * const listParts = yield* AWS.S3.ListParts(bucket);
21 *
22 * const result = yield* listParts({ Key: "large.bin", UploadId: uploadId });
23 * const parts = result.Parts ?? [];
24 * ```
25 *
26 * @binding
27 */
28export interface ListParts extends Binding.Service<
29 ListParts,
30 "AWS.S3.ListParts",
31 (
32 bucket: Bucket,
33 ) => Effect.Effect<
34 (
35 request: ListPartsRequest,
36 ) => Effect.Effect<S3.ListPartsOutput, S3.ListPartsError>
37 >
38> {}
39export const ListParts = Binding.Service<ListParts>("AWS.S3.ListParts");