@fecommunity/reactpress-toolkit 1.0.0-beta.2 → 1.0.0-beta.4

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 (150) hide show
  1. package/README.md +222 -25
  2. package/dist/api/Article.d.ts +43 -28
  3. package/dist/api/Article.js +42 -31
  4. package/dist/api/Auth.d.ts +12 -7
  5. package/dist/api/Auth.js +12 -10
  6. package/dist/api/Category.d.ts +19 -12
  7. package/dist/api/Category.js +18 -15
  8. package/dist/api/Comment.d.ts +22 -14
  9. package/dist/api/Comment.js +21 -17
  10. package/dist/api/File.d.ts +16 -10
  11. package/dist/api/File.js +15 -13
  12. package/dist/{HttpClient.d.ts → api/HttpClient.d.ts} +2 -2
  13. package/dist/{HttpClient.js → api/HttpClient.js} +4 -2
  14. package/dist/api/Knowledge.d.ts +28 -18
  15. package/dist/api/Knowledge.js +27 -22
  16. package/dist/api/Page.d.ts +22 -14
  17. package/dist/api/Page.js +21 -17
  18. package/dist/api/Search.d.ts +12 -7
  19. package/dist/api/Search.js +12 -10
  20. package/dist/api/Setting.d.ts +10 -6
  21. package/dist/api/Setting.js +9 -9
  22. package/dist/api/Smtp.d.ts +13 -8
  23. package/dist/api/Smtp.js +12 -11
  24. package/dist/api/Tag.d.ts +22 -14
  25. package/dist/api/Tag.js +21 -17
  26. package/dist/api/User.d.ts +17 -10
  27. package/dist/api/User.js +16 -16
  28. package/dist/api/View.d.ts +19 -12
  29. package/dist/api/View.js +18 -15
  30. package/dist/api/index.d.ts +13 -18
  31. package/dist/api/index.js +28 -40
  32. package/dist/api/instance.d.ts +47 -0
  33. package/dist/api/instance.js +71 -0
  34. package/dist/config/env.d.ts +1 -0
  35. package/dist/config/env.js +89 -0
  36. package/dist/config/global.d.ts +34 -0
  37. package/dist/config/global.js +382 -0
  38. package/dist/config/i18n.d.ts +4 -0
  39. package/dist/config/i18n.js +43 -0
  40. package/dist/config/index.d.ts +15 -0
  41. package/dist/config/index.js +25 -0
  42. package/dist/index.d.ts +11 -5
  43. package/dist/index.js +18 -25
  44. package/dist/locales/en.json +97 -0
  45. package/dist/locales/zh.json +97 -0
  46. package/dist/types/index.d.ts +245 -1
  47. package/dist/types/index.js +10 -17
  48. package/dist/utils/index.d.ts +33 -2
  49. package/dist/utils/index.js +57 -18
  50. package/package.json +20 -5
  51. package/dist/Article.d.ts +0 -121
  52. package/dist/Article.js +0 -189
  53. package/dist/Auth.d.ts +0 -30
  54. package/dist/Auth.js +0 -59
  55. package/dist/Category.d.ts +0 -49
  56. package/dist/Category.js +0 -85
  57. package/dist/Comment.d.ts +0 -58
  58. package/dist/Comment.js +0 -98
  59. package/dist/File.d.ts +0 -40
  60. package/dist/File.js +0 -72
  61. package/dist/Knowledge.d.ts +0 -76
  62. package/dist/Knowledge.js +0 -124
  63. package/dist/Page.d.ts +0 -58
  64. package/dist/Page.js +0 -98
  65. package/dist/Search.d.ts +0 -30
  66. package/dist/Search.js +0 -59
  67. package/dist/Setting.d.ts +0 -22
  68. package/dist/Setting.js +0 -46
  69. package/dist/Smtp.d.ts +0 -31
  70. package/dist/Smtp.js +0 -59
  71. package/dist/Tag.d.ts +0 -58
  72. package/dist/Tag.js +0 -98
  73. package/dist/User.d.ts +0 -41
  74. package/dist/User.js +0 -73
  75. package/dist/View.d.ts +0 -49
  76. package/dist/View.js +0 -85
  77. package/dist/api/Admin.d.ts +0 -14
  78. package/dist/api/Admin.js +0 -32
  79. package/dist/api/All.d.ts +0 -14
  80. package/dist/api/All.js +0 -32
  81. package/dist/api/ApiInstance.d.ts +0 -39
  82. package/dist/api/ApiInstance.js +0 -46
  83. package/dist/api/Archives.d.ts +0 -14
  84. package/dist/api/Archives.js +0 -32
  85. package/dist/api/ArticleRoute.d.ts +0 -201
  86. package/dist/api/ArticleRoute.js +0 -12
  87. package/dist/api/AuthRoute.d.ts +0 -44
  88. package/dist/api/AuthRoute.js +0 -12
  89. package/dist/api/Book.d.ts +0 -15
  90. package/dist/api/Book.js +0 -33
  91. package/dist/api/CategoryRoute.d.ts +0 -79
  92. package/dist/api/CategoryRoute.js +0 -12
  93. package/dist/api/Chapter.d.ts +0 -15
  94. package/dist/api/Chapter.js +0 -33
  95. package/dist/api/CommentRoute.d.ts +0 -95
  96. package/dist/api/CommentRoute.js +0 -12
  97. package/dist/api/FileRoute.d.ts +0 -63
  98. package/dist/api/FileRoute.js +0 -12
  99. package/dist/api/Get.d.ts +0 -14
  100. package/dist/api/Get.js +0 -32
  101. package/dist/api/Github.d.ts +0 -14
  102. package/dist/api/Github.js +0 -32
  103. package/dist/api/Host.d.ts +0 -14
  104. package/dist/api/Host.js +0 -32
  105. package/dist/api/Id.d.ts +0 -284
  106. package/dist/api/Id.js +0 -422
  107. package/dist/api/KnowledgeRoute.d.ts +0 -125
  108. package/dist/api/KnowledgeRoute.js +0 -12
  109. package/dist/api/Login.d.ts +0 -14
  110. package/dist/api/Login.js +0 -32
  111. package/dist/api/PageRoute.d.ts +0 -95
  112. package/dist/api/PageRoute.js +0 -12
  113. package/dist/api/Password.d.ts +0 -15
  114. package/dist/api/Password.js +0 -33
  115. package/dist/api/Recommend.d.ts +0 -14
  116. package/dist/api/Recommend.js +0 -32
  117. package/dist/api/Register.d.ts +0 -15
  118. package/dist/api/Register.js +0 -33
  119. package/dist/api/SearchRoute.d.ts +0 -46
  120. package/dist/api/SearchRoute.js +0 -12
  121. package/dist/api/SettingRoute.d.ts +0 -31
  122. package/dist/api/SettingRoute.js +0 -12
  123. package/dist/api/SmtpRoute.d.ts +0 -47
  124. package/dist/api/SmtpRoute.js +0 -12
  125. package/dist/api/TagRoute.d.ts +0 -95
  126. package/dist/api/TagRoute.js +0 -12
  127. package/dist/api/Update.d.ts +0 -15
  128. package/dist/api/Update.js +0 -33
  129. package/dist/api/Upload.d.ts +0 -15
  130. package/dist/api/Upload.js +0 -33
  131. package/dist/api/Url.d.ts +0 -14
  132. package/dist/api/Url.js +0 -32
  133. package/dist/api/UserRoute.d.ts +0 -60
  134. package/dist/api/UserRoute.js +0 -12
  135. package/dist/api/ViewRoute.d.ts +0 -77
  136. package/dist/api/ViewRoute.js +0 -12
  137. package/dist/api/api-instance.d.ts +0 -39
  138. package/dist/api/api-instance.js +0 -46
  139. package/dist/api/http-client.d.ts +0 -41
  140. package/dist/api/http-client.js +0 -94
  141. package/dist/api/httpClient.d.ts +0 -42
  142. package/dist/api/httpClient.js +0 -95
  143. package/dist/data-contracts.d.ts +0 -245
  144. package/dist/data-contracts.js +0 -12
  145. package/dist/types/data-contracts.d.ts +0 -177
  146. package/dist/types/data-contracts.js +0 -12
  147. package/dist/utils/common.d.ts +0 -21
  148. package/dist/utils/common.js +0 -52
  149. package/dist/utils/http.d.ts +0 -3
  150. package/dist/utils/http.js +0 -45
package/dist/api/Auth.js CHANGED
@@ -11,18 +11,17 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.Auth = void 0;
14
- const HttpClient_1 = require("./HttpClient");
15
- class Auth extends HttpClient_1.HttpClient {
16
- constructor() {
17
- super(...arguments);
14
+ class Auth {
15
+ constructor(http) {
18
16
  /**
19
17
  * No description
20
18
  *
21
19
  * @tags Auth
22
- * @name login
20
+ * @name AuthControllerLogin
23
21
  * @request POST:/auth/login
22
+ * @response `200` `IAuthControllerLoginData`
24
23
  */
25
- this.login = (params = {}) => this.request({
24
+ this.login = (params = {}) => this.http.request({
26
25
  path: `/auth/login`,
27
26
  method: 'POST',
28
27
  ...params,
@@ -31,10 +30,11 @@ class Auth extends HttpClient_1.HttpClient {
31
30
  * No description
32
31
  *
33
32
  * @tags Auth
34
- * @name createBook
33
+ * @name AuthControllerCreateBook
35
34
  * @request POST:/auth/admin
35
+ * @response `201` `IAuthControllerCreateBookData`
36
36
  */
37
- this.createBook = (params = {}) => this.request({
37
+ this.createBook = (params = {}) => this.http.request({
38
38
  path: `/auth/admin`,
39
39
  method: 'POST',
40
40
  ...params,
@@ -43,14 +43,16 @@ class Auth extends HttpClient_1.HttpClient {
43
43
  * No description
44
44
  *
45
45
  * @tags Auth
46
- * @name loginWithGithub
46
+ * @name AuthControllerLoginWithGithub
47
47
  * @request POST:/auth/github
48
+ * @response `201` `IAuthControllerLoginWithGithubData`
48
49
  */
49
- this.loginWithGithub = (params = {}) => this.request({
50
+ this.loginWithGithub = (params = {}) => this.http.request({
50
51
  path: `/auth/github`,
51
52
  method: 'POST',
52
53
  ...params,
53
54
  });
55
+ this.http = http;
54
56
  }
55
57
  }
56
58
  exports.Auth = Auth;
@@ -1,44 +1,51 @@
1
- import { ICategory } from '../types/data-contracts';
1
+ import { ICategoryControllerCreateData } from '../types';
2
2
  import { HttpClient, RequestParams } from './HttpClient';
3
- export declare class Category<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
3
+ export declare class Category<SecurityDataType = unknown> {
4
+ http: HttpClient<SecurityDataType>;
5
+ constructor(http: HttpClient<SecurityDataType>);
4
6
  /**
5
7
  * No description
6
8
  *
7
9
  * @tags Category
8
- * @name create
10
+ * @name CategoryControllerCreate
9
11
  * @request POST:/category
12
+ * @response `200` `ICategoryControllerCreateData` 添加分类
10
13
  */
11
- create: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ICategory[], any, {}>>;
14
+ create: (params?: RequestParams) => Promise<ICategoryControllerCreateData>;
12
15
  /**
13
16
  * No description
14
17
  *
15
18
  * @tags Category
16
- * @name findAll
19
+ * @name CategoryControllerFindAll
17
20
  * @request GET:/category
21
+ * @response `200` `ICategoryControllerFindAllData`
18
22
  */
19
- findAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
23
+ findAll: (params?: RequestParams) => Promise<any>;
20
24
  /**
21
25
  * No description
22
26
  *
23
27
  * @tags Category
24
- * @name findById
28
+ * @name CategoryControllerFindById
25
29
  * @request GET:/category/{id}
30
+ * @response `200` `ICategoryControllerFindByIdData`
26
31
  */
27
- findById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
32
+ findById: (id: string, params?: RequestParams) => Promise<any>;
28
33
  /**
29
34
  * No description
30
35
  *
31
36
  * @tags Category
32
- * @name updateById
37
+ * @name CategoryControllerUpdateById
33
38
  * @request PATCH:/category/{id}
39
+ * @response `200` `ICategoryControllerUpdateByIdData`
34
40
  */
35
- updateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
41
+ updateById: (id: string, params?: RequestParams) => Promise<any>;
36
42
  /**
37
43
  * No description
38
44
  *
39
45
  * @tags Category
40
- * @name deleteById
46
+ * @name CategoryControllerDeleteById
41
47
  * @request DELETE:/category/{id}
48
+ * @response `200` `ICategoryControllerDeleteByIdData`
42
49
  */
43
- deleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
50
+ deleteById: (id: string, params?: RequestParams) => Promise<any>;
44
51
  }
@@ -11,31 +11,30 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.Category = void 0;
14
- const HttpClient_1 = require("./HttpClient");
15
- class Category extends HttpClient_1.HttpClient {
16
- constructor() {
17
- super(...arguments);
14
+ class Category {
15
+ constructor(http) {
18
16
  /**
19
17
  * No description
20
18
  *
21
19
  * @tags Category
22
- * @name create
20
+ * @name CategoryControllerCreate
23
21
  * @request POST:/category
22
+ * @response `200` `ICategoryControllerCreateData` 添加分类
24
23
  */
25
- this.create = (params = {}) => this.request({
24
+ this.create = (params = {}) => this.http.request({
26
25
  path: `/category`,
27
26
  method: 'POST',
28
- format: 'json',
29
27
  ...params,
30
28
  });
31
29
  /**
32
30
  * No description
33
31
  *
34
32
  * @tags Category
35
- * @name findAll
33
+ * @name CategoryControllerFindAll
36
34
  * @request GET:/category
35
+ * @response `200` `ICategoryControllerFindAllData`
37
36
  */
38
- this.findAll = (params = {}) => this.request({
37
+ this.findAll = (params = {}) => this.http.request({
39
38
  path: `/category`,
40
39
  method: 'GET',
41
40
  ...params,
@@ -44,10 +43,11 @@ class Category extends HttpClient_1.HttpClient {
44
43
  * No description
45
44
  *
46
45
  * @tags Category
47
- * @name findById
46
+ * @name CategoryControllerFindById
48
47
  * @request GET:/category/{id}
48
+ * @response `200` `ICategoryControllerFindByIdData`
49
49
  */
50
- this.findById = (id, params = {}) => this.request({
50
+ this.findById = (id, params = {}) => this.http.request({
51
51
  path: `/category/${id}`,
52
52
  method: 'GET',
53
53
  ...params,
@@ -56,10 +56,11 @@ class Category extends HttpClient_1.HttpClient {
56
56
  * No description
57
57
  *
58
58
  * @tags Category
59
- * @name updateById
59
+ * @name CategoryControllerUpdateById
60
60
  * @request PATCH:/category/{id}
61
+ * @response `200` `ICategoryControllerUpdateByIdData`
61
62
  */
62
- this.updateById = (id, params = {}) => this.request({
63
+ this.updateById = (id, params = {}) => this.http.request({
63
64
  path: `/category/${id}`,
64
65
  method: 'PATCH',
65
66
  ...params,
@@ -68,14 +69,16 @@ class Category extends HttpClient_1.HttpClient {
68
69
  * No description
69
70
  *
70
71
  * @tags Category
71
- * @name deleteById
72
+ * @name CategoryControllerDeleteById
72
73
  * @request DELETE:/category/{id}
74
+ * @response `200` `ICategoryControllerDeleteByIdData`
73
75
  */
74
- this.deleteById = (id, params = {}) => this.request({
76
+ this.deleteById = (id, params = {}) => this.http.request({
75
77
  path: `/category/${id}`,
76
78
  method: 'DELETE',
77
79
  ...params,
78
80
  });
81
+ this.http = http;
79
82
  }
80
83
  }
81
84
  exports.Category = Category;
@@ -1,52 +1,60 @@
1
- import { IComment } from '../types/data-contracts';
1
+ import { ICommentControllerCreateData } from '../types';
2
2
  import { HttpClient, RequestParams } from './HttpClient';
3
- export declare class Comment<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
3
+ export declare class Comment<SecurityDataType = unknown> {
4
+ http: HttpClient<SecurityDataType>;
5
+ constructor(http: HttpClient<SecurityDataType>);
4
6
  /**
5
7
  * No description
6
8
  *
7
9
  * @tags Comment
8
- * @name create
10
+ * @name CommentControllerCreate
9
11
  * @request POST:/comment
12
+ * @response `200` `ICommentControllerCreateData` 创建评论
10
13
  */
11
- create: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IComment[], any, {}>>;
14
+ create: (params?: RequestParams) => Promise<ICommentControllerCreateData>;
12
15
  /**
13
16
  * No description
14
17
  *
15
18
  * @tags Comment
16
- * @name findAll
19
+ * @name CommentControllerFindAll
17
20
  * @request GET:/comment
21
+ * @response `200` `ICommentControllerFindAllData`
18
22
  */
19
- findAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
23
+ findAll: (params?: RequestParams) => Promise<any>;
20
24
  /**
21
25
  * No description
22
26
  *
23
27
  * @tags Comment
24
- * @name findById
28
+ * @name CommentControllerFindById
25
29
  * @request GET:/comment/{id}
30
+ * @response `200` `ICommentControllerFindByIdData`
26
31
  */
27
- findById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
32
+ findById: (id: string, params?: RequestParams) => Promise<any>;
28
33
  /**
29
34
  * No description
30
35
  *
31
36
  * @tags Comment
32
- * @name updateById
37
+ * @name CommentControllerUpdateById
33
38
  * @request PATCH:/comment/{id}
39
+ * @response `200` `ICommentControllerUpdateByIdData`
34
40
  */
35
- updateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
41
+ updateById: (id: string, params?: RequestParams) => Promise<any>;
36
42
  /**
37
43
  * No description
38
44
  *
39
45
  * @tags Comment
40
- * @name deleteById
46
+ * @name CommentControllerDeleteById
41
47
  * @request DELETE:/comment/{id}
48
+ * @response `200` `ICommentControllerDeleteByIdData`
42
49
  */
43
- deleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
50
+ deleteById: (id: string, params?: RequestParams) => Promise<any>;
44
51
  /**
45
52
  * No description
46
53
  *
47
54
  * @tags Comment
48
- * @name getArticleComments
55
+ * @name CommentControllerGetArticleComments
49
56
  * @request GET:/comment/host/{hostId}
57
+ * @response `200` `ICommentControllerGetArticleCommentsData`
50
58
  */
51
- getArticleComments: (hostId: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
59
+ getArticleComments: (hostId: string, params?: RequestParams) => Promise<any>;
52
60
  }
@@ -11,31 +11,30 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.Comment = void 0;
14
- const HttpClient_1 = require("./HttpClient");
15
- class Comment extends HttpClient_1.HttpClient {
16
- constructor() {
17
- super(...arguments);
14
+ class Comment {
15
+ constructor(http) {
18
16
  /**
19
17
  * No description
20
18
  *
21
19
  * @tags Comment
22
- * @name create
20
+ * @name CommentControllerCreate
23
21
  * @request POST:/comment
22
+ * @response `200` `ICommentControllerCreateData` 创建评论
24
23
  */
25
- this.create = (params = {}) => this.request({
24
+ this.create = (params = {}) => this.http.request({
26
25
  path: `/comment`,
27
26
  method: 'POST',
28
- format: 'json',
29
27
  ...params,
30
28
  });
31
29
  /**
32
30
  * No description
33
31
  *
34
32
  * @tags Comment
35
- * @name findAll
33
+ * @name CommentControllerFindAll
36
34
  * @request GET:/comment
35
+ * @response `200` `ICommentControllerFindAllData`
37
36
  */
38
- this.findAll = (params = {}) => this.request({
37
+ this.findAll = (params = {}) => this.http.request({
39
38
  path: `/comment`,
40
39
  method: 'GET',
41
40
  ...params,
@@ -44,10 +43,11 @@ class Comment extends HttpClient_1.HttpClient {
44
43
  * No description
45
44
  *
46
45
  * @tags Comment
47
- * @name findById
46
+ * @name CommentControllerFindById
48
47
  * @request GET:/comment/{id}
48
+ * @response `200` `ICommentControllerFindByIdData`
49
49
  */
50
- this.findById = (id, params = {}) => this.request({
50
+ this.findById = (id, params = {}) => this.http.request({
51
51
  path: `/comment/${id}`,
52
52
  method: 'GET',
53
53
  ...params,
@@ -56,10 +56,11 @@ class Comment extends HttpClient_1.HttpClient {
56
56
  * No description
57
57
  *
58
58
  * @tags Comment
59
- * @name updateById
59
+ * @name CommentControllerUpdateById
60
60
  * @request PATCH:/comment/{id}
61
+ * @response `200` `ICommentControllerUpdateByIdData`
61
62
  */
62
- this.updateById = (id, params = {}) => this.request({
63
+ this.updateById = (id, params = {}) => this.http.request({
63
64
  path: `/comment/${id}`,
64
65
  method: 'PATCH',
65
66
  ...params,
@@ -68,10 +69,11 @@ class Comment extends HttpClient_1.HttpClient {
68
69
  * No description
69
70
  *
70
71
  * @tags Comment
71
- * @name deleteById
72
+ * @name CommentControllerDeleteById
72
73
  * @request DELETE:/comment/{id}
74
+ * @response `200` `ICommentControllerDeleteByIdData`
73
75
  */
74
- this.deleteById = (id, params = {}) => this.request({
76
+ this.deleteById = (id, params = {}) => this.http.request({
75
77
  path: `/comment/${id}`,
76
78
  method: 'DELETE',
77
79
  ...params,
@@ -80,14 +82,16 @@ class Comment extends HttpClient_1.HttpClient {
80
82
  * No description
81
83
  *
82
84
  * @tags Comment
83
- * @name getArticleComments
85
+ * @name CommentControllerGetArticleComments
84
86
  * @request GET:/comment/host/{hostId}
87
+ * @response `200` `ICommentControllerGetArticleCommentsData`
85
88
  */
86
- this.getArticleComments = (hostId, params = {}) => this.request({
89
+ this.getArticleComments = (hostId, params = {}) => this.http.request({
87
90
  path: `/comment/host/${hostId}`,
88
91
  method: 'GET',
89
92
  ...params,
90
93
  });
94
+ this.http = http;
91
95
  }
92
96
  }
93
97
  exports.Comment = Comment;
@@ -1,36 +1,42 @@
1
- import { IFile } from '../types/data-contracts';
1
+ import { IFileControllerUploadFileData } from '../types';
2
2
  import { HttpClient, RequestParams } from './HttpClient';
3
- export declare class File<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
3
+ export declare class File<SecurityDataType = unknown> {
4
+ http: HttpClient<SecurityDataType>;
5
+ constructor(http: HttpClient<SecurityDataType>);
4
6
  /**
5
7
  * No description
6
8
  *
7
9
  * @tags File
8
- * @name uploadFile
10
+ * @name FileControllerUploadFile
9
11
  * @request POST:/file/upload
12
+ * @response `200` `IFileControllerUploadFileData` 上传文件
10
13
  */
11
- uploadFile: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IFile[], any, {}>>;
14
+ uploadFile: (params?: RequestParams) => Promise<IFileControllerUploadFileData>;
12
15
  /**
13
16
  * No description
14
17
  *
15
18
  * @tags File
16
- * @name findAll
19
+ * @name FileControllerFindAll
17
20
  * @request GET:/file
21
+ * @response `200` `IFileControllerFindAllData`
18
22
  */
19
- findAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
23
+ findAll: (params?: RequestParams) => Promise<any>;
20
24
  /**
21
25
  * No description
22
26
  *
23
27
  * @tags File
24
- * @name findById
28
+ * @name FileControllerFindById
25
29
  * @request GET:/file/{id}
30
+ * @response `200` `IFileControllerFindByIdData`
26
31
  */
27
- findById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
32
+ findById: (id: string, params?: RequestParams) => Promise<any>;
28
33
  /**
29
34
  * No description
30
35
  *
31
36
  * @tags File
32
- * @name deleteById
37
+ * @name FileControllerDeleteById
33
38
  * @request DELETE:/file/{id}
39
+ * @response `200` `IFileControllerDeleteByIdData`
34
40
  */
35
- deleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
41
+ deleteById: (id: string, params?: RequestParams) => Promise<any>;
36
42
  }
package/dist/api/File.js CHANGED
@@ -11,31 +11,30 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.File = void 0;
14
- const HttpClient_1 = require("./HttpClient");
15
- class File extends HttpClient_1.HttpClient {
16
- constructor() {
17
- super(...arguments);
14
+ class File {
15
+ constructor(http) {
18
16
  /**
19
17
  * No description
20
18
  *
21
19
  * @tags File
22
- * @name uploadFile
20
+ * @name FileControllerUploadFile
23
21
  * @request POST:/file/upload
22
+ * @response `200` `IFileControllerUploadFileData` 上传文件
24
23
  */
25
- this.uploadFile = (params = {}) => this.request({
24
+ this.uploadFile = (params = {}) => this.http.request({
26
25
  path: `/file/upload`,
27
26
  method: 'POST',
28
- format: 'json',
29
27
  ...params,
30
28
  });
31
29
  /**
32
30
  * No description
33
31
  *
34
32
  * @tags File
35
- * @name findAll
33
+ * @name FileControllerFindAll
36
34
  * @request GET:/file
35
+ * @response `200` `IFileControllerFindAllData`
37
36
  */
38
- this.findAll = (params = {}) => this.request({
37
+ this.findAll = (params = {}) => this.http.request({
39
38
  path: `/file`,
40
39
  method: 'GET',
41
40
  ...params,
@@ -44,10 +43,11 @@ class File extends HttpClient_1.HttpClient {
44
43
  * No description
45
44
  *
46
45
  * @tags File
47
- * @name findById
46
+ * @name FileControllerFindById
48
47
  * @request GET:/file/{id}
48
+ * @response `200` `IFileControllerFindByIdData`
49
49
  */
50
- this.findById = (id, params = {}) => this.request({
50
+ this.findById = (id, params = {}) => this.http.request({
51
51
  path: `/file/${id}`,
52
52
  method: 'GET',
53
53
  ...params,
@@ -56,14 +56,16 @@ class File extends HttpClient_1.HttpClient {
56
56
  * No description
57
57
  *
58
58
  * @tags File
59
- * @name deleteById
59
+ * @name FileControllerDeleteById
60
60
  * @request DELETE:/file/{id}
61
+ * @response `200` `IFileControllerDeleteByIdData`
61
62
  */
62
- this.deleteById = (id, params = {}) => this.request({
63
+ this.deleteById = (id, params = {}) => this.http.request({
63
64
  path: `/file/${id}`,
64
65
  method: 'DELETE',
65
66
  ...params,
66
67
  });
68
+ this.http = http;
67
69
  }
68
70
  }
69
71
  exports.File = File;
@@ -1,4 +1,4 @@
1
- import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios';
1
+ import { AxiosInstance, AxiosRequestConfig, ResponseType } from 'axios';
2
2
  export declare type QueryParamsType = Record<string | number, any>;
3
3
  export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'params' | 'url' | 'responseType'> {
4
4
  /** set parameter to `true` for call `securityWorker` for this request */
@@ -37,5 +37,5 @@ export declare class HttpClient<SecurityDataType = unknown> {
37
37
  protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
38
38
  protected stringifyFormItem(formItem: unknown): string;
39
39
  protected createFormData(input: Record<string, unknown>): FormData;
40
- request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<AxiosResponse<T, any, {}>>;
40
+ request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: FullRequestParams) => Promise<T>;
41
41
  }
@@ -41,7 +41,8 @@ class HttpClient {
41
41
  if (type === ContentType.Text && body && body !== null && typeof body !== 'string') {
42
42
  body = JSON.stringify(body);
43
43
  }
44
- return this.instance.request({
44
+ return this.instance
45
+ .request({
45
46
  ...requestParams,
46
47
  headers: {
47
48
  ...(requestParams.headers || {}),
@@ -51,7 +52,8 @@ class HttpClient {
51
52
  responseType: responseFormat,
52
53
  data: body,
53
54
  url: path,
54
- });
55
+ })
56
+ .then((response) => response.data);
55
57
  };
56
58
  this.instance = axios_1.default.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || 'http://localhost:3002' });
57
59
  this.secure = secure;
@@ -1,68 +1,78 @@
1
- import { IKnowledge } from '../types/data-contracts';
1
+ import { IKnowledgeControllerCreateBookData, IKnowledgeControllerCreateChapterData } from '../types';
2
2
  import { HttpClient, RequestParams } from './HttpClient';
3
- export declare class Knowledge<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
3
+ export declare class Knowledge<SecurityDataType = unknown> {
4
+ http: HttpClient<SecurityDataType>;
5
+ constructor(http: HttpClient<SecurityDataType>);
4
6
  /**
5
7
  * No description
6
8
  *
7
9
  * @tags Knowledge
8
- * @name createBook
10
+ * @name KnowledgeControllerCreateBook
9
11
  * @request POST:/Knowledge/book
12
+ * @response `200` `IKnowledgeControllerCreateBookData` 创建知识库
10
13
  */
11
- createBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IKnowledge[], any, {}>>;
14
+ createBook: (params?: RequestParams) => Promise<IKnowledgeControllerCreateBookData>;
12
15
  /**
13
16
  * No description
14
17
  *
15
18
  * @tags Knowledge
16
- * @name createChapter
19
+ * @name KnowledgeControllerCreateChapter
17
20
  * @request POST:/Knowledge/chapter
21
+ * @response `200` `IKnowledgeControllerCreateChapterData` 创建知识章节
18
22
  */
19
- createChapter: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IKnowledge[], any, {}>>;
23
+ createChapter: (params?: RequestParams) => Promise<IKnowledgeControllerCreateChapterData>;
20
24
  /**
21
25
  * No description
22
26
  *
23
27
  * @tags Knowledge
24
- * @name deleteById
28
+ * @name KnowledgeControllerDeleteById
25
29
  * @request DELETE:/Knowledge/{id}
30
+ * @response `200` `IKnowledgeControllerDeleteByIdData`
26
31
  */
27
- deleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
32
+ deleteById: (id: string, params?: RequestParams) => Promise<any>;
28
33
  /**
29
34
  * No description
30
35
  *
31
36
  * @tags Knowledge
32
- * @name updateById
37
+ * @name KnowledgeControllerUpdateById
33
38
  * @request PATCH:/Knowledge/{id}
39
+ * @response `200` `IKnowledgeControllerUpdateByIdData`
34
40
  */
35
- updateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
41
+ updateById: (id: string, params?: RequestParams) => Promise<any>;
36
42
  /**
37
43
  * No description
38
44
  *
39
45
  * @tags Knowledge
40
- * @name findById
46
+ * @name KnowledgeControllerFindById
41
47
  * @request GET:/Knowledge/{id}
48
+ * @response `200` `IKnowledgeControllerFindByIdData`
42
49
  */
43
- findById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
50
+ findById: (id: string, params?: RequestParams) => Promise<any>;
44
51
  /**
45
52
  * No description
46
53
  *
47
54
  * @tags Knowledge
48
- * @name findAll
55
+ * @name KnowledgeControllerFindAll
49
56
  * @request GET:/Knowledge
57
+ * @response `200` `IKnowledgeControllerFindAllData`
50
58
  */
51
- findAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
59
+ findAll: (params?: RequestParams) => Promise<any>;
52
60
  /**
53
61
  * No description
54
62
  *
55
63
  * @tags Knowledge
56
- * @name updateViewsById
64
+ * @name KnowledgeControllerUpdateViewsById
57
65
  * @request POST:/Knowledge/{id}/views
66
+ * @response `200` `IKnowledgeControllerUpdateViewsByIdData`
58
67
  */
59
- updateViewsById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
68
+ updateViewsById: (id: string, params?: RequestParams) => Promise<any>;
60
69
  /**
61
70
  * No description
62
71
  *
63
72
  * @tags Knowledge
64
- * @name updateLikesById
73
+ * @name KnowledgeControllerUpdateLikesById
65
74
  * @request POST:/Knowledge/{id}/likes
75
+ * @response `200` `IKnowledgeControllerUpdateLikesByIdData`
66
76
  */
67
- updateLikesById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
77
+ updateLikesById: (id: string, params?: RequestParams) => Promise<any>;
68
78
  }