@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 39 lines 1.37 KB
Raw
1 import * as S3 from "@distilled.cloud/aws/s3";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4 import type { Bucket } from "./Bucket.ts";
5
6 export interface ListObjectsV2Request extends Omit<S3.ListObjectsV2Request, "Bucket"> {}
7
8 /**
9 * Runtime binding for `s3:ListObjectsV2`.
10 *
11 * Bind this operation to a bucket to get a callable that lists objects —
12 * the bucket name is injected automatically and `s3:ListBucket` is granted
13 * on the bucket. Provide the implementation with
14 * `Effect.provide(AWS.S3.ListObjectsV2Http)`.
15 * ### Listing Objects
16 * **Example:** List Objects Under a Prefix
17 * ```typescript
18 * // init — bind the operation to the bucket
19 * const listObjects = yield* AWS.S3.ListObjectsV2(bucket);
20 *
21 * // runtime — list up to 100 keys under `jobs/`
22 * const result = yield* listObjects({ Prefix: "jobs/", MaxKeys: 100 });
23 * const keys = (result.Contents ?? []).map((object) => object.Key);
24 * // result.IsTruncated + result.NextContinuationToken page through the rest
25 * ```
26 *
27 * @binding
28 */
29 export interface ListObjectsV2 extends Binding.Service<
30 ListObjectsV2,
31 "AWS.S3.ListObjectsV2",
32 (
33 bucket: Bucket,
34 ) => Effect.Effect<
35 (request?: ListObjectsV2Request) => Effect.Effect<S3.ListObjectsV2Output, S3.ListObjectsV2Error>
36 >
37 > {}
38
39 export const ListObjectsV2 = Binding.Service<ListObjectsV2>("AWS.S3.ListObjectsV2");