@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 50 lines 1.48 KB
Raw
1 import type { NotFound } from "@distilled.cloud/github/Errors";
2 import type * as Issues from "@distilled.cloud/github/issues";
3 import * as Binding from "alchemy/Binding";
4 import type { RuntimeContext } from "alchemy/RuntimeContext";
5 import type * as Effect from "effect/Effect";
6 import type { IssueNotFound } from "./Errors.ts";
7 import type { Repository } from "./Repository.ts";
8
9 export interface UpdateIssueRequest extends Omit<Issues.UpdateRequest, "owner" | "repo"> {}
10
11 export type UpdateIssueResponse = Issues.UpdateResponse;
12
13 /**
14 * Update one issue by number (`issues.update`): state, title, body, labels,
15 * assignees. A missing issue fails with the typed {@link IssueNotFound}.
16 *
17 * Provide `GitHub.UpdateIssueHttp` on a Worker or Function, or
18 * `GitHub.UpdateIssueLocal` on an Action.
19 *
20 * ### Updating Issues at Runtime
21 * **Example:** Close an issue as completed
22 * ```typescript
23 * const updateIssue = yield* GitHub.UpdateIssue(yield* Repo);
24 * yield* updateIssue({
25 * issue_number: 7,
26 * state: "closed",
27 * state_reason: "completed",
28 * });
29 * ```
30 *
31 * @binding
32 * @product Issue
33 */
34 export interface UpdateIssue extends Binding.Service<
35 UpdateIssue,
36 "GitHub.UpdateIssue",
37 (
38 repo: Repository,
39 ) => Effect.Effect<
40 (
41 request: UpdateIssueRequest,
42 ) => Effect.Effect<
43 UpdateIssueResponse,
44 Exclude<Issues.UpdateError, NotFound> | IssueNotFound,
45 RuntimeContext
46 >
47 >
48 > {}
49
50 export const UpdateIssue = Binding.Service<UpdateIssue>("GitHub.UpdateIssue");