The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as HttpApiClient from "effect/http-api/HttpApiClient"; |
| 3 | import * as FetchHttpClient from "effect/http/FetchHttpClient"; |
| 4 | import { ShortyApi } from "./ShortyApi.ts"; |
| 5 | |
| 6 | declare const API_URL: string; |
| 7 | |
| 8 | // #region show |
| 9 | const shorty = HttpApiClient.make(ShortyApi, { baseUrl: API_URL }); |
| 10 | |
| 11 | export const createLink = (url: string) => |
| 12 | shorty.pipe( |
| 13 | Effect.flatMap((client) => client.links.create({ payload: { url } })), |
| 14 | Effect.provide(FetchHttpClient.layer), |
| 15 | Effect.runPromise, |
| 16 | ); |
| 17 | // #endregion show |