@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 74 lines 2.47 KB
Raw
1 /**
2 * The `github` group: a GitHub REST v3 facade at `/api/v3`, so `gh api`
3 * and Octokit work against the host unmodified (DESIGN.md §5). The routes
4 * answer with GitHub-shaped JSON they build themselves and declare no
5 * success schema.
6 */
7 import * as HttpApiEndpoint from "effect/http-api/HttpApiEndpoint";
8 import * as HttpApiGroup from "effect/http-api/HttpApiGroup";
9
10 /** `GET /user`: the credential probe `gh` makes; answer it from your own user record. */
11 export const GitHubUser = HttpApiEndpoint.get("user", "/user", {});
12
13 /** `GET /repos/:owner/:repo` */
14 export const GitHubRepo = HttpApiEndpoint.get("repo", "/repos/:owner/:repo", {});
15
16 /** `GET /repos/:owner/:repo/branches` */
17 export const GitHubBranches = HttpApiEndpoint.get("branches", "/repos/:owner/:repo/branches", {});
18
19 /** `GET /repos/:owner/:repo/commits` */
20 export const GitHubCommits = HttpApiEndpoint.get("commits", "/repos/:owner/:repo/commits", {});
21
22 /** `GET /repos/:owner/:repo/commits/:sha` */
23 export const GitHubCommit = HttpApiEndpoint.get("commit", "/repos/:owner/:repo/commits/:sha", {});
24
25 /** `GET /repos/:owner/:repo/contents/*` */
26 export const GitHubContents = HttpApiEndpoint.get("contents", "/repos/:owner/:repo/contents/*", {});
27
28 /** `GET /repos/:owner/:repo/pulls` */
29 export const GitHubPulls = HttpApiEndpoint.get("pulls", "/repos/:owner/:repo/pulls", {});
30
31 /** `POST /repos/:owner/:repo/pulls` */
32 export const GitHubCreatePull = HttpApiEndpoint.post("createPull", "/repos/:owner/:repo/pulls", {});
33
34 /** `GET /repos/:owner/:repo/pulls/:number` */
35 export const GitHubPull = HttpApiEndpoint.get("pull", "/repos/:owner/:repo/pulls/:number", {});
36
37 /** `PATCH /repos/:owner/:repo/pulls/:number` */
38 export const GitHubUpdatePull = HttpApiEndpoint.patch(
39 "updatePull",
40 "/repos/:owner/:repo/pulls/:number",
41 {},
42 );
43
44 /** `PUT /repos/:owner/:repo/pulls/:number/merge` */
45 export const GitHubMergePull = HttpApiEndpoint.put(
46 "mergePull",
47 "/repos/:owner/:repo/pulls/:number/merge",
48 {},
49 );
50
51 /** `GET /repos/:owner/:repo/pulls/:number/files` */
52 export const GitHubPullFiles = HttpApiEndpoint.get(
53 "pullFiles",
54 "/repos/:owner/:repo/pulls/:number/files",
55 {},
56 );
57
58 /** The GitHub facade, mounted at `/api/v3`. */
59 export class GitHub extends HttpApiGroup.make("github")
60 .add(
61 GitHubUser,
62 GitHubRepo,
63 GitHubBranches,
64 GitHubCommits,
65 GitHubCommit,
66 GitHubContents,
67 GitHubPulls,
68 GitHubCreatePull,
69 GitHubPull,
70 GitHubUpdatePull,
71 GitHubMergePull,
72 GitHubPullFiles,
73 )
74 .prefix("/api/v3") {}