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

main
ts 54 lines 1.37 KB
Raw
1 import type * as cloudtasks from "@distilled.cloud/gcp/cloudtasks_v2";
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 { Queue } from "./Queue.ts";
6
7 export interface CreateTaskRequest extends Omit<
8 cloudtasks.CreateProjectsLocationsQueuesTasksRequest,
9 "parent"
10 > {}
11
12 /**
13 * Runtime binding for Cloud Tasks `queues.tasks.create`.
14 *
15 * Bind this operation to a {@link Queue} in a Function/Action init phase.
16 * Provide {@link CreateTaskHttp}.
17 *
18 * ### Creating Tasks
19 * **Example:** Enqueue an HTTP task
20 * ```typescript
21 * const createTask = yield* GCP.CloudTasks.CreateTask(queue);
22 * yield* createTask({
23 * body: {
24 * task: {
25 * httpRequest: {
26 * url: "https://example.com/jobs",
27 * httpMethod: "POST",
28 * body: btoa(JSON.stringify({ id: "1" })),
29 * },
30 * },
31 * },
32 * });
33 * ```
34 *
35 * @binding
36 * @category CloudTasks
37 */
38 export interface CreateTask extends Binding.Service<
39 CreateTask,
40 "GCP.CloudTasks.CreateTask",
41 (
42 queue: Queue,
43 ) => Effect.Effect<
44 (
45 request: CreateTaskRequest,
46 ) => Effect.Effect<
47 cloudtasks.Task,
48 cloudtasks.CreateProjectsLocationsQueuesTasksError,
49 RuntimeContext
50 >
51 >
52 > {}
53
54 export const CreateTask = Binding.Service<CreateTask>("GCP.CloudTasks.CreateTask");