@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2024] [fecommunity]
|
|
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/demos/simple.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/services/articleService.ts
|
|
2
|
+
import api, { types, utils } from '@/api';
|
|
3
|
+
|
|
4
|
+
// 文章服务层
|
|
5
|
+
export class ArticleService {
|
|
6
|
+
// 获取所有文章
|
|
7
|
+
static async getAllArticles() {
|
|
8
|
+
try {
|
|
9
|
+
const articles = await api.article.findAll();
|
|
10
|
+
|
|
11
|
+
// 格式化数据
|
|
12
|
+
return articles.map(article => ({
|
|
13
|
+
...article,
|
|
14
|
+
formattedDate: utils.formatDate(new Date(article.createdAt || Date.now())),
|
|
15
|
+
}));
|
|
16
|
+
} catch (error) {
|
|
17
|
+
throw this.handleError(error, '获取文章列表失败');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 获取单篇文章
|
|
22
|
+
static async getArticleById(id: string) {
|
|
23
|
+
try {
|
|
24
|
+
return await api.article.findById(id);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw this.handleError(error, '获取文章失败');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 创建文章
|
|
31
|
+
static async createArticle(articleData: Partial<types.IArticle>) {
|
|
32
|
+
try {
|
|
33
|
+
return await api.article.create(articleData);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw this.handleError(error, '创建文章失败');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 更新文章
|
|
40
|
+
static async updateArticle(id: string, updates: Partial<types.IArticle>) {
|
|
41
|
+
try {
|
|
42
|
+
return await api.article.updateById(id, updates);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
throw this.handleError(error, '更新文章失败');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 删除文章
|
|
49
|
+
static async deleteArticle(id: string) {
|
|
50
|
+
try {
|
|
51
|
+
return await api.article.deleteById(id);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw this.handleError(error, '删除文章失败');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 统一错误处理
|
|
58
|
+
private static handleError(error: unknown, defaultMessage: string) {
|
|
59
|
+
if (utils.ApiError.isInstance(error)) {
|
|
60
|
+
return error;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new utils.ApiError(500, defaultMessage, error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpClient, RequestParams } from './http-client';
|
|
2
|
+
export declare class Admin<SecurityDataType = unknown> {
|
|
3
|
+
http: HttpClient<SecurityDataType>;
|
|
4
|
+
constructor(http: HttpClient<SecurityDataType>);
|
|
5
|
+
/**
|
|
6
|
+
* No description
|
|
7
|
+
*
|
|
8
|
+
* @tags Auth
|
|
9
|
+
* @name AuthControllerCreateBook
|
|
10
|
+
* @request POST:/auth/admin
|
|
11
|
+
* @response `201` `void`
|
|
12
|
+
*/
|
|
13
|
+
authControllerCreateBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Admin = void 0;
|
|
14
|
+
class Admin {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Auth
|
|
20
|
+
* @name AuthControllerCreateBook
|
|
21
|
+
* @request POST:/auth/admin
|
|
22
|
+
* @response `201` `void`
|
|
23
|
+
*/
|
|
24
|
+
this.authControllerCreateBook = (params = {}) => this.http.request({
|
|
25
|
+
path: `/auth/admin`,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
...params,
|
|
28
|
+
});
|
|
29
|
+
this.http = http;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Admin = Admin;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpClient, RequestParams } from './http-client';
|
|
2
|
+
export declare class All<SecurityDataType = unknown> {
|
|
3
|
+
http: HttpClient<SecurityDataType>;
|
|
4
|
+
constructor(http: HttpClient<SecurityDataType>);
|
|
5
|
+
/**
|
|
6
|
+
* No description
|
|
7
|
+
*
|
|
8
|
+
* @tags Article
|
|
9
|
+
* @name ArticleControllerGetRecommendArticles
|
|
10
|
+
* @request GET:/article/all/recommend
|
|
11
|
+
* @response `200` `void`
|
|
12
|
+
*/
|
|
13
|
+
articleControllerGetRecommendArticles: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
14
|
+
}
|
package/dist/api/All.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.All = void 0;
|
|
14
|
+
class All {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Article
|
|
20
|
+
* @name ArticleControllerGetRecommendArticles
|
|
21
|
+
* @request GET:/article/all/recommend
|
|
22
|
+
* @response `200` `void`
|
|
23
|
+
*/
|
|
24
|
+
this.articleControllerGetRecommendArticles = (params = {}) => this.http.request({
|
|
25
|
+
path: `/article/all/recommend`,
|
|
26
|
+
method: 'GET',
|
|
27
|
+
...params,
|
|
28
|
+
});
|
|
29
|
+
this.http = http;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.All = All;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpClient, RequestParams } from './http-client';
|
|
2
|
+
export declare class Archives<SecurityDataType = unknown> {
|
|
3
|
+
http: HttpClient<SecurityDataType>;
|
|
4
|
+
constructor(http: HttpClient<SecurityDataType>);
|
|
5
|
+
/**
|
|
6
|
+
* No description
|
|
7
|
+
*
|
|
8
|
+
* @tags Article
|
|
9
|
+
* @name ArticleControllerGetArchives
|
|
10
|
+
* @request GET:/article/archives
|
|
11
|
+
* @response `200` `void`
|
|
12
|
+
*/
|
|
13
|
+
articleControllerGetArchives: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Archives = void 0;
|
|
14
|
+
class Archives {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Article
|
|
20
|
+
* @name ArticleControllerGetArchives
|
|
21
|
+
* @request GET:/article/archives
|
|
22
|
+
* @response `200` `void`
|
|
23
|
+
*/
|
|
24
|
+
this.articleControllerGetArchives = (params = {}) => this.http.request({
|
|
25
|
+
path: `/article/archives`,
|
|
26
|
+
method: 'GET',
|
|
27
|
+
...params,
|
|
28
|
+
});
|
|
29
|
+
this.http = http;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Archives = Archives;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { IArticle } from '../types/data-contracts';
|
|
2
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
3
|
+
export declare class Article<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
|
+
/**
|
|
5
|
+
* No description
|
|
6
|
+
*
|
|
7
|
+
* @tags Article
|
|
8
|
+
* @name create
|
|
9
|
+
* @request POST:/article
|
|
10
|
+
*/
|
|
11
|
+
create: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IArticle[], any, {}>>;
|
|
12
|
+
/**
|
|
13
|
+
* No description
|
|
14
|
+
*
|
|
15
|
+
* @tags Article
|
|
16
|
+
* @name findAll
|
|
17
|
+
* @request GET:/article
|
|
18
|
+
*/
|
|
19
|
+
findAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
20
|
+
/**
|
|
21
|
+
* No description
|
|
22
|
+
*
|
|
23
|
+
* @tags Article
|
|
24
|
+
* @name findByCategory
|
|
25
|
+
* @request GET:/article/category/{id}
|
|
26
|
+
*/
|
|
27
|
+
findByCategory: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
28
|
+
/**
|
|
29
|
+
* No description
|
|
30
|
+
*
|
|
31
|
+
* @tags Article
|
|
32
|
+
* @name findByTag
|
|
33
|
+
* @request GET:/article/tag/{id}
|
|
34
|
+
*/
|
|
35
|
+
findByTag: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
36
|
+
/**
|
|
37
|
+
* No description
|
|
38
|
+
*
|
|
39
|
+
* @tags Article
|
|
40
|
+
* @name getRecommendations
|
|
41
|
+
* @request GET:/article/all/recommend
|
|
42
|
+
*/
|
|
43
|
+
getRecommendations: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
44
|
+
/**
|
|
45
|
+
* No description
|
|
46
|
+
*
|
|
47
|
+
* @tags Article
|
|
48
|
+
* @name getArchives
|
|
49
|
+
* @request GET:/article/archives
|
|
50
|
+
*/
|
|
51
|
+
getArchives: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
52
|
+
/**
|
|
53
|
+
* No description
|
|
54
|
+
*
|
|
55
|
+
* @tags Article
|
|
56
|
+
* @name recommend
|
|
57
|
+
* @request GET:/article/recommend
|
|
58
|
+
*/
|
|
59
|
+
recommend: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
60
|
+
/**
|
|
61
|
+
* No description
|
|
62
|
+
*
|
|
63
|
+
* @tags Article
|
|
64
|
+
* @name findById
|
|
65
|
+
* @request GET:/article/{id}
|
|
66
|
+
*/
|
|
67
|
+
findById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
68
|
+
/**
|
|
69
|
+
* No description
|
|
70
|
+
*
|
|
71
|
+
* @tags Article
|
|
72
|
+
* @name updateById
|
|
73
|
+
* @request PATCH:/article/{id}
|
|
74
|
+
*/
|
|
75
|
+
updateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
76
|
+
/**
|
|
77
|
+
* No description
|
|
78
|
+
*
|
|
79
|
+
* @tags Article
|
|
80
|
+
* @name deleteById
|
|
81
|
+
* @request DELETE:/article/{id}
|
|
82
|
+
*/
|
|
83
|
+
deleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
84
|
+
/**
|
|
85
|
+
* No description
|
|
86
|
+
*
|
|
87
|
+
* @tags Article
|
|
88
|
+
* @name checkPassword
|
|
89
|
+
* @request POST:/article/{id}/checkPassword
|
|
90
|
+
*/
|
|
91
|
+
checkPassword: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
92
|
+
/**
|
|
93
|
+
* No description
|
|
94
|
+
*
|
|
95
|
+
* @tags Article
|
|
96
|
+
* @name updateViews
|
|
97
|
+
* @request POST:/article/{id}/views
|
|
98
|
+
*/
|
|
99
|
+
updateViews: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
100
|
+
/**
|
|
101
|
+
* No description
|
|
102
|
+
*
|
|
103
|
+
* @tags Article
|
|
104
|
+
* @name updateLikes
|
|
105
|
+
* @request POST:/article/{id}/likes
|
|
106
|
+
*/
|
|
107
|
+
updateLikes: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
108
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Article = void 0;
|
|
14
|
+
const httpClient_1 = require("./httpClient");
|
|
15
|
+
class Article extends httpClient_1.HttpClient {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
/**
|
|
19
|
+
* No description
|
|
20
|
+
*
|
|
21
|
+
* @tags Article
|
|
22
|
+
* @name create
|
|
23
|
+
* @request POST:/article
|
|
24
|
+
*/
|
|
25
|
+
this.create = (params = {}) => this.request({
|
|
26
|
+
path: `/article`,
|
|
27
|
+
method: 'POST',
|
|
28
|
+
format: 'json',
|
|
29
|
+
...params,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* No description
|
|
33
|
+
*
|
|
34
|
+
* @tags Article
|
|
35
|
+
* @name findAll
|
|
36
|
+
* @request GET:/article
|
|
37
|
+
*/
|
|
38
|
+
this.findAll = (params = {}) => this.request({
|
|
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
|
+
this.findByCategory = (id, params = {}) => this.request({
|
|
51
|
+
path: `/article/category/${id}`,
|
|
52
|
+
method: 'GET',
|
|
53
|
+
...params,
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* No description
|
|
57
|
+
*
|
|
58
|
+
* @tags Article
|
|
59
|
+
* @name findByTag
|
|
60
|
+
* @request GET:/article/tag/{id}
|
|
61
|
+
*/
|
|
62
|
+
this.findByTag = (id, params = {}) => this.request({
|
|
63
|
+
path: `/article/tag/${id}`,
|
|
64
|
+
method: 'GET',
|
|
65
|
+
...params,
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* No description
|
|
69
|
+
*
|
|
70
|
+
* @tags Article
|
|
71
|
+
* @name getRecommendations
|
|
72
|
+
* @request GET:/article/all/recommend
|
|
73
|
+
*/
|
|
74
|
+
this.getRecommendations = (params = {}) => this.request({
|
|
75
|
+
path: `/article/all/recommend`,
|
|
76
|
+
method: 'GET',
|
|
77
|
+
...params,
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* No description
|
|
81
|
+
*
|
|
82
|
+
* @tags Article
|
|
83
|
+
* @name getArchives
|
|
84
|
+
* @request GET:/article/archives
|
|
85
|
+
*/
|
|
86
|
+
this.getArchives = (params = {}) => this.request({
|
|
87
|
+
path: `/article/archives`,
|
|
88
|
+
method: 'GET',
|
|
89
|
+
...params,
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* No description
|
|
93
|
+
*
|
|
94
|
+
* @tags Article
|
|
95
|
+
* @name recommend
|
|
96
|
+
* @request GET:/article/recommend
|
|
97
|
+
*/
|
|
98
|
+
this.recommend = (params = {}) => this.request({
|
|
99
|
+
path: `/article/recommend`,
|
|
100
|
+
method: 'GET',
|
|
101
|
+
...params,
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* No description
|
|
105
|
+
*
|
|
106
|
+
* @tags Article
|
|
107
|
+
* @name findById
|
|
108
|
+
* @request GET:/article/{id}
|
|
109
|
+
*/
|
|
110
|
+
this.findById = (id, params = {}) => this.request({
|
|
111
|
+
path: `/article/${id}`,
|
|
112
|
+
method: 'GET',
|
|
113
|
+
...params,
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* No description
|
|
117
|
+
*
|
|
118
|
+
* @tags Article
|
|
119
|
+
* @name updateById
|
|
120
|
+
* @request PATCH:/article/{id}
|
|
121
|
+
*/
|
|
122
|
+
this.updateById = (id, params = {}) => this.request({
|
|
123
|
+
path: `/article/${id}`,
|
|
124
|
+
method: 'PATCH',
|
|
125
|
+
...params,
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* No description
|
|
129
|
+
*
|
|
130
|
+
* @tags Article
|
|
131
|
+
* @name deleteById
|
|
132
|
+
* @request DELETE:/article/{id}
|
|
133
|
+
*/
|
|
134
|
+
this.deleteById = (id, params = {}) => this.request({
|
|
135
|
+
path: `/article/${id}`,
|
|
136
|
+
method: 'DELETE',
|
|
137
|
+
...params,
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* No description
|
|
141
|
+
*
|
|
142
|
+
* @tags Article
|
|
143
|
+
* @name checkPassword
|
|
144
|
+
* @request POST:/article/{id}/checkPassword
|
|
145
|
+
*/
|
|
146
|
+
this.checkPassword = (id, params = {}) => this.request({
|
|
147
|
+
path: `/article/${id}/checkPassword`,
|
|
148
|
+
method: 'POST',
|
|
149
|
+
...params,
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* No description
|
|
153
|
+
*
|
|
154
|
+
* @tags Article
|
|
155
|
+
* @name updateViews
|
|
156
|
+
* @request POST:/article/{id}/views
|
|
157
|
+
*/
|
|
158
|
+
this.updateViews = (id, params = {}) => this.request({
|
|
159
|
+
path: `/article/${id}/views`,
|
|
160
|
+
method: 'POST',
|
|
161
|
+
...params,
|
|
162
|
+
});
|
|
163
|
+
/**
|
|
164
|
+
* No description
|
|
165
|
+
*
|
|
166
|
+
* @tags Article
|
|
167
|
+
* @name updateLikes
|
|
168
|
+
* @request POST:/article/{id}/likes
|
|
169
|
+
*/
|
|
170
|
+
this.updateLikes = (id, params = {}) => this.request({
|
|
171
|
+
path: `/article/${id}/likes`,
|
|
172
|
+
method: 'POST',
|
|
173
|
+
...params,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.Article = Article;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HttpClient, RequestParams } from './httpClient';
|
|
2
|
+
export declare class Auth<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
3
|
+
/**
|
|
4
|
+
* No description
|
|
5
|
+
*
|
|
6
|
+
* @tags Auth
|
|
7
|
+
* @name AuthControllerLogin
|
|
8
|
+
* @request POST:/auth/login
|
|
9
|
+
*/
|
|
10
|
+
authControllerLogin: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
11
|
+
/**
|
|
12
|
+
* No description
|
|
13
|
+
*
|
|
14
|
+
* @tags Auth
|
|
15
|
+
* @name createBook
|
|
16
|
+
* @request POST:/auth/admin
|
|
17
|
+
*/
|
|
18
|
+
createBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
19
|
+
/**
|
|
20
|
+
* No description
|
|
21
|
+
*
|
|
22
|
+
* @tags Auth
|
|
23
|
+
* @name AuthControllerLoginWithGithub
|
|
24
|
+
* @request POST:/auth/github
|
|
25
|
+
*/
|
|
26
|
+
authControllerLoginWithGithub: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
|
|
27
|
+
}
|
package/dist/api/Auth.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Auth = void 0;
|
|
14
|
+
const httpClient_1 = require("./httpClient");
|
|
15
|
+
class Auth extends httpClient_1.HttpClient {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
/**
|
|
19
|
+
* No description
|
|
20
|
+
*
|
|
21
|
+
* @tags Auth
|
|
22
|
+
* @name AuthControllerLogin
|
|
23
|
+
* @request POST:/auth/login
|
|
24
|
+
*/
|
|
25
|
+
this.authControllerLogin = (params = {}) => this.request({
|
|
26
|
+
path: `/auth/login`,
|
|
27
|
+
method: 'POST',
|
|
28
|
+
...params,
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* No description
|
|
32
|
+
*
|
|
33
|
+
* @tags Auth
|
|
34
|
+
* @name createBook
|
|
35
|
+
* @request POST:/auth/admin
|
|
36
|
+
*/
|
|
37
|
+
this.createBook = (params = {}) => this.request({
|
|
38
|
+
path: `/auth/admin`,
|
|
39
|
+
method: 'POST',
|
|
40
|
+
...params,
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* No description
|
|
44
|
+
*
|
|
45
|
+
* @tags Auth
|
|
46
|
+
* @name AuthControllerLoginWithGithub
|
|
47
|
+
* @request POST:/auth/github
|
|
48
|
+
*/
|
|
49
|
+
this.authControllerLoginWithGithub = (params = {}) => this.request({
|
|
50
|
+
path: `/auth/github`,
|
|
51
|
+
method: 'POST',
|
|
52
|
+
...params,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Auth = Auth;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IKnowledge } from '../types/data-contracts';
|
|
2
|
+
import { HttpClient, RequestParams } from './http-client';
|
|
3
|
+
export declare class Book<SecurityDataType = unknown> {
|
|
4
|
+
http: HttpClient<SecurityDataType>;
|
|
5
|
+
constructor(http: HttpClient<SecurityDataType>);
|
|
6
|
+
/**
|
|
7
|
+
* No description
|
|
8
|
+
*
|
|
9
|
+
* @tags Knowledge
|
|
10
|
+
* @name KnowledgeControllerCreateBook
|
|
11
|
+
* @request POST:/Knowledge/book
|
|
12
|
+
* @response `200` `(IKnowledge)[]` 创建知识库
|
|
13
|
+
*/
|
|
14
|
+
knowledgeControllerCreateBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IKnowledge[], any, {}>>;
|
|
15
|
+
}
|
package/dist/api/Book.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Book = void 0;
|
|
14
|
+
class Book {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
/**
|
|
17
|
+
* No description
|
|
18
|
+
*
|
|
19
|
+
* @tags Knowledge
|
|
20
|
+
* @name KnowledgeControllerCreateBook
|
|
21
|
+
* @request POST:/Knowledge/book
|
|
22
|
+
* @response `200` `(IKnowledge)[]` 创建知识库
|
|
23
|
+
*/
|
|
24
|
+
this.knowledgeControllerCreateBook = (params = {}) => this.http.request({
|
|
25
|
+
path: `/Knowledge/book`,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
format: 'json',
|
|
28
|
+
...params,
|
|
29
|
+
});
|
|
30
|
+
this.http = http;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Book = Book;
|