@automatons/typescript-client-axios 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -5,10 +5,26 @@
5
5
  [![npm downloads](https://img.shields.io/npm/dw/@automatons/typescript-client-axios)](https://www.npmjs.com/package/@automatons/typescript-client-axios)
6
6
 
7
7
  ## What is @automatons/typescript-client-axios
8
- This is generator.
9
- Only use openapi-automatons.
8
+ This is the [axios](https://axios-http.com/) client generator for openapi-automatons.
9
+ Only use it via openapi-automatons.
10
10
 
11
- Since v2 this package is **ESM-only** and requires **Node.js >= 22**.
11
+ Since v2 this package is **ESM-only** and requires **Node.js >= 22**. `axios` is a peer dependency.
12
+
13
+ Each generated operation returns a `Promise<AxiosResponse<T>>`, so consumers can write
14
+ `const { data } = await api.xxx()`. Non-2xx responses reject (axios default).
15
+
16
+ ## Generated client
17
+ ```ts
18
+ import axios from "axios";
19
+ import { PetsApi } from "./clients";
20
+
21
+ const api = new PetsApi({
22
+ axios, // optional: a custom axios instance
23
+ security: { bearerAuth: () => getToken() }, // auth for the document's security schemes
24
+ });
25
+
26
+ const { data } = await api.showPetById("1");
27
+ ```
12
28
 
13
29
  ## How can I use @automatons/typescript-client-axios?
14
30
  This library is designed to be used by [openapi-automatons](https://github.com/openapi-automatons/openapi-automatons).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automatons/typescript-client-axios",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "repository": "https://github.com/openapi-automatons/typescript-client-axios.git",
5
5
  "author": "tanmen <yt.prog@gmail.com>",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  "@eslint/js": "^10.0.1",
52
52
  "@semantic-release/changelog": "^6.0.3",
53
53
  "@semantic-release/git": "^10.0.1",
54
- "@types/node": "^24.0.0",
54
+ "@types/node": "^25.9.2",
55
55
  "@vitest/coverage-v8": "^3.2.0",
56
56
  "axios": "^1",
57
57
  "axios-mock-adapter": "^2.1.0",