@fecommunity/reactpress-toolkit 1.0.0-beta.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.
- package/LICENSE +21 -0
- package/demos/simple.ts +65 -0
- package/dist/api/Admin.d.ts +14 -0
- package/dist/api/Admin.js +32 -0
- package/dist/api/All.d.ts +14 -0
- package/dist/api/All.js +32 -0
- package/dist/api/Archives.d.ts +14 -0
- package/dist/api/Archives.js +32 -0
- package/dist/api/Article.d.ts +108 -0
- package/dist/api/Article.js +177 -0
- package/dist/api/Auth.d.ts +27 -0
- package/dist/api/Auth.js +56 -0
- package/dist/api/Book.d.ts +15 -0
- package/dist/api/Book.js +33 -0
- package/dist/api/Category.d.ts +44 -0
- package/dist/api/Category.js +81 -0
- package/dist/api/Chapter.d.ts +15 -0
- package/dist/api/Chapter.js +33 -0
- package/dist/api/Comment.d.ts +52 -0
- package/dist/api/Comment.js +93 -0
- package/dist/api/File.d.ts +36 -0
- package/dist/api/File.js +69 -0
- package/dist/api/Get.d.ts +14 -0
- package/dist/api/Get.js +32 -0
- package/dist/api/Github.d.ts +14 -0
- package/dist/api/Github.js +32 -0
- package/dist/api/Host.d.ts +14 -0
- package/dist/api/Host.js +32 -0
- package/dist/api/Id.d.ts +284 -0
- package/dist/api/Id.js +422 -0
- package/dist/api/Knowledge.d.ts +68 -0
- package/dist/api/Knowledge.js +118 -0
- package/dist/api/Login.d.ts +14 -0
- package/dist/api/Login.js +32 -0
- package/dist/api/Page.d.ts +52 -0
- package/dist/api/Page.js +93 -0
- package/dist/api/Password.d.ts +15 -0
- package/dist/api/Password.js +33 -0
- package/dist/api/Recommend.d.ts +14 -0
- package/dist/api/Recommend.js +32 -0
- package/dist/api/Register.d.ts +15 -0
- package/dist/api/Register.js +33 -0
- package/dist/api/Search.d.ts +27 -0
- package/dist/api/Search.js +56 -0
- package/dist/api/Setting.d.ts +20 -0
- package/dist/api/Setting.js +45 -0
- package/dist/api/Smtp.d.ts +28 -0
- package/dist/api/Smtp.js +57 -0
- package/dist/api/Tag.d.ts +52 -0
- package/dist/api/Tag.js +93 -0
- package/dist/api/Update.d.ts +15 -0
- package/dist/api/Update.js +33 -0
- package/dist/api/Upload.d.ts +15 -0
- package/dist/api/Upload.js +33 -0
- package/dist/api/Url.d.ts +14 -0
- package/dist/api/Url.js +32 -0
- package/dist/api/User.d.ts +36 -0
- package/dist/api/User.js +72 -0
- package/dist/api/View.d.ts +44 -0
- package/dist/api/View.js +81 -0
- package/dist/api/api-instance.d.ts +39 -0
- package/dist/api/api-instance.js +46 -0
- package/dist/api/http-client.d.ts +41 -0
- package/dist/api/http-client.js +94 -0
- package/dist/api/httpClient.d.ts +41 -0
- package/dist/api/httpClient.js +94 -0
- package/dist/api/index.d.ts +18 -0
- package/dist/api/index.js +43 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +46 -0
- package/dist/types/data-contracts.d.ts +177 -0
- package/dist/types/data-contracts.js +12 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +19 -0
- package/dist/utils/common.d.ts +23 -0
- package/dist/utils/common.js +78 -0
- package/dist/utils/http.d.ts +3 -0
- package/dist/utils/http.js +47 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +20 -0
- package/package.json +19 -0
- package/scripts/generate-api-types.js +571 -0
- package/scripts/generate-swagger.js +47 -0
- package/scripts/organize-api.js +136 -0
- package/src/api/Article.ts +186 -0
- package/src/api/Auth.ts +54 -0
- package/src/api/Category.ts +82 -0
- package/src/api/Comment.ts +95 -0
- package/src/api/File.ts +69 -0
- package/src/api/Knowledge.ts +122 -0
- package/src/api/Page.ts +95 -0
- package/src/api/Search.ts +54 -0
- package/src/api/Setting.ts +43 -0
- package/src/api/Smtp.ts +56 -0
- package/src/api/Tag.ts +95 -0
- package/src/api/User.ts +72 -0
- package/src/api/View.ts +82 -0
- package/src/api/api-instance.ts +69 -0
- package/src/api/httpClient.ts +140 -0
- package/src/api/index.ts +25 -0
- package/src/index.ts +18 -0
- package/src/types/data-contracts.ts +198 -0
- package/src/types/index.ts +4 -0
- package/src/utils/common.ts +108 -0
- package/src/utils/http.ts +52 -0
- package/src/utils/index.ts +5 -0
- package/test-final.js +56 -0
- package/test-import.js +34 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
|
|
4
|
+
// 配置常量
|
|
5
|
+
const SRC_DIR = path.resolve(__dirname, '../src');
|
|
6
|
+
const API_DIR = path.join(SRC_DIR, 'api');
|
|
7
|
+
const TYPES_DIR = path.join(SRC_DIR, 'types');
|
|
8
|
+
const UTILS_DIR = path.join(SRC_DIR, 'utils');
|
|
9
|
+
|
|
10
|
+
// 修复 API 文件中的导入路径
|
|
11
|
+
async function fixApiImports() {
|
|
12
|
+
console.log('🔧 修复 API 文件中的导入路径...');
|
|
13
|
+
|
|
14
|
+
// 获取所有 API 文件
|
|
15
|
+
const apiFiles = fs.readdirSync(API_DIR).filter(file => file.endsWith('.ts') && file !== 'index.ts');
|
|
16
|
+
|
|
17
|
+
for (const file of apiFiles) {
|
|
18
|
+
const filePath = path.join(API_DIR, file);
|
|
19
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
20
|
+
|
|
21
|
+
// 修复导入路径
|
|
22
|
+
content = content.replace(
|
|
23
|
+
/from '\.\/data-contracts'/g,
|
|
24
|
+
"from '../types/data-contracts'"
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// 修复其他可能的类型导入
|
|
28
|
+
content = content.replace(
|
|
29
|
+
/from '\.\/([^']+)'/g,
|
|
30
|
+
(match, importPath) => {
|
|
31
|
+
// 如果导入路径是类型文件,则重定向到 types 目录
|
|
32
|
+
if (importPath.includes('contract') || importPath === 'types') {
|
|
33
|
+
return `from '../types/${importPath}'`;
|
|
34
|
+
}
|
|
35
|
+
return match;
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// 写入修复后的内容
|
|
40
|
+
fs.writeFileSync(filePath, content);
|
|
41
|
+
console.log(`✅ 修复 ${file} 的导入路径`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log('✅ 所有 API 文件的导入路径已修复');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 创建统一的类型索引
|
|
48
|
+
async function createTypeIndex() {
|
|
49
|
+
console.log('📝 创建统一的类型索引...');
|
|
50
|
+
|
|
51
|
+
// 获取所有类型文件
|
|
52
|
+
const typeFiles = fs.readdirSync(TYPES_DIR).filter(file => file.endsWith('.ts') && file !== 'index.ts');
|
|
53
|
+
|
|
54
|
+
let indexContent = '// 类型定义索引\n// 自动生成,请勿手动修改\n\n';
|
|
55
|
+
|
|
56
|
+
// 添加所有类型文件的导出
|
|
57
|
+
typeFiles.forEach(file => {
|
|
58
|
+
const moduleName = file.replace('.ts', '');
|
|
59
|
+
indexContent += `export * from './${moduleName}';\n`;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// 写入索引文件
|
|
63
|
+
fs.writeFileSync(path.join(TYPES_DIR, 'index.ts'), indexContent);
|
|
64
|
+
console.log('✅ 类型索引文件已创建');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 创建统一的 API 索引
|
|
68
|
+
async function createApiIndex() {
|
|
69
|
+
console.log('📝 创建统一的 API 索引...');
|
|
70
|
+
|
|
71
|
+
// 获取所有 API 文件
|
|
72
|
+
const apiFiles = fs.readdirSync(API_DIR).filter(file => file.endsWith('.ts') && file !== 'index.ts');
|
|
73
|
+
|
|
74
|
+
let indexContent = '// API 客户端索引\n// 自动生成,请勿手动修改\n\n';
|
|
75
|
+
|
|
76
|
+
// 添加所有 API 文件的导出
|
|
77
|
+
apiFiles.forEach(file => {
|
|
78
|
+
const moduleName = file.replace('.ts', '');
|
|
79
|
+
indexContent += `export * from './${moduleName}';\n`;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// 添加默认导出(如果有 API 客户端)
|
|
83
|
+
const clientFiles = apiFiles.filter(file => file.includes('client'));
|
|
84
|
+
if (clientFiles.length > 0) {
|
|
85
|
+
const clientFile = clientFiles[0];
|
|
86
|
+
const clientName = clientFile.replace('.ts', '');
|
|
87
|
+
indexContent += `\nexport { default as ${clientName} } from './${clientName}';\n`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 写入索引文件
|
|
91
|
+
fs.writeFileSync(path.join(API_DIR, 'index.ts'), indexContent);
|
|
92
|
+
console.log('✅ API 索引文件已创建');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 创建主入口文件
|
|
96
|
+
async function createMainIndex() {
|
|
97
|
+
console.log('📝 创建主入口文件...');
|
|
98
|
+
|
|
99
|
+
const mainIndexContent = `// Auto-generated API client
|
|
100
|
+
// Generated from Swagger/OpenAPI specification
|
|
101
|
+
|
|
102
|
+
import * as api from './api';
|
|
103
|
+
import * as types from './types';
|
|
104
|
+
import * as utils from './utils';
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
export { api, types, utils }
|
|
108
|
+
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
fs.writeFileSync(path.join(SRC_DIR, 'index.ts'), mainIndexContent);
|
|
112
|
+
console.log('✅ 主入口文件已创建');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 修复所有文件
|
|
116
|
+
async function fixAllFiles() {
|
|
117
|
+
try {
|
|
118
|
+
await fixApiImports();
|
|
119
|
+
await createTypeIndex();
|
|
120
|
+
await createApiIndex();
|
|
121
|
+
await createMainIndex();
|
|
122
|
+
|
|
123
|
+
console.log('🎉 所有文件修复完成!');
|
|
124
|
+
console.log('📁 修复后的文件结构:');
|
|
125
|
+
console.log(' - src/api/ # API 客户端 (导入路径已修复)');
|
|
126
|
+
console.log(' - src/types/ # 类型定义');
|
|
127
|
+
console.log(' - src/utils/ # 工具函数');
|
|
128
|
+
console.log(' - src/index.ts # 主入口文件');
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error('❌ 文件修复失败:', error.message);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 执行修复
|
|
136
|
+
fixAllFiles();
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/*
|
|
4
|
+
* ---------------------------------------------------------------
|
|
5
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
6
|
+
* ## ##
|
|
7
|
+
* ## AUTHOR: acacode ##
|
|
8
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
9
|
+
* ---------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { IArticle } from '../types/data-contracts';
|
|
13
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
14
|
+
|
|
15
|
+
export class Article<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Article
|
|
20
|
+
* @name create
|
|
21
|
+
* @request POST:/article
|
|
22
|
+
*/
|
|
23
|
+
create = (params: RequestParams = {}) =>
|
|
24
|
+
this.request<IArticle[], any>({
|
|
25
|
+
path: `/article`,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
format: 'json',
|
|
28
|
+
...params,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* No description
|
|
32
|
+
*
|
|
33
|
+
* @tags Article
|
|
34
|
+
* @name findAll
|
|
35
|
+
* @request GET:/article
|
|
36
|
+
*/
|
|
37
|
+
findAll = (params: RequestParams = {}) =>
|
|
38
|
+
this.request<void, any>({
|
|
39
|
+
path: `/article`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
...params,
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* No description
|
|
45
|
+
*
|
|
46
|
+
* @tags Article
|
|
47
|
+
* @name findByCategory
|
|
48
|
+
* @request GET:/article/category/{id}
|
|
49
|
+
*/
|
|
50
|
+
findByCategory = (id: string, params: RequestParams = {}) =>
|
|
51
|
+
this.request<void, any>({
|
|
52
|
+
path: `/article/category/${id}`,
|
|
53
|
+
method: 'GET',
|
|
54
|
+
...params,
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* No description
|
|
58
|
+
*
|
|
59
|
+
* @tags Article
|
|
60
|
+
* @name findByTag
|
|
61
|
+
* @request GET:/article/tag/{id}
|
|
62
|
+
*/
|
|
63
|
+
findByTag = (id: string, params: RequestParams = {}) =>
|
|
64
|
+
this.request<void, any>({
|
|
65
|
+
path: `/article/tag/${id}`,
|
|
66
|
+
method: 'GET',
|
|
67
|
+
...params,
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* No description
|
|
71
|
+
*
|
|
72
|
+
* @tags Article
|
|
73
|
+
* @name getRecommendations
|
|
74
|
+
* @request GET:/article/all/recommend
|
|
75
|
+
*/
|
|
76
|
+
getRecommendations = (params: RequestParams = {}) =>
|
|
77
|
+
this.request<void, any>({
|
|
78
|
+
path: `/article/all/recommend`,
|
|
79
|
+
method: 'GET',
|
|
80
|
+
...params,
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* No description
|
|
84
|
+
*
|
|
85
|
+
* @tags Article
|
|
86
|
+
* @name getArchives
|
|
87
|
+
* @request GET:/article/archives
|
|
88
|
+
*/
|
|
89
|
+
getArchives = (params: RequestParams = {}) =>
|
|
90
|
+
this.request<void, any>({
|
|
91
|
+
path: `/article/archives`,
|
|
92
|
+
method: 'GET',
|
|
93
|
+
...params,
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* No description
|
|
97
|
+
*
|
|
98
|
+
* @tags Article
|
|
99
|
+
* @name recommend
|
|
100
|
+
* @request GET:/article/recommend
|
|
101
|
+
*/
|
|
102
|
+
recommend = (params: RequestParams = {}) =>
|
|
103
|
+
this.request<void, any>({
|
|
104
|
+
path: `/article/recommend`,
|
|
105
|
+
method: 'GET',
|
|
106
|
+
...params,
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* No description
|
|
110
|
+
*
|
|
111
|
+
* @tags Article
|
|
112
|
+
* @name findById
|
|
113
|
+
* @request GET:/article/{id}
|
|
114
|
+
*/
|
|
115
|
+
findById = (id: string, params: RequestParams = {}) =>
|
|
116
|
+
this.request<void, any>({
|
|
117
|
+
path: `/article/${id}`,
|
|
118
|
+
method: 'GET',
|
|
119
|
+
...params,
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* No description
|
|
123
|
+
*
|
|
124
|
+
* @tags Article
|
|
125
|
+
* @name updateById
|
|
126
|
+
* @request PATCH:/article/{id}
|
|
127
|
+
*/
|
|
128
|
+
updateById = (id: string, params: RequestParams = {}) =>
|
|
129
|
+
this.request<void, any>({
|
|
130
|
+
path: `/article/${id}`,
|
|
131
|
+
method: 'PATCH',
|
|
132
|
+
...params,
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* No description
|
|
136
|
+
*
|
|
137
|
+
* @tags Article
|
|
138
|
+
* @name deleteById
|
|
139
|
+
* @request DELETE:/article/{id}
|
|
140
|
+
*/
|
|
141
|
+
deleteById = (id: string, params: RequestParams = {}) =>
|
|
142
|
+
this.request<void, any>({
|
|
143
|
+
path: `/article/${id}`,
|
|
144
|
+
method: 'DELETE',
|
|
145
|
+
...params,
|
|
146
|
+
});
|
|
147
|
+
/**
|
|
148
|
+
* No description
|
|
149
|
+
*
|
|
150
|
+
* @tags Article
|
|
151
|
+
* @name checkPassword
|
|
152
|
+
* @request POST:/article/{id}/checkPassword
|
|
153
|
+
*/
|
|
154
|
+
checkPassword = (id: string, params: RequestParams = {}) =>
|
|
155
|
+
this.request<void, any>({
|
|
156
|
+
path: `/article/${id}/checkPassword`,
|
|
157
|
+
method: 'POST',
|
|
158
|
+
...params,
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* No description
|
|
162
|
+
*
|
|
163
|
+
* @tags Article
|
|
164
|
+
* @name updateViews
|
|
165
|
+
* @request POST:/article/{id}/views
|
|
166
|
+
*/
|
|
167
|
+
updateViews = (id: string, params: RequestParams = {}) =>
|
|
168
|
+
this.request<void, any>({
|
|
169
|
+
path: `/article/${id}/views`,
|
|
170
|
+
method: 'POST',
|
|
171
|
+
...params,
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* No description
|
|
175
|
+
*
|
|
176
|
+
* @tags Article
|
|
177
|
+
* @name updateLikes
|
|
178
|
+
* @request POST:/article/{id}/likes
|
|
179
|
+
*/
|
|
180
|
+
updateLikes = (id: string, params: RequestParams = {}) =>
|
|
181
|
+
this.request<void, any>({
|
|
182
|
+
path: `/article/${id}/likes`,
|
|
183
|
+
method: 'POST',
|
|
184
|
+
...params,
|
|
185
|
+
});
|
|
186
|
+
}
|
package/src/api/Auth.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/*
|
|
4
|
+
* ---------------------------------------------------------------
|
|
5
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
6
|
+
* ## ##
|
|
7
|
+
* ## AUTHOR: acacode ##
|
|
8
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
9
|
+
* ---------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
13
|
+
|
|
14
|
+
export class Auth<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
15
|
+
/**
|
|
16
|
+
* No description
|
|
17
|
+
*
|
|
18
|
+
* @tags Auth
|
|
19
|
+
* @name AuthControllerLogin
|
|
20
|
+
* @request POST:/auth/login
|
|
21
|
+
*/
|
|
22
|
+
authControllerLogin = (params: RequestParams = {}) =>
|
|
23
|
+
this.request<void, any>({
|
|
24
|
+
path: `/auth/login`,
|
|
25
|
+
method: 'POST',
|
|
26
|
+
...params,
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* No description
|
|
30
|
+
*
|
|
31
|
+
* @tags Auth
|
|
32
|
+
* @name createBook
|
|
33
|
+
* @request POST:/auth/admin
|
|
34
|
+
*/
|
|
35
|
+
createBook = (params: RequestParams = {}) =>
|
|
36
|
+
this.request<void, any>({
|
|
37
|
+
path: `/auth/admin`,
|
|
38
|
+
method: 'POST',
|
|
39
|
+
...params,
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* No description
|
|
43
|
+
*
|
|
44
|
+
* @tags Auth
|
|
45
|
+
* @name AuthControllerLoginWithGithub
|
|
46
|
+
* @request POST:/auth/github
|
|
47
|
+
*/
|
|
48
|
+
authControllerLoginWithGithub = (params: RequestParams = {}) =>
|
|
49
|
+
this.request<void, any>({
|
|
50
|
+
path: `/auth/github`,
|
|
51
|
+
method: 'POST',
|
|
52
|
+
...params,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/*
|
|
4
|
+
* ---------------------------------------------------------------
|
|
5
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
6
|
+
* ## ##
|
|
7
|
+
* ## AUTHOR: acacode ##
|
|
8
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
9
|
+
* ---------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { ICategory } from '../types/data-contracts';
|
|
13
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
14
|
+
|
|
15
|
+
export class Category<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Category
|
|
20
|
+
* @name create
|
|
21
|
+
* @request POST:/category
|
|
22
|
+
*/
|
|
23
|
+
create = (params: RequestParams = {}) =>
|
|
24
|
+
this.request<ICategory[], any>({
|
|
25
|
+
path: `/category`,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
format: 'json',
|
|
28
|
+
...params,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* No description
|
|
32
|
+
*
|
|
33
|
+
* @tags Category
|
|
34
|
+
* @name findAll
|
|
35
|
+
* @request GET:/category
|
|
36
|
+
*/
|
|
37
|
+
findAll = (params: RequestParams = {}) =>
|
|
38
|
+
this.request<void, any>({
|
|
39
|
+
path: `/category`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
...params,
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* No description
|
|
45
|
+
*
|
|
46
|
+
* @tags Category
|
|
47
|
+
* @name findById
|
|
48
|
+
* @request GET:/category/{id}
|
|
49
|
+
*/
|
|
50
|
+
findById = (id: string, params: RequestParams = {}) =>
|
|
51
|
+
this.request<void, any>({
|
|
52
|
+
path: `/category/${id}`,
|
|
53
|
+
method: 'GET',
|
|
54
|
+
...params,
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* No description
|
|
58
|
+
*
|
|
59
|
+
* @tags Category
|
|
60
|
+
* @name updateById
|
|
61
|
+
* @request PATCH:/category/{id}
|
|
62
|
+
*/
|
|
63
|
+
updateById = (id: string, params: RequestParams = {}) =>
|
|
64
|
+
this.request<void, any>({
|
|
65
|
+
path: `/category/${id}`,
|
|
66
|
+
method: 'PATCH',
|
|
67
|
+
...params,
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* No description
|
|
71
|
+
*
|
|
72
|
+
* @tags Category
|
|
73
|
+
* @name deleteById
|
|
74
|
+
* @request DELETE:/category/{id}
|
|
75
|
+
*/
|
|
76
|
+
deleteById = (id: string, params: RequestParams = {}) =>
|
|
77
|
+
this.request<void, any>({
|
|
78
|
+
path: `/category/${id}`,
|
|
79
|
+
method: 'DELETE',
|
|
80
|
+
...params,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/*
|
|
4
|
+
* ---------------------------------------------------------------
|
|
5
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
6
|
+
* ## ##
|
|
7
|
+
* ## AUTHOR: acacode ##
|
|
8
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
9
|
+
* ---------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { IComment } from '../types/data-contracts';
|
|
13
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
14
|
+
|
|
15
|
+
export class Comment<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Comment
|
|
20
|
+
* @name create
|
|
21
|
+
* @request POST:/comment
|
|
22
|
+
*/
|
|
23
|
+
create = (params: RequestParams = {}) =>
|
|
24
|
+
this.request<IComment[], any>({
|
|
25
|
+
path: `/comment`,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
format: 'json',
|
|
28
|
+
...params,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* No description
|
|
32
|
+
*
|
|
33
|
+
* @tags Comment
|
|
34
|
+
* @name findAll
|
|
35
|
+
* @request GET:/comment
|
|
36
|
+
*/
|
|
37
|
+
findAll = (params: RequestParams = {}) =>
|
|
38
|
+
this.request<void, any>({
|
|
39
|
+
path: `/comment`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
...params,
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* No description
|
|
45
|
+
*
|
|
46
|
+
* @tags Comment
|
|
47
|
+
* @name findById
|
|
48
|
+
* @request GET:/comment/{id}
|
|
49
|
+
*/
|
|
50
|
+
findById = (id: string, params: RequestParams = {}) =>
|
|
51
|
+
this.request<void, any>({
|
|
52
|
+
path: `/comment/${id}`,
|
|
53
|
+
method: 'GET',
|
|
54
|
+
...params,
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* No description
|
|
58
|
+
*
|
|
59
|
+
* @tags Comment
|
|
60
|
+
* @name updateById
|
|
61
|
+
* @request PATCH:/comment/{id}
|
|
62
|
+
*/
|
|
63
|
+
updateById = (id: string, params: RequestParams = {}) =>
|
|
64
|
+
this.request<void, any>({
|
|
65
|
+
path: `/comment/${id}`,
|
|
66
|
+
method: 'PATCH',
|
|
67
|
+
...params,
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* No description
|
|
71
|
+
*
|
|
72
|
+
* @tags Comment
|
|
73
|
+
* @name deleteById
|
|
74
|
+
* @request DELETE:/comment/{id}
|
|
75
|
+
*/
|
|
76
|
+
deleteById = (id: string, params: RequestParams = {}) =>
|
|
77
|
+
this.request<void, any>({
|
|
78
|
+
path: `/comment/${id}`,
|
|
79
|
+
method: 'DELETE',
|
|
80
|
+
...params,
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* No description
|
|
84
|
+
*
|
|
85
|
+
* @tags Comment
|
|
86
|
+
* @name CommentControllerGetArticleComments
|
|
87
|
+
* @request GET:/comment/host/{hostId}
|
|
88
|
+
*/
|
|
89
|
+
commentControllerGetArticleComments = (hostId: string, params: RequestParams = {}) =>
|
|
90
|
+
this.request<void, any>({
|
|
91
|
+
path: `/comment/host/${hostId}`,
|
|
92
|
+
method: 'GET',
|
|
93
|
+
...params,
|
|
94
|
+
});
|
|
95
|
+
}
|
package/src/api/File.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/*
|
|
4
|
+
* ---------------------------------------------------------------
|
|
5
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
6
|
+
* ## ##
|
|
7
|
+
* ## AUTHOR: acacode ##
|
|
8
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
9
|
+
* ---------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { IFile } from '../types/data-contracts';
|
|
13
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
14
|
+
|
|
15
|
+
export class File<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags File
|
|
20
|
+
* @name FileControllerUploadFile
|
|
21
|
+
* @request POST:/file/upload
|
|
22
|
+
*/
|
|
23
|
+
fileControllerUploadFile = (params: RequestParams = {}) =>
|
|
24
|
+
this.request<IFile[], any>({
|
|
25
|
+
path: `/file/upload`,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
format: 'json',
|
|
28
|
+
...params,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* No description
|
|
32
|
+
*
|
|
33
|
+
* @tags File
|
|
34
|
+
* @name findAll
|
|
35
|
+
* @request GET:/file
|
|
36
|
+
*/
|
|
37
|
+
findAll = (params: RequestParams = {}) =>
|
|
38
|
+
this.request<void, any>({
|
|
39
|
+
path: `/file`,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
...params,
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* No description
|
|
45
|
+
*
|
|
46
|
+
* @tags File
|
|
47
|
+
* @name findById
|
|
48
|
+
* @request GET:/file/{id}
|
|
49
|
+
*/
|
|
50
|
+
findById = (id: string, params: RequestParams = {}) =>
|
|
51
|
+
this.request<void, any>({
|
|
52
|
+
path: `/file/${id}`,
|
|
53
|
+
method: 'GET',
|
|
54
|
+
...params,
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* No description
|
|
58
|
+
*
|
|
59
|
+
* @tags File
|
|
60
|
+
* @name deleteById
|
|
61
|
+
* @request DELETE:/file/{id}
|
|
62
|
+
*/
|
|
63
|
+
deleteById = (id: string, params: RequestParams = {}) =>
|
|
64
|
+
this.request<void, any>({
|
|
65
|
+
path: `/file/${id}`,
|
|
66
|
+
method: 'DELETE',
|
|
67
|
+
...params,
|
|
68
|
+
});
|
|
69
|
+
}
|