@1szx1/vite-plugin-swagger2ts 1.0.15 → 1.0.17
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/LICENSE +21 -21
- package/README.md +95 -95
- package/dist/adapters.d.ts +27 -0
- package/dist/{adapters/index.js → adapters.js} +22 -1
- package/dist/{adapters/index.mjs → adapters.mjs} +20 -0
- package/package.json +12 -10
- package/dist/adapters/index.d.ts +0 -13
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 hannoeru
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 hannoeru
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
# vite-plugin-swagger2ts
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/vite-plugin-swagger2ts)
|
|
4
|
-
[](https://www.npmjs.com/package/vite-plugin-swagger2ts)
|
|
5
|
-
[](https://github.com/hannoeru/vite-plugin-swagger2ts/blob/main/src/types.ts)
|
|
6
|
-
[](https://github.com/hannoeru/vite-plugin-swagger2ts/blob/main/LICENSE)
|
|
7
|
-
|
|
8
|
-
## 使用流程
|
|
9
|
-
|
|
10
|
-
1. 安装
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
# npm i vite-plugin-swagger2ts -D
|
|
14
|
-
# or
|
|
15
|
-
# yarn add vite-plugin-swagger2ts -D
|
|
16
|
-
# or
|
|
17
|
-
pnpm add vite-plugin-swagger2ts -D
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
2. 配置到 `vite.config.ts`
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
// vite.config.ts
|
|
24
|
-
import ViteSwagger2ts from "vite-plugin-swagger2ts";
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
plugins: [
|
|
28
|
-
ViteSwagger2ts({
|
|
29
|
-
swaggerUrl: "url", // swagger-resources URL
|
|
30
|
-
output: "pathToSave", // not require, default './src/swagger.ts'
|
|
31
|
-
formatSchema: (schema) => {
|
|
32
|
-
// not require, deal with schema. such as unwrapper common response
|
|
33
|
-
if ("properties" in schema) {
|
|
34
|
-
const properties = schema["properties"];
|
|
35
|
-
if ("code" in properties && ("msg" in properties || "message" in properties) && "data" in properties) {
|
|
36
|
-
return properties["data"];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return schema;
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## 插件流程
|
|
47
|
-
|
|
48
|
-
1. 通过配置的 url 请求 `${baseUrl}/swagger-resources` 地址,获取微服务的 resources 地址;
|
|
49
|
-
2. 通过 resources 地址请求 swagger 具体文档;
|
|
50
|
-
3. 将 swagger 接口生成具体的 typescript 类型:
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
interface SwaggerInterface {
|
|
54
|
-
// SwaggerInterface start
|
|
55
|
-
url: {
|
|
56
|
-
get: {
|
|
57
|
-
param: { path: { id: string }; query: { status: number }; body: { name: string } };
|
|
58
|
-
reponse: { id: string; name: string; status: number };
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
4. 附加 typescrip 转换模版内容:
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import { PathsSwaggerInterface } from "./swagger.ts";
|
|
68
|
-
|
|
69
|
-
export type UrlKey = keyof PathsSwaggerInterface;
|
|
70
|
-
export type MethodKey<U extends UrlKey> = string & keyof PathsSwaggerInterface[U];
|
|
71
|
-
|
|
72
|
-
type SwaggerInterfaceSingle<U extends UrlKey, M extends MethodKey<U>> = PathsSwaggerInterface[U][M];
|
|
73
|
-
type SwaggerField<U extends UrlKey, M extends MethodKey<U>> = keyof SwaggerInterfaceSingle<U, M>;
|
|
74
|
-
type SwaggerFieldType<U extends UrlKey, M extends MethodKey<U>, F extends SwaggerField<U, M>> = SwaggerInterfaceSingle<U, M>[F];
|
|
75
|
-
|
|
76
|
-
export type Param<U extends UrlKey, M extends MethodKey<U>> = SwaggerFieldType<U, M, "param" & SwaggerField<U, M>>;
|
|
77
|
-
export type Response<U extends UrlKey, M extends MethodKey<U>> = SwaggerFieldType<U, M, "response" & SwaggerField<U, M>>;
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
5. 将生成的文件保存到项目指定位置,项目通过以下代码进行使用类型提示;
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
import type { PathKey, MethodKey, Param, Respone } from "configfile";
|
|
84
|
-
|
|
85
|
-
export function customFetch<P extends PathKey, M extends MethodKey<P>>(path: P, method: M, params: Param<P, M>): Promise<Respone<P, M>> {
|
|
86
|
-
// custome code
|
|
87
|
-
return "" as any;
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
6. 业务代码通过引用 `customFetch` 进行使用
|
|
92
|
-
|
|
93
|
-
## License
|
|
94
|
-
|
|
95
|
-
MIT License © 2021 [morelearn1990](https://github.com/morelearn1990)
|
|
1
|
+
# vite-plugin-swagger2ts
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/vite-plugin-swagger2ts)
|
|
4
|
+
[](https://www.npmjs.com/package/vite-plugin-swagger2ts)
|
|
5
|
+
[](https://github.com/hannoeru/vite-plugin-swagger2ts/blob/main/src/types.ts)
|
|
6
|
+
[](https://github.com/hannoeru/vite-plugin-swagger2ts/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## 使用流程
|
|
9
|
+
|
|
10
|
+
1. 安装
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
# npm i vite-plugin-swagger2ts -D
|
|
14
|
+
# or
|
|
15
|
+
# yarn add vite-plugin-swagger2ts -D
|
|
16
|
+
# or
|
|
17
|
+
pnpm add vite-plugin-swagger2ts -D
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. 配置到 `vite.config.ts`
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// vite.config.ts
|
|
24
|
+
import ViteSwagger2ts from "vite-plugin-swagger2ts";
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
plugins: [
|
|
28
|
+
ViteSwagger2ts({
|
|
29
|
+
swaggerUrl: "url", // swagger-resources URL
|
|
30
|
+
output: "pathToSave", // not require, default './src/swagger.ts'
|
|
31
|
+
formatSchema: (schema) => {
|
|
32
|
+
// not require, deal with schema. such as unwrapper common response
|
|
33
|
+
if ("properties" in schema) {
|
|
34
|
+
const properties = schema["properties"];
|
|
35
|
+
if ("code" in properties && ("msg" in properties || "message" in properties) && "data" in properties) {
|
|
36
|
+
return properties["data"];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return schema;
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 插件流程
|
|
47
|
+
|
|
48
|
+
1. 通过配置的 url 请求 `${baseUrl}/swagger-resources` 地址,获取微服务的 resources 地址;
|
|
49
|
+
2. 通过 resources 地址请求 swagger 具体文档;
|
|
50
|
+
3. 将 swagger 接口生成具体的 typescript 类型:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
interface SwaggerInterface {
|
|
54
|
+
// SwaggerInterface start
|
|
55
|
+
url: {
|
|
56
|
+
get: {
|
|
57
|
+
param: { path: { id: string }; query: { status: number }; body: { name: string } };
|
|
58
|
+
reponse: { id: string; name: string; status: number };
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
4. 附加 typescrip 转换模版内容:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { PathsSwaggerInterface } from "./swagger.ts";
|
|
68
|
+
|
|
69
|
+
export type UrlKey = keyof PathsSwaggerInterface;
|
|
70
|
+
export type MethodKey<U extends UrlKey> = string & keyof PathsSwaggerInterface[U];
|
|
71
|
+
|
|
72
|
+
type SwaggerInterfaceSingle<U extends UrlKey, M extends MethodKey<U>> = PathsSwaggerInterface[U][M];
|
|
73
|
+
type SwaggerField<U extends UrlKey, M extends MethodKey<U>> = keyof SwaggerInterfaceSingle<U, M>;
|
|
74
|
+
type SwaggerFieldType<U extends UrlKey, M extends MethodKey<U>, F extends SwaggerField<U, M>> = SwaggerInterfaceSingle<U, M>[F];
|
|
75
|
+
|
|
76
|
+
export type Param<U extends UrlKey, M extends MethodKey<U>> = SwaggerFieldType<U, M, "param" & SwaggerField<U, M>>;
|
|
77
|
+
export type Response<U extends UrlKey, M extends MethodKey<U>> = SwaggerFieldType<U, M, "response" & SwaggerField<U, M>>;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
5. 将生成的文件保存到项目指定位置,项目通过以下代码进行使用类型提示;
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import type { PathKey, MethodKey, Param, Respone } from "configfile";
|
|
84
|
+
|
|
85
|
+
export function customFetch<P extends PathKey, M extends MethodKey<P>>(path: P, method: M, params: Param<P, M>): Promise<Respone<P, M>> {
|
|
86
|
+
// custome code
|
|
87
|
+
return "" as any;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
6. 业务代码通过引用 `customFetch` 进行使用
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT License © 2021 [morelearn1990](https://github.com/morelearn1990)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import Request, { HttpRequestConfig } from 'luch-request';
|
|
3
|
+
|
|
4
|
+
type Get<T, K> = T[K & keyof T];
|
|
5
|
+
|
|
6
|
+
declare function axiosAdapter<T>(httpInstance: AxiosInstance): {
|
|
7
|
+
request: <U extends string & keyof T, M extends string & keyof T[U]>(url: U, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (AxiosRequestConfig<any> & {
|
|
8
|
+
data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
|
|
9
|
+
params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
|
|
10
|
+
path?: Get<T[U][M]["param" & keyof T[U][M]], "path"> | undefined;
|
|
11
|
+
}) | undefined) => Promise<T[U][M]["response" & keyof T[U][M]]>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare function LuchAdapter<T extends Record<string, any>>(httpInstance: Request): {
|
|
15
|
+
request: <U extends keyof T, M extends string & keyof T[U]>(url: U & string, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (HttpRequestConfig<UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask> & {
|
|
16
|
+
data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
|
|
17
|
+
params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
|
|
18
|
+
}) | undefined) => Promise<T[U][M]["response" & keyof T[U][M]]>;
|
|
19
|
+
upload: <U_1 extends { [K in keyof T]: T[K] extends {
|
|
20
|
+
post: any;
|
|
21
|
+
} ? K : never; }[keyof T], P extends Get<T[U_1]["post"]["param" & keyof T[U_1]["post"]], "body" | "query">, N extends keyof P>(url: U_1 & string, config: HttpRequestConfig<UniApp.UploadTask> & {
|
|
22
|
+
name?: N | undefined;
|
|
23
|
+
formData?: Omit<P, N> | undefined;
|
|
24
|
+
}) => Promise<T[U_1]["post"]["response" & keyof T[U_1]["post"]]>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { LuchAdapter, axiosAdapter };
|
|
@@ -17,9 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/adapters
|
|
20
|
+
// src/adapters.ts
|
|
21
21
|
var adapters_exports = {};
|
|
22
22
|
__export(adapters_exports, {
|
|
23
|
+
LuchAdapter: () => LuchAdapter,
|
|
23
24
|
axiosAdapter: () => axiosAdapter
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(adapters_exports);
|
|
@@ -45,7 +46,27 @@ function axiosAdapter(httpInstance) {
|
|
|
45
46
|
}
|
|
46
47
|
return { request };
|
|
47
48
|
}
|
|
49
|
+
|
|
50
|
+
// src/adapters/luchRequest.ts
|
|
51
|
+
function LuchAdapter(httpInstance) {
|
|
52
|
+
async function request(url, method, param, config) {
|
|
53
|
+
const response = await httpInstance.middleware({
|
|
54
|
+
url,
|
|
55
|
+
method: method.toUpperCase(),
|
|
56
|
+
params: method === "get" ? param : config?.params,
|
|
57
|
+
data: method !== "get" ? param : config?.data,
|
|
58
|
+
...config
|
|
59
|
+
});
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
async function upload(url, config) {
|
|
63
|
+
const response = await httpInstance.upload(url, config);
|
|
64
|
+
return response.data;
|
|
65
|
+
}
|
|
66
|
+
return { request, upload };
|
|
67
|
+
}
|
|
48
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
69
|
0 && (module.exports = {
|
|
70
|
+
LuchAdapter,
|
|
50
71
|
axiosAdapter
|
|
51
72
|
});
|
|
@@ -19,6 +19,26 @@ function axiosAdapter(httpInstance) {
|
|
|
19
19
|
}
|
|
20
20
|
return { request };
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
// src/adapters/luchRequest.ts
|
|
24
|
+
function LuchAdapter(httpInstance) {
|
|
25
|
+
async function request(url, method, param, config) {
|
|
26
|
+
const response = await httpInstance.middleware({
|
|
27
|
+
url,
|
|
28
|
+
method: method.toUpperCase(),
|
|
29
|
+
params: method === "get" ? param : config?.params,
|
|
30
|
+
data: method !== "get" ? param : config?.data,
|
|
31
|
+
...config
|
|
32
|
+
});
|
|
33
|
+
return response.data;
|
|
34
|
+
}
|
|
35
|
+
async function upload(url, config) {
|
|
36
|
+
const response = await httpInstance.upload(url, config);
|
|
37
|
+
return response.data;
|
|
38
|
+
}
|
|
39
|
+
return { request, upload };
|
|
40
|
+
}
|
|
22
41
|
export {
|
|
42
|
+
LuchAdapter,
|
|
23
43
|
axiosAdapter
|
|
24
44
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1szx1/vite-plugin-swagger2ts",
|
|
3
3
|
"description": "fork for https://github.com/1SZX1/vite-plugin-swagger2ts",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.17",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "1SZX1 <2414126198@qq.com>",
|
|
7
7
|
"repository": {
|
|
@@ -20,24 +20,24 @@
|
|
|
20
20
|
"types": "./dist/index.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"./adapters": {
|
|
23
|
-
"require": "./dist/adapters
|
|
24
|
-
"import": "./dist/adapters
|
|
25
|
-
"types": "./dist/adapters
|
|
23
|
+
"require": "./dist/adapters.js",
|
|
24
|
+
"import": "./dist/adapters.mjs",
|
|
25
|
+
"types": "./dist/adapters.d.ts"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"main": "dist/index.js",
|
|
29
29
|
"module": "dist/index.mjs",
|
|
30
30
|
"types": "index.d.ts",
|
|
31
31
|
"typesVersions": {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
"*": {
|
|
33
|
+
"*": [
|
|
34
|
+
"./dist/*"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"dev": "pnpm run build -- --watch --ignore-watch examples",
|
|
40
|
-
"build": "tsup src/index.ts src/adapters
|
|
40
|
+
"build": "tsup src/index.ts src/adapters.ts --dts --format cjs,esm",
|
|
41
41
|
"prepublishOnly": "pnpm run build",
|
|
42
42
|
"release": "pnpx git-ensure -a && pnpx bumpp --commit --tag --push",
|
|
43
43
|
"demo:dev": "pnpm -C examples/demo run dev",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@antfu/eslint-config": "^0.6.6",
|
|
61
61
|
"@commitlint/cli": "^12.1.4",
|
|
62
62
|
"@commitlint/config-conventional": "^12.1.4",
|
|
63
|
+
"@dcloudio/types": "^3.2.11",
|
|
63
64
|
"@types/jest": "^26.0.24",
|
|
64
65
|
"@types/node": "^14.18.12",
|
|
65
66
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"jest": "^26.6.3",
|
|
73
74
|
"jest-esbuild": "^0.1.6",
|
|
74
75
|
"lint-staged": "^10.5.4",
|
|
76
|
+
"luch-request": "^3.0.8",
|
|
75
77
|
"rollup": "^2.70.0",
|
|
76
78
|
"ts-node": "^9.1.1",
|
|
77
79
|
"tsup": "^6.6.3",
|
package/dist/adapters/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
-
|
|
3
|
-
type Get<T, K> = T[K & keyof T];
|
|
4
|
-
|
|
5
|
-
declare function axiosAdapter<T>(httpInstance: AxiosInstance): {
|
|
6
|
-
request: <U extends string & keyof T, M extends string & keyof T[U]>(url: U, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (AxiosRequestConfig<any> & {
|
|
7
|
-
data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
|
|
8
|
-
params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
|
|
9
|
-
path?: Get<T[U][M]["param" & keyof T[U][M]], "path"> | undefined;
|
|
10
|
-
}) | undefined) => Promise<T[U][M]["response" & keyof T[U][M]]>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { axiosAdapter };
|