
OCTOKIT + EFFECT
Octokit,
in Effect.
Run GitHub requests with Octokit and Effect. The adapter is still a design. The examples use the published upstream packages.
TYPESCRIPT
One request.
One Effect.
Pass the fiber’s signal to Octokit so interrupting the request can cancel the fetch.
Read multiple pagesimport { Effect } from "effect"import { Octokit } from "octokit"
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })const repository = Effect.tryPromise({ try: signal => octokit.rest.repos.get({ owner: "octokit", repo: "octokit.js", request: { signal }, }), catch: (cause) => new Error("Could not read the repository", { cause }),})
const { data } = await Effect.runPromise(repository)console.log(data.full_name)