@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 49 lines 1.62 KB
Raw
1 import type * as datastore from "@distilled.cloud/gcp/datastore_v1";
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 { Database } from "../Firestore/Database.ts";
6 import type { DatastoreDatabaseRequest } from "./BindingHttp.ts";
7
8 /** Request for {@link Lookup}; project and database come from the bound database. */
9 export type LookupRequest = DatastoreDatabaseRequest<datastore.LookupProjectsRequest>;
10
11 /**
12 * Runtime binding for Datastore `projects.lookup`.
13 *
14 * Bind this operation to a Datastore-mode `GCP.Firestore.Database` in a Function/Action init
15 * phase. Provide {@link LookupHttp}. The bound database supplies the
16 * project and database id; lookups run against that database only.
17 * The host is granted the role on the project under an IAM Condition
18 * matching the database.
19 *
20 * ### Looking Up Entities
21 * **Example:** Lookup by key
22 * ```typescript
23 * const database = yield* GCP.Firestore.Database("Tasks", {
24 * type: "DATASTORE_MODE",
25 * });
26 * const lookup = yield* GCP.Datastore.Lookup(database);
27 * const result = yield* lookup({
28 * body: {
29 * keys: [{ path: [{ kind: "Task", name: "t1" }] }],
30 * },
31 * });
32 * ```
33 *
34 * @binding
35 * @category Datastore
36 */
37 export interface Lookup extends Binding.Service<
38 Lookup,
39 "GCP.Datastore.Lookup",
40 (
41 database: Database,
42 ) => Effect.Effect<
43 (
44 request: LookupRequest,
45 ) => Effect.Effect<datastore.LookupResponse, datastore.LookupProjectsError, RuntimeContext>
46 >
47 > {}
48
49 export const Lookup = Binding.Service<Lookup>("GCP.Datastore.Lookup");