@automatons/typescript-client-fetch 1.2.0 → 1.2.2
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.
- package/README.md +15 -0
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -12,6 +12,21 @@ This package is **ESM-only** and requires **Node.js >= 22**.
|
|
|
12
12
|
Each generated operation returns a `FetchResponse<T>` (`{ data, status, statusText, headers, response }`), so consumers can write `const { data } = await api.xxx()`.
|
|
13
13
|
Non-2xx responses are **not** thrown — inspect `response.ok` / `status` instead.
|
|
14
14
|
|
|
15
|
+
## Generated client
|
|
16
|
+
```ts
|
|
17
|
+
import { PetsApi } from "./clients";
|
|
18
|
+
|
|
19
|
+
const api = new PetsApi({
|
|
20
|
+
// `fetch` defaults to the global fetch; pass one to customise it
|
|
21
|
+
security: { bearerAuth: () => getToken() }, // auth for the document's security schemes
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const { data, response } = await api.showPetById("1");
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
// non-2xx is not thrown — handle it here
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
15
30
|
## How can I use @automatons/typescript-client-fetch?
|
|
16
31
|
This library is designed to be used by [openapi-automatons](https://github.com/openapi-automatons/openapi-automatons).
|
|
17
32
|
Please read the [readme](https://github.com/openapi-automatons/openapi-automatons/blob/main/README.md) of [openapi-automatons](https://github.com/openapi-automatons/openapi-automatons) for how to use it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automatons/typescript-client-fetch",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"repository": "https://github.com/openapi-automatons/typescript-client-fetch.git",
|
|
5
5
|
"author": "tanmen <yt.prog@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"prepare": "husky"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@automatons/parser": "^1.2.
|
|
39
|
-
"@automatons/tools": "^2.2.
|
|
40
|
-
"prettier": "^3.
|
|
38
|
+
"@automatons/parser": "^1.2.47",
|
|
39
|
+
"@automatons/tools": "^2.2.33",
|
|
40
|
+
"prettier": "^3.9.6",
|
|
41
41
|
"ts-morph": "^28.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -45,24 +45,24 @@
|
|
|
45
45
|
"openapi-automatons": "^2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@commitlint/cli": "^21.
|
|
48
|
+
"@commitlint/cli": "^21.2.1",
|
|
49
49
|
"@commitlint/config-conventional": "^21.0.2",
|
|
50
50
|
"@eslint/js": "^10.0.1",
|
|
51
|
-
"@semantic-release/changelog": "^
|
|
52
|
-
"@semantic-release/git": "^
|
|
53
|
-
"@types/node": "^
|
|
51
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
52
|
+
"@semantic-release/git": "^11.0.0",
|
|
53
|
+
"@types/node": "^26.1.1",
|
|
54
54
|
"@vitest/coverage-v8": "^3.2.0",
|
|
55
55
|
"depcheck": "^1.4.7",
|
|
56
|
-
"eslint": "^10.
|
|
56
|
+
"eslint": "^10.7.0",
|
|
57
57
|
"eslint-config-prettier": "^10.1.8",
|
|
58
58
|
"husky": "^9.1.7",
|
|
59
|
-
"lint-staged": "^17.0
|
|
60
|
-
"object-to-formdata": "^
|
|
61
|
-
"semantic-release": "^25.0.
|
|
59
|
+
"lint-staged": "^17.2.0",
|
|
60
|
+
"object-to-formdata": "^5.0.0",
|
|
61
|
+
"semantic-release": "^25.0.8",
|
|
62
62
|
"tsup": "^8.5.0",
|
|
63
|
-
"tsx": "^4.
|
|
63
|
+
"tsx": "^4.23.1",
|
|
64
64
|
"typescript": "^6.0.3",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
65
|
+
"typescript-eslint": "^8.65.0",
|
|
66
66
|
"vitest": "^3.2.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|