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 HeadObjectRequest extends Omit<
10 S3.HeadObjectRequest,
11 "Bucket"
12> {}
13
14/**
15 * Runtime binding for Railway `HeadObject` over the S3 API.
16 *
17 * Bind this operation to a {@link Bucket} in Service init. Provide
18 * {@link HeadObjectHttp}.
19 *
20 *
21 * ### Inspecting Objects
22 * **Example:** Check an Object's Metadata
23 * ```typescript
24 * const headObject = yield* Railway.HeadObject(Data);
25 * const head = yield* headObject({ Key: "hello.txt" });
26 * ```
27 *
28 * @binding
29 * @product Bucket
30 */
31export interface HeadObject extends Binding.Service<
32 HeadObject,
33 "Railway.HeadObject",
34 (
35 bucket: Bucket,
36 ) => Effect.Effect<
37 (
38 request?: HeadObjectRequest,
39 ) => Effect.Effect<
40 S3.HeadObjectOutput,
41 S3.HeadObjectError | Config.ConfigError | RailwayS3CredentialsMissing,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const HeadObject = Binding.Service<HeadObject>("Railway.HeadObject");