File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # openapi-effect
2+
3+ Drop-in replacement for ` openapi-fetch ` with an opt-in Effect API.
4+
5+ ## Install
6+
7+ ``` bash
8+ pnpm add @prover-coder-ai/openapi-effect
9+ ```
10+
11+ ## Usage (Promise API)
12+
13+ This package re-exports ` openapi-fetch ` , so most code can be migrated by changing only the import.
14+
15+ ``` ts
16+ import createClient from " @prover-coder-ai/openapi-effect"
17+ import type { paths } from " ./openapi"
18+
19+ const client = createClient <paths >({ baseUrl: " https://api.example.com" })
20+
21+ const { data, error } = await client .GET (" /pets" , {
22+ params: { query: { limit: 10 } }
23+ })
24+
25+ if (error ) {
26+ // handle error
27+ }
28+ ```
29+
30+ ## Usage (Effect API)
31+
32+ Effect-based client is available as an opt-in API.
33+
34+ ``` ts
35+ import { createClientEffect , FetchHttpClient } from " @prover-coder-ai/openapi-effect"
36+ ```
You can’t perform that action at this time.
0 commit comments