# openapi-axios-query

> OpenAPI client with Axios and React Query

Latest version **0.1.3** (published 2024-04-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install openapi-axios-query
pnpm add openapi-axios-query
yarn add openapi-axios-query
bun add openapi-axios-query
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2024-04-23 |
| First published | 2023-09-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 32.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yuriy Gromchenko |
| Maintainers | gromchen |
| Keywords | openapi, client, axios, react, query |

## Links

- npm: https://www.npmjs.com/package/openapi-axios-query
- Repository: https://github.com/gromchen/openapi-axios-query
- Homepage: https://github.com/gromchen/openapi-axios-query#readme
- Issues: https://github.com/gromchen/openapi-axios-query/issues
- npm.io page: https://npm.io/package/openapi-axios-query

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2024-04-23
- 0.1.1 — 2024-04-22
- 0.1.0 — 2024-04-22
- 0.0.13 — 2024-02-05
- 0.0.12 — 2024-01-25
- 0.0.11 — 2023-10-30
- 0.0.10 — 2023-09-20
- 0.0.9 — 2023-09-15
- 0.0.8 — 2023-09-13
- 0.0.7 — 2023-09-10
- 0.0.6 — 2023-09-10
- 0.0.5 — 2023-09-10
- 0.0.4 — 2023-09-10
- 0.0.3 — 2023-09-10
- 0.0.2 — 2023-09-10
- … 2 more at https://npm.io/package/openapi-axios-query/versions

## README

# Usage

Generate `paths` with `openapi-typescript`. Then you can create a `client`.

```typescript
import axios from "axios";
import { paths } from "./schema";
import { createClient } from "openapi-axios-query";
import { QueryClient } from "@tanstack/react-query";

const queryClient = new QueryClient();

const client = createClient<paths>({
  baseURL: "https://api.my-website.com",
  axios,
  context: queryClient,
});

// Use typed axios
const response = await client.axios("/v1/my-api");

// Or use typed query
const { data } = client.useQuery({
  url: "/v1/my-api",
  options: {},
});

// Or typed query helpers
const { invalidateQueries } = client.useQueryHelpers();
invalidateQueries({ queryKey: ["/v1/my-api"] }),
```

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