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 ListObjectsV2Request extends Omit<
10 S3.ListObjectsV2Request,
11 "Bucket"
12> {}
13
14/**
15 * Runtime binding for Railway `ListObjectsV2` over the S3 API.
16 *
17 * Bind this operation to a {@link Bucket} in Service init. Provide
18 * {@link ListObjectsV2Http}.
19 *
20 *
21 * ### Listing Objects
22 * **Example:** List Objects Under a Prefix
23 * ```typescript
24 * const listObjects = yield* Railway.ListObjectsV2(Data);
25 * const result = yield* listObjects({ Prefix: "jobs/", MaxKeys: 100 });
26 * ```
27 *
28 * @binding
29 * @product Bucket
30 */
31export interface ListObjectsV2 extends Binding.Service<
32 ListObjectsV2,
33 "Railway.ListObjectsV2",
34 (
35 bucket: Bucket,
36 ) => Effect.Effect<
37 (
38 request?: ListObjectsV2Request,
39 ) => Effect.Effect<
40 S3.ListObjectsV2Output,
41 S3.ListObjectsV2Error | Config.ConfigError | RailwayS3CredentialsMissing,
42 RuntimeContext
43 >
44 >
45> {}
46
47export const ListObjectsV2 = Binding.Service<ListObjectsV2>(
48 "Railway.ListObjectsV2",
49);