Proposed adapter API
Design specification. The package currently exports no runtime API. The signatures and snippets on this page describe the proposed adapter. For code you can run, start with Make a GitHub request.
Calls keep their Octokit member paths. A request returns a lazy Effect, each page iterator returns a Stream, and endpoint preparation runs synchronously. The table specifies the result and execution rules for each family.
| SDK member or shape | Public result | Rule |
|---|---|---|
client.rest.pulls.get(args), client.request(...) |
Effect<Response, GitHubError> |
Preserve the complete upstream response, including metadata. |
client.graphql<T>(...) |
Effect<T, GitHubError> |
Preserve the operation result type and partial-data failure. |
client.paginate(...), client.graphql.paginate<T>(...) |
Effect containing the upstream collected array or merged query | Collection is an explicit choice. |
client.paginate.iterator(...), client.pages(...) |
Stream of normalized REST responses | Fresh iterator on each run. client.items(...) emits each record in order. |
client.graphql.paginate.iterator<T>(...) |
Stream of query-shaped pages | A query may contain more than one array. The consumer selects the connection. |
client.request.endpoint.parse(...), endpoint metadata and constructor defaults |
Synchronous preparation or derived facade | Keep synchronous helpers directly usable. Derived callables use their own actual capabilities. |
client.auth(...), app.getInstallationOctokit(id), oauth.getUserOctokit(...) |
Effect of the specific auth result or child facade | Child clients retain the original user’s or installation’s authority. |
app.eachInstallation.iterator(), app.eachRepository.iterator(...) |
Stream of paired client and installation/repository | Supply callback forms for callers who need traversal completion. |
webhooks.verifyAndReceive(event), webhooks.receive(trustedEvent) |
Effect of completed dispatch | Handler completion, verification failure and aggregate failures remain observable. |
webhooks.on(name, handler), hook registrations |
Scoped registration where the upstream contract supports release | Bridge the handler’s Effect environment and preserve the SDK callback contract. |
client.use((raw, signal) => ...) |
Effect of the callback’s result | Pass the concrete plugin-extended client. Cancellation of its work depends on what the callback does with the signal. |
Installation-scoped read
Section titled “Installation-scoped read”const openPulls = Effect.gen(function* () { const github = yield* GitHub; return yield* github .items('GET /repos/{owner}/{repo}/pulls', { owner: 'kjanat', repo: 'effect-octokit', state: 'open', }) .pipe( Stream.take(10), Stream.map((pr) => pr.number), Stream.runCollect, );});Plugin-specific work
Section titled “Plugin-specific work”const github = fromOctokit(myPluginClient);const result = github.use((raw, signal) => raw.myPlugin.lookup({ id, request: { signal } }));The callback operates on the actual supplied instance. For a plugin that returns an async iterable or unregister function, supply a typed Stream or scoped adapter with the matching lifetime. For a synchronous getter that reads the clock, creates a nonce or mutates state, offer deferred execution explicitly. Raw log methods stay callable at the SDK boundary; diagnostics emitted by the adapter belongs in an Effect and uses the application’s redaction policy.