@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, 04:45 UTC

main
ts 49 lines 1.35 KB
Raw
1 import type * as S3 from "@distilled.cloud/aws/s3";
2 import * as Binding from "alchemy/Binding";
3 import type { RuntimeContext } from "alchemy/RuntimeContext";
4 import type * as Config from "effect/Config";
5 import type * as Effect from "effect/Effect";
6 import type { Bucket } from "./Bucket.ts";
7 import type { RailwayS3CredentialsMissing } from "./BucketBinding.ts";
8
9 export interface GetObjectRequest extends Omit<S3.GetObjectRequest, "Bucket"> {}
10
11 /**
12 * Runtime binding for Railway `GetObject` over the S3 API.
13 *
14 * Bind this operation to a {@link Bucket} in Service init. Provide
15 * {@link GetObjectHttp}.
16 *
17 *
18 * ### Reading Objects
19 * **Example:** Read an Object and Decode Its Body
20 * ```typescript
21 * const getObject = yield* Railway.GetObject(Data);
22 *
23 * const text = yield* getObject({ Key: "hello.txt" }).pipe(
24 * Effect.flatMap((result) =>
25 * Stream.mkString(Stream.decodeText(result.Body!)),
26 * ),
27 * );
28 * ```
29 *
30 * @binding
31 * @product Bucket
32 */
33 export interface GetObject extends Binding.Service<
34 GetObject,
35 "Railway.GetObject",
36 (
37 bucket: Bucket,
38 ) => Effect.Effect<
39 (
40 request?: GetObjectRequest,
41 ) => Effect.Effect<
42 S3.GetObjectOutput,
43 S3.GetObjectError | Config.ConfigError | RailwayS3CredentialsMissing,
44 RuntimeContext
45 >
46 >
47 > {}
48
49 export const GetObject = Binding.Service<GetObject>("Railway.GetObject");