Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 775 Bytes

File metadata and controls

36 lines (24 loc) · 775 Bytes

openapi-effect

Drop-in replacement for openapi-fetch with an opt-in Effect API.

Install

pnpm add @prover-coder-ai/openapi-effect

Usage (Promise API)

This package implements an openapi-fetch compatible API, so most code can be migrated by changing only the import.

import createClient from "@prover-coder-ai/openapi-effect"
import type { paths } from "./openapi"

const client = createClient<paths>({ baseUrl: "https://api.example.com" })

const { data, error } = await client.GET("/pets", {
  params: { query: { limit: 10 } }
})

if (error) {
  // handle error
}

Usage (Effect API)

Effect-based client is available as an opt-in API.

import { createClientEffect, FetchHttpClient } from "@prover-coder-ai/openapi-effect"