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, 06:00 UTC
| 1 | import * as HttpApi from "effect/http-api/HttpApi"; |
| 2 | import * as HttpApiEndpoint from "effect/http-api/HttpApiEndpoint"; |
| 3 | import * as HttpApiGroup from "effect/http-api/HttpApiGroup"; |
| 4 | import * as Schema from "effect/Schema"; |
| 5 | import { Link, LinkNotFound } from "./Link.ts"; |
| 6 | |
| 7 | const createLink = HttpApiEndpoint.post("create", "/links", { |
| 8 | payload: Schema.Struct({ url: Schema.String }), |
| 9 | success: Link, |
| 10 | }); |
| 11 | |
| 12 | const listLinks = HttpApiEndpoint.get("list", "/links", { |
| 13 | success: Schema.Array(Link), |
| 14 | }); |
| 15 | |
| 16 | const getLink = HttpApiEndpoint.get("get", "/links/:code", { |
| 17 | params: Schema.Struct({ code: Schema.String }), |
| 18 | success: Link, |
| 19 | error: LinkNotFound, |
| 20 | }); |
| 21 | |
| 22 | export const LinksGroup = HttpApiGroup.make("links").add(createLink).add(listLinks).add(getLink); |
| 23 | |
| 24 | /** One value: served by the Worker, called by the dashboard and the tests. */ |
| 25 | export class ShortyApi extends HttpApi.make("ShortyApi").add(LinksGroup) {} |