Drop-in replacement for openapi-fetch with an opt-in Effect API.
pnpm add @prover-coder-ai/openapi-effectThis package implements openapi-fetch compatible method inputs and response envelopes.
import{Effect}from"effect"importcreateClientfrom"@prover-coder-ai/openapi-effect"importtype{paths}from"./openapi"constclient=createClient<paths>({baseUrl: "https://api.example.com"})constprogram=Effect.gen(function*(){const{ data, error }=yield*client.GET("/pets",{params: {query: {limit: 10}}})returnerror??data})createClientEffect keeps the same method inputs but moves non-2xx responses into the Effect error channel.
import{Effect}from"effect"import{createClientEffect}from"@prover-coder-ai/openapi-effect"importtype{paths}from"./openapi"constclient=createClientEffect<paths>({baseUrl: "https://api.example.com"})constprogram=Effect.gen(function*(){constresult=yield*client.GET("/pets",{params: {query: {limit: 10}}})returnresult.body})