1import type * as S3 from "@distilled.cloud/aws/s3";
2import type * as Config from "effect/Config";
3import type * as Effect from "effect/Effect";
4import * as Binding from "../Binding.ts";
5import type { RuntimeContext } from "../RuntimeContext.ts";
6import type { Bucket } from "./Bucket.ts";
7import type { RailwayS3CredentialsMissing } from "./BucketBinding.ts";
8
9export interface DeleteObjectRequest extends Omit<
10 S3.DeleteObjectRequest,
11 "Bucket"
12> {}
13
14/**
15 * Runtime binding for Railway `DeleteObject` over the S3 API.
16 *
17 * Bind this operation to a {@link Bucket} in Service init. Provide
18 * {@link DeleteObjectHttp}.
19 *
20 *
21 * ### Deleting Objects
22 * **Example:** Delete an Object
23 * ```typescript
24 * const deleteObject = yield* Railway.DeleteObject(Data);
25 * yield* deleteObject({ Key: "hello.txt" });
26 * ```
27 *
28 * @binding
29 * @product Bucket
30 */
31export interface DeleteObject extends Binding.Service<
32 DeleteObject,
33 "Railway.DeleteObject",
34 (
35 bucket: Bucket,
36 ) => Effect.Effect<
37 (
38 request?: DeleteObjectRequest,
39 ) => Effect.Effect<
40 S3.DeleteObjectOutput,
41 S3.DeleteObjectError | Config.ConfigError | RailwayS3CredentialsMissing,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const DeleteObject = Binding.Service<DeleteObject>(
48 "Railway.DeleteObject",
49);