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

main
ts 51 lines 1.45 KB
Raw
1 import type * as pubsub from "@distilled.cloud/gcp/pubsub_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 { Schema } from "./Schema.ts";
6
7 export interface ValidateMessageRequest extends Omit<
8 pubsub.ValidateMessageRequest,
9 "name" | "schema"
10 > {}
11
12 /**
13 * Runtime binding for Pub/Sub `schemas.validateMessage`.
14 *
15 * Bind this operation to a {@link Schema} in a Function/Action init phase.
16 * Provide {@link ValidateMessageHttp}.
17 *
18 * Grants `roles/pubsub.viewer` on the project: `schemas.validateMessage` is
19 * authorized on the parent project, and a grant on the schema's own IAM
20 * policy is not enough.
21 *
22 * ### Validating Messages
23 * **Example:** Validate a JSON-encoded Avro payload
24 * ```typescript
25 * const validate = yield* GCP.PubSub.ValidateMessage(schema);
26 * yield* validate({
27 * encoding: "JSON",
28 * message: btoa(JSON.stringify({ id: "abc" })),
29 * });
30 * ```
31 *
32 * @binding
33 * @category PubSub
34 */
35 export interface ValidateMessage extends Binding.Service<
36 ValidateMessage,
37 "GCP.PubSub.ValidateMessage",
38 (
39 schema: Schema,
40 ) => Effect.Effect<
41 (
42 request: ValidateMessageRequest,
43 ) => Effect.Effect<
44 pubsub.ValidateMessageResponse,
45 pubsub.ValidateMessageProjectsSchemasError,
46 RuntimeContext
47 >
48 >
49 > {}
50
51 export const ValidateMessage = Binding.Service<ValidateMessage>("GCP.PubSub.ValidateMessage");