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

main
ts 39 lines 1.12 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 { Topic } from "./Topic.ts";
6
7 export interface PublishRequest extends Omit<pubsub.PublishProjectsTopicsRequest, "topic"> {}
8
9 /**
10 * Runtime binding for Pub/Sub `topics.publish`.
11 *
12 * Bind this operation to a {@link Topic} in a Function/Action init phase.
13 * Provide {@link PublishHttp}.
14 *
15 * ### Publishing Messages
16 * **Example:** Publish a message
17 * ```typescript
18 * const publish = yield* GCP.PubSub.Publish(topic);
19 * const { messageIds } = yield* publish({
20 * body: { messages: [{ data: btoa("hello") }] },
21 * });
22 * ```
23 *
24 * @binding
25 * @category PubSub
26 */
27 export interface Publish extends Binding.Service<
28 Publish,
29 "GCP.PubSub.Publish",
30 (
31 topic: Topic,
32 ) => Effect.Effect<
33 (
34 request: PublishRequest,
35 ) => Effect.Effect<pubsub.PublishResponse, pubsub.PublishProjectsTopicsError, RuntimeContext>
36 >
37 > {}
38
39 export const Publish = Binding.Service<Publish>("GCP.PubSub.Publish");