# @stefanprobst/openapi-client

> this is a minimal typed request utility to interact with openapi-specified backends.

Latest version **0.0.3** (published 2023-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stefanprobst/openapi-client
pnpm add @stefanprobst/openapi-client
yarn add @stefanprobst/openapi-client
bun add @stefanprobst/openapi-client
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-10-21 |
| First published | 2023-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 2 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | stefanprobst |

## Links

- npm: https://www.npmjs.com/package/@stefanprobst/openapi-client
- npm.io page: https://npm.io/package/@stefanprobst/openapi-client

## Dependencies (2)

- [@acdh-oeaw/lib](https://npm.io/package/@acdh-oeaw/lib.md) ^0.1.6
- [openapi-typescript-helpers](https://npm.io/package/openapi-typescript-helpers.md) ^0.0.4

## Recent versions

- 0.0.3 (latest) — 2023-10-21
- 0.0.2 — 2023-10-21
- 0.0.1 — 2023-10-21
- 0.0.0 — 2023-10-01

## README

# openapi-client

this is a minimal typed request utility to interact with openapi-specified backends.

it uses
[openapi-typescript](https://github.com/drwpow/openapi-typescript/tree/main/packages/openapi-typescript)
for generating types, and is mostly copied from
[openapi-fetch](https://github.com/drwpow/openapi-typescript/tree/main/packages/openapi-fetch).

## how to install

```bash
npm install @stefanprobst/openapi-client
```

## how to use

first, generate types from an openapi document:

```bash
npx openapi-typescript https://my-backend.org/openapi.json -o ./types/api.ts
```

second, instantiate a typed api client:

```ts
import { createClient } from "@stefanprobst/openapi-client";

import type { paths } from "./types/api";

const client = createClient<paths>({ baseUrl: "http://localhost:3000" });
```

---
_Source: https://npm.io/package/@stefanprobst/openapi-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
