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