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 DeleteObjectsRequest extends Omit<
8 S3.DeleteObjectsRequest,
9 "Bucket"
10> {}
11
12/**
13 * Runtime binding for `s3:DeleteObjects` (batch delete).
14 *
15 * Bind this operation to a bucket to get a callable that deletes up to 1,000
16 * objects in a single request — the bucket name is injected automatically and
17 * `s3:DeleteObject`/`s3:DeleteObjectVersion` are granted on the bucket's
18 * objects. Provide the implementation with
19 * `Effect.provide(AWS.S3.DeleteObjectsHttp)`.
20 * ### Deleting Objects
21 * **Example:** Delete Several Objects at Once
22 * ```typescript
23 * // init — bind the operation to the bucket
24 * const deleteObjects = yield* AWS.S3.DeleteObjects(bucket);
25 *
26 * // runtime — per-key failures are reported in `Errors`, not thrown
27 * const result = yield* deleteObjects({
28 * Delete: {
29 * Objects: [{ Key: "a.txt" }, { Key: "b.txt" }],
30 * Quiet: true,
31 * },
32 * });
33 * ```
34 *
35 * @binding
36 */
37export interface DeleteObjects extends Binding.Service<
38 DeleteObjects,
39 "AWS.S3.DeleteObjects",
40 (
41 bucket: Bucket,
42 ) => Effect.Effect<
43 (
44 request: DeleteObjectsRequest,
45 ) => Effect.Effect<S3.DeleteObjectsOutput, S3.DeleteObjectsError>
46 >
47> {}
48export const DeleteObjects = Binding.Service<DeleteObjects>(
49 "AWS.S3.DeleteObjects",
50);