| 1 | import type * as S3 from "@distilled.cloud/aws/s3"; |
| 2 | import type * as Config from "effect/Config"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import * as Binding from "../Binding.ts"; |
| 5 | import type { RuntimeContext } from "../RuntimeContext.ts"; |
| 6 | import type { Bucket } from "./Bucket.ts"; |
| 7 | import type { RailwayS3CredentialsMissing } from "./BucketBinding.ts"; |
| 8 | |
| 9 | export 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 | */ |
| 31 | export 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 | |
| 47 | export const ListObjectsV2 = Binding.Service<ListObjectsV2>( |
| 48 | "Railway.ListObjectsV2", |
| 49 | ); |