@fecommunity/reactpress-toolkit 1.0.0-beta.1 → 1.0.0

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 (130) hide show
  1. package/README.md +405 -0
  2. package/dist/Article.d.ts +121 -0
  3. package/dist/Article.js +189 -0
  4. package/dist/Auth.d.ts +30 -0
  5. package/dist/Auth.js +59 -0
  6. package/dist/Category.d.ts +49 -0
  7. package/dist/Category.js +85 -0
  8. package/dist/Comment.d.ts +58 -0
  9. package/dist/Comment.js +98 -0
  10. package/dist/File.d.ts +40 -0
  11. package/dist/File.js +72 -0
  12. package/dist/HttpClient.d.ts +41 -0
  13. package/dist/HttpClient.js +94 -0
  14. package/dist/Knowledge.d.ts +76 -0
  15. package/dist/Knowledge.js +124 -0
  16. package/dist/Page.d.ts +58 -0
  17. package/dist/Page.js +98 -0
  18. package/dist/Search.d.ts +30 -0
  19. package/dist/Search.js +59 -0
  20. package/dist/Setting.d.ts +22 -0
  21. package/dist/Setting.js +46 -0
  22. package/dist/Smtp.d.ts +31 -0
  23. package/dist/Smtp.js +59 -0
  24. package/dist/Tag.d.ts +58 -0
  25. package/dist/Tag.js +98 -0
  26. package/dist/User.d.ts +41 -0
  27. package/dist/User.js +73 -0
  28. package/dist/View.d.ts +49 -0
  29. package/dist/View.js +85 -0
  30. package/dist/api/ApiInstance.d.ts +39 -0
  31. package/dist/api/ApiInstance.js +46 -0
  32. package/dist/api/Article.d.ts +44 -29
  33. package/dist/api/Article.js +42 -31
  34. package/dist/api/ArticleRoute.d.ts +201 -0
  35. package/dist/api/ArticleRoute.js +12 -0
  36. package/dist/api/Auth.d.ts +11 -6
  37. package/dist/api/Auth.js +10 -8
  38. package/dist/api/AuthRoute.d.ts +44 -0
  39. package/dist/api/AuthRoute.js +12 -0
  40. package/dist/api/Category.d.ts +20 -13
  41. package/dist/api/Category.js +18 -15
  42. package/dist/api/CategoryRoute.d.ts +79 -0
  43. package/dist/api/CategoryRoute.js +12 -0
  44. package/dist/api/Comment.d.ts +22 -14
  45. package/dist/api/Comment.js +20 -16
  46. package/dist/api/CommentRoute.d.ts +95 -0
  47. package/dist/api/CommentRoute.js +12 -0
  48. package/dist/api/File.d.ts +16 -10
  49. package/dist/api/File.js +14 -12
  50. package/dist/api/FileRoute.d.ts +63 -0
  51. package/dist/api/FileRoute.js +12 -0
  52. package/dist/api/Knowledge.d.ts +29 -19
  53. package/dist/api/Knowledge.js +27 -22
  54. package/dist/api/KnowledgeRoute.d.ts +125 -0
  55. package/dist/api/KnowledgeRoute.js +12 -0
  56. package/dist/api/Page.d.ts +23 -15
  57. package/dist/api/Page.js +21 -17
  58. package/dist/api/PageRoute.d.ts +95 -0
  59. package/dist/api/PageRoute.js +12 -0
  60. package/dist/api/Search.d.ts +12 -7
  61. package/dist/api/Search.js +11 -9
  62. package/dist/api/SearchRoute.d.ts +46 -0
  63. package/dist/api/SearchRoute.js +12 -0
  64. package/dist/api/Setting.d.ts +10 -6
  65. package/dist/api/Setting.js +8 -8
  66. package/dist/api/SettingRoute.d.ts +31 -0
  67. package/dist/api/SettingRoute.js +12 -0
  68. package/dist/api/Smtp.d.ts +14 -9
  69. package/dist/api/Smtp.js +12 -11
  70. package/dist/api/SmtpRoute.d.ts +47 -0
  71. package/dist/api/SmtpRoute.js +12 -0
  72. package/dist/api/Tag.d.ts +22 -14
  73. package/dist/api/Tag.js +20 -16
  74. package/dist/api/TagRoute.d.ts +95 -0
  75. package/dist/api/TagRoute.js +12 -0
  76. package/dist/api/User.d.ts +15 -8
  77. package/dist/api/User.js +13 -13
  78. package/dist/api/UserRoute.d.ts +60 -0
  79. package/dist/api/UserRoute.js +12 -0
  80. package/dist/api/View.d.ts +19 -12
  81. package/dist/api/View.js +17 -14
  82. package/dist/api/ViewRoute.d.ts +77 -0
  83. package/dist/api/ViewRoute.js +12 -0
  84. package/dist/api/httpClient.d.ts +5 -5
  85. package/dist/api/httpClient.js +4 -2
  86. package/dist/api/index.d.ts +13 -18
  87. package/dist/api/index.js +28 -41
  88. package/dist/api/instance.d.ts +47 -0
  89. package/dist/api/instance.js +71 -0
  90. package/dist/data-contracts.d.ts +245 -0
  91. package/dist/data-contracts.js +12 -0
  92. package/dist/index.d.ts +5 -9
  93. package/dist/index.js +16 -21
  94. package/dist/types/index.d.ts +245 -1
  95. package/dist/types/index.js +10 -17
  96. package/dist/utils/common.d.ts +1 -3
  97. package/dist/utils/common.js +5 -31
  98. package/dist/utils/http.js +4 -6
  99. package/dist/utils/index.d.ts +33 -2
  100. package/dist/utils/index.js +57 -18
  101. package/package.json +11 -6
  102. package/demos/simple.ts +0 -65
  103. package/scripts/generate-api-types.js +0 -571
  104. package/scripts/generate-swagger.js +0 -47
  105. package/scripts/organize-api.js +0 -136
  106. package/src/api/Article.ts +0 -186
  107. package/src/api/Auth.ts +0 -54
  108. package/src/api/Category.ts +0 -82
  109. package/src/api/Comment.ts +0 -95
  110. package/src/api/File.ts +0 -69
  111. package/src/api/Knowledge.ts +0 -122
  112. package/src/api/Page.ts +0 -95
  113. package/src/api/Search.ts +0 -54
  114. package/src/api/Setting.ts +0 -43
  115. package/src/api/Smtp.ts +0 -56
  116. package/src/api/Tag.ts +0 -95
  117. package/src/api/User.ts +0 -72
  118. package/src/api/View.ts +0 -82
  119. package/src/api/api-instance.ts +0 -69
  120. package/src/api/httpClient.ts +0 -140
  121. package/src/api/index.ts +0 -25
  122. package/src/index.ts +0 -18
  123. package/src/types/data-contracts.ts +0 -198
  124. package/src/types/index.ts +0 -4
  125. package/src/utils/common.ts +0 -108
  126. package/src/utils/http.ts +0 -52
  127. package/src/utils/index.ts +0 -5
  128. package/test-final.js +0 -56
  129. package/test-import.js +0 -34
  130. package/tsconfig.json +0 -20
@@ -0,0 +1,95 @@
1
+ import { ITag } from '../types/data-contracts';
2
+ export declare namespace Tag {
3
+ /**
4
+ * No description
5
+ * @tags Tag
6
+ * @name create
7
+ * @request POST:/tag
8
+ * @response `200` `(ITag)[]` 创建标签
9
+ */
10
+ namespace create {
11
+ type RequestParams = {};
12
+ type RequestQuery = {};
13
+ type RequestBody = never;
14
+ type RequestHeaders = {};
15
+ type ResponseBody = ITag[];
16
+ }
17
+ /**
18
+ * No description
19
+ * @tags Tag
20
+ * @name findAll
21
+ * @request GET:/tag
22
+ * @response `200` `void`
23
+ */
24
+ namespace findAll {
25
+ type RequestParams = {};
26
+ type RequestQuery = {};
27
+ type RequestBody = never;
28
+ type RequestHeaders = {};
29
+ type ResponseBody = void;
30
+ }
31
+ /**
32
+ * No description
33
+ * @tags Tag
34
+ * @name findById
35
+ * @request GET:/tag/{id}
36
+ * @response `200` `void`
37
+ */
38
+ namespace findById {
39
+ type RequestParams = {
40
+ id: string;
41
+ };
42
+ type RequestQuery = {};
43
+ type RequestBody = never;
44
+ type RequestHeaders = {};
45
+ type ResponseBody = void;
46
+ }
47
+ /**
48
+ * No description
49
+ * @tags Tag
50
+ * @name updateById
51
+ * @request PATCH:/tag/{id}
52
+ * @response `200` `void`
53
+ */
54
+ namespace updateById {
55
+ type RequestParams = {
56
+ id: string;
57
+ };
58
+ type RequestQuery = {};
59
+ type RequestBody = never;
60
+ type RequestHeaders = {};
61
+ type ResponseBody = void;
62
+ }
63
+ /**
64
+ * No description
65
+ * @tags Tag
66
+ * @name deleteById
67
+ * @request DELETE:/tag/{id}
68
+ * @response `200` `void`
69
+ */
70
+ namespace deleteById {
71
+ type RequestParams = {
72
+ id: string;
73
+ };
74
+ type RequestQuery = {};
75
+ type RequestBody = never;
76
+ type RequestHeaders = {};
77
+ type ResponseBody = void;
78
+ }
79
+ /**
80
+ * No description
81
+ * @tags Tag
82
+ * @name getArticleById
83
+ * @request GET:/tag/{id}/article
84
+ * @response `200` `void`
85
+ */
86
+ namespace getArticleById {
87
+ type RequestParams = {
88
+ id: string;
89
+ };
90
+ type RequestQuery = {};
91
+ type RequestBody = never;
92
+ type RequestHeaders = {};
93
+ type ResponseBody = void;
94
+ }
95
+ }
@@ -0,0 +1,12 @@
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 });
@@ -1,36 +1,43 @@
1
- import { IUser } from '../types/data-contracts';
2
- import { HttpClient, RequestParams } from './httpClient';
3
- export declare class User<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
1
+ import { IUserControllerFindAllData, IUserControllerRegisterData, IUserControllerUpdateData, IUserControllerUpdatePasswordData } from '../types';
2
+ import { HttpClient, RequestParams } from './HttpClient';
3
+ export declare class User<SecurityDataType = unknown> {
4
+ http: HttpClient<SecurityDataType>;
5
+ constructor(http: HttpClient<SecurityDataType>);
4
6
  /**
5
7
  * No description
6
8
  *
7
9
  * @tags User
8
- * @name findAll
10
+ * @name UserControllerFindAll
9
11
  * @request GET:/user
12
+ * @response `200` `IUserControllerFindAllData` 获取用户列表
13
+ * @response `403` `void` 无权获取用户列表
10
14
  */
11
- findAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IUser[], any, {}>>;
15
+ findAll: (params?: RequestParams) => Promise<IUserControllerFindAllData>;
12
16
  /**
13
17
  * No description
14
18
  *
15
19
  * @tags User
16
20
  * @name UserControllerRegister
17
21
  * @request POST:/user/register
22
+ * @response `201` `IUserControllerRegisterData` 创建用户
18
23
  */
19
- userControllerRegister: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IUser[], any, {}>>;
24
+ register: (params?: RequestParams) => Promise<IUserControllerRegisterData>;
20
25
  /**
21
26
  * No description
22
27
  *
23
28
  * @tags User
24
29
  * @name UserControllerUpdate
25
30
  * @request POST:/user/update
31
+ * @response `200` `IUserControllerUpdateData` 更新用户成功
26
32
  */
27
- userControllerUpdate: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IUser[], any, {}>>;
33
+ update: (params?: RequestParams) => Promise<IUserControllerUpdateData>;
28
34
  /**
29
35
  * No description
30
36
  *
31
37
  * @tags User
32
38
  * @name UserControllerUpdatePassword
33
39
  * @request POST:/user/password
40
+ * @response `201` `IUserControllerUpdatePasswordData` 更新密码成功
34
41
  */
35
- userControllerUpdatePassword: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IUser[], any, {}>>;
42
+ updatePassword: (params?: RequestParams) => Promise<IUserControllerUpdatePasswordData>;
36
43
  }
package/dist/api/User.js CHANGED
@@ -11,21 +11,20 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.User = void 0;
14
- const httpClient_1 = require("./httpClient");
15
- class User extends httpClient_1.HttpClient {
16
- constructor() {
17
- super(...arguments);
14
+ class User {
15
+ constructor(http) {
18
16
  /**
19
17
  * No description
20
18
  *
21
19
  * @tags User
22
- * @name findAll
20
+ * @name UserControllerFindAll
23
21
  * @request GET:/user
22
+ * @response `200` `IUserControllerFindAllData` 获取用户列表
23
+ * @response `403` `void` 无权获取用户列表
24
24
  */
25
- this.findAll = (params = {}) => this.request({
25
+ this.findAll = (params = {}) => this.http.request({
26
26
  path: `/user`,
27
27
  method: 'GET',
28
- format: 'json',
29
28
  ...params,
30
29
  });
31
30
  /**
@@ -34,11 +33,11 @@ class User extends httpClient_1.HttpClient {
34
33
  * @tags User
35
34
  * @name UserControllerRegister
36
35
  * @request POST:/user/register
36
+ * @response `201` `IUserControllerRegisterData` 创建用户
37
37
  */
38
- this.userControllerRegister = (params = {}) => this.request({
38
+ this.register = (params = {}) => this.http.request({
39
39
  path: `/user/register`,
40
40
  method: 'POST',
41
- format: 'json',
42
41
  ...params,
43
42
  });
44
43
  /**
@@ -47,11 +46,11 @@ class User extends httpClient_1.HttpClient {
47
46
  * @tags User
48
47
  * @name UserControllerUpdate
49
48
  * @request POST:/user/update
49
+ * @response `200` `IUserControllerUpdateData` 更新用户成功
50
50
  */
51
- this.userControllerUpdate = (params = {}) => this.request({
51
+ this.update = (params = {}) => this.http.request({
52
52
  path: `/user/update`,
53
53
  method: 'POST',
54
- format: 'json',
55
54
  ...params,
56
55
  });
57
56
  /**
@@ -60,13 +59,14 @@ class User extends httpClient_1.HttpClient {
60
59
  * @tags User
61
60
  * @name UserControllerUpdatePassword
62
61
  * @request POST:/user/password
62
+ * @response `201` `IUserControllerUpdatePasswordData` 更新密码成功
63
63
  */
64
- this.userControllerUpdatePassword = (params = {}) => this.request({
64
+ this.updatePassword = (params = {}) => this.http.request({
65
65
  path: `/user/password`,
66
66
  method: 'POST',
67
- format: 'json',
68
67
  ...params,
69
68
  });
69
+ this.http = http;
70
70
  }
71
71
  }
72
72
  exports.User = User;
@@ -0,0 +1,60 @@
1
+ import { IUser } from '../types/data-contracts';
2
+ export declare namespace User {
3
+ /**
4
+ * No description
5
+ * @tags User
6
+ * @name findAll
7
+ * @request GET:/user
8
+ * @response `200` `(IUser)[]` 获取用户列表
9
+ * @response `403` `void` 无权获取用户列表
10
+ */
11
+ namespace findAll {
12
+ type RequestParams = {};
13
+ type RequestQuery = {};
14
+ type RequestBody = never;
15
+ type RequestHeaders = {};
16
+ type ResponseBody = IUser[];
17
+ }
18
+ /**
19
+ * No description
20
+ * @tags User
21
+ * @name register
22
+ * @request POST:/user/register
23
+ * @response `201` `(IUser)[]` 创建用户
24
+ */
25
+ namespace register {
26
+ type RequestParams = {};
27
+ type RequestQuery = {};
28
+ type RequestBody = never;
29
+ type RequestHeaders = {};
30
+ type ResponseBody = IUser[];
31
+ }
32
+ /**
33
+ * No description
34
+ * @tags User
35
+ * @name update
36
+ * @request POST:/user/update
37
+ * @response `200` `(IUser)[]` 更新用户成功
38
+ */
39
+ namespace update {
40
+ type RequestParams = {};
41
+ type RequestQuery = {};
42
+ type RequestBody = never;
43
+ type RequestHeaders = {};
44
+ type ResponseBody = IUser[];
45
+ }
46
+ /**
47
+ * No description
48
+ * @tags User
49
+ * @name updatePassword
50
+ * @request POST:/user/password
51
+ * @response `201` `(IUser)[]` 更新密码成功
52
+ */
53
+ namespace updatePassword {
54
+ type RequestParams = {};
55
+ type RequestQuery = {};
56
+ type RequestBody = never;
57
+ type RequestHeaders = {};
58
+ type ResponseBody = IUser[];
59
+ }
60
+ }
@@ -0,0 +1,12 @@
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 });
@@ -1,44 +1,51 @@
1
- import { IView } from '../types/data-contracts';
2
- import { HttpClient, RequestParams } from './httpClient';
3
- export declare class View<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
1
+ import { IViewControllerCreateData } from '../types';
2
+ import { HttpClient, RequestParams } from './HttpClient';
3
+ export declare class View<SecurityDataType = unknown> {
4
+ http: HttpClient<SecurityDataType>;
5
+ constructor(http: HttpClient<SecurityDataType>);
4
6
  /**
5
7
  * No description
6
8
  *
7
9
  * @tags View
8
- * @name create
10
+ * @name ViewControllerCreate
9
11
  * @request POST:/view
12
+ * @response `200` `IViewControllerCreateData` 访问记录添加成功
10
13
  */
11
- create: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IView[], any, {}>>;
14
+ create: (params?: RequestParams) => Promise<IViewControllerCreateData>;
12
15
  /**
13
16
  * No description
14
17
  *
15
18
  * @tags View
16
- * @name findAll
19
+ * @name ViewControllerFindAll
17
20
  * @request GET:/view
21
+ * @response `200` `IViewControllerFindAllData`
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 View
24
28
  * @name ViewControllerFindByUrl
25
29
  * @request GET:/view/url
30
+ * @response `200` `IViewControllerFindByUrlData`
26
31
  */
27
- viewControllerFindByUrl: (params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
32
+ findByUrl: (params?: RequestParams) => Promise<any>;
28
33
  /**
29
34
  * No description
30
35
  *
31
36
  * @tags View
32
- * @name findById
37
+ * @name ViewControllerFindById
33
38
  * @request GET:/view/{id}
39
+ * @response `200` `IViewControllerFindByIdData`
34
40
  */
35
- findById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
41
+ findById: (id: string, params?: RequestParams) => Promise<any>;
36
42
  /**
37
43
  * No description
38
44
  *
39
45
  * @tags View
40
- * @name deleteById
46
+ * @name ViewControllerDeleteById
41
47
  * @request DELETE:/view/{id}
48
+ * @response `200` `IViewControllerDeleteByIdData`
42
49
  */
43
- deleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any, {}>>;
50
+ deleteById: (id: string, params?: RequestParams) => Promise<any>;
44
51
  }
package/dist/api/View.js CHANGED
@@ -11,31 +11,30 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.View = void 0;
14
- const httpClient_1 = require("./httpClient");
15
- class View extends httpClient_1.HttpClient {
16
- constructor() {
17
- super(...arguments);
14
+ class View {
15
+ constructor(http) {
18
16
  /**
19
17
  * No description
20
18
  *
21
19
  * @tags View
22
- * @name create
20
+ * @name ViewControllerCreate
23
21
  * @request POST:/view
22
+ * @response `200` `IViewControllerCreateData` 访问记录添加成功
24
23
  */
25
- this.create = (params = {}) => this.request({
24
+ this.create = (params = {}) => this.http.request({
26
25
  path: `/view`,
27
26
  method: 'POST',
28
- format: 'json',
29
27
  ...params,
30
28
  });
31
29
  /**
32
30
  * No description
33
31
  *
34
32
  * @tags View
35
- * @name findAll
33
+ * @name ViewControllerFindAll
36
34
  * @request GET:/view
35
+ * @response `200` `IViewControllerFindAllData`
37
36
  */
38
- this.findAll = (params = {}) => this.request({
37
+ this.findAll = (params = {}) => this.http.request({
39
38
  path: `/view`,
40
39
  method: 'GET',
41
40
  ...params,
@@ -46,8 +45,9 @@ class View extends httpClient_1.HttpClient {
46
45
  * @tags View
47
46
  * @name ViewControllerFindByUrl
48
47
  * @request GET:/view/url
48
+ * @response `200` `IViewControllerFindByUrlData`
49
49
  */
50
- this.viewControllerFindByUrl = (params = {}) => this.request({
50
+ this.findByUrl = (params = {}) => this.http.request({
51
51
  path: `/view/url`,
52
52
  method: 'GET',
53
53
  ...params,
@@ -56,10 +56,11 @@ class View extends httpClient_1.HttpClient {
56
56
  * No description
57
57
  *
58
58
  * @tags View
59
- * @name findById
59
+ * @name ViewControllerFindById
60
60
  * @request GET:/view/{id}
61
+ * @response `200` `IViewControllerFindByIdData`
61
62
  */
62
- this.findById = (id, params = {}) => this.request({
63
+ this.findById = (id, params = {}) => this.http.request({
63
64
  path: `/view/${id}`,
64
65
  method: 'GET',
65
66
  ...params,
@@ -68,14 +69,16 @@ class View extends httpClient_1.HttpClient {
68
69
  * No description
69
70
  *
70
71
  * @tags View
71
- * @name deleteById
72
+ * @name ViewControllerDeleteById
72
73
  * @request DELETE:/view/{id}
74
+ * @response `200` `IViewControllerDeleteByIdData`
73
75
  */
74
- this.deleteById = (id, params = {}) => this.request({
76
+ this.deleteById = (id, params = {}) => this.http.request({
75
77
  path: `/view/${id}`,
76
78
  method: 'DELETE',
77
79
  ...params,
78
80
  });
81
+ this.http = http;
79
82
  }
80
83
  }
81
84
  exports.View = View;
@@ -0,0 +1,77 @@
1
+ import { IView } from '../types/data-contracts';
2
+ export declare namespace View {
3
+ /**
4
+ * No description
5
+ * @tags View
6
+ * @name create
7
+ * @request POST:/view
8
+ * @response `200` `(IView)[]` 访问记录添加成功
9
+ */
10
+ namespace create {
11
+ type RequestParams = {};
12
+ type RequestQuery = {};
13
+ type RequestBody = never;
14
+ type RequestHeaders = {};
15
+ type ResponseBody = IView[];
16
+ }
17
+ /**
18
+ * No description
19
+ * @tags View
20
+ * @name findAll
21
+ * @request GET:/view
22
+ * @response `200` `void`
23
+ */
24
+ namespace findAll {
25
+ type RequestParams = {};
26
+ type RequestQuery = {};
27
+ type RequestBody = never;
28
+ type RequestHeaders = {};
29
+ type ResponseBody = void;
30
+ }
31
+ /**
32
+ * No description
33
+ * @tags View
34
+ * @name findByUrl
35
+ * @request GET:/view/url
36
+ * @response `200` `void`
37
+ */
38
+ namespace findByUrl {
39
+ type RequestParams = {};
40
+ type RequestQuery = {};
41
+ type RequestBody = never;
42
+ type RequestHeaders = {};
43
+ type ResponseBody = void;
44
+ }
45
+ /**
46
+ * No description
47
+ * @tags View
48
+ * @name findById
49
+ * @request GET:/view/{id}
50
+ * @response `200` `void`
51
+ */
52
+ namespace findById {
53
+ type RequestParams = {
54
+ id: string;
55
+ };
56
+ type RequestQuery = {};
57
+ type RequestBody = never;
58
+ type RequestHeaders = {};
59
+ type ResponseBody = void;
60
+ }
61
+ /**
62
+ * No description
63
+ * @tags View
64
+ * @name deleteById
65
+ * @request DELETE:/view/{id}
66
+ * @response `200` `void`
67
+ */
68
+ namespace deleteById {
69
+ type RequestParams = {
70
+ id: string;
71
+ };
72
+ type RequestQuery = {};
73
+ type RequestBody = never;
74
+ type RequestHeaders = {};
75
+ type ResponseBody = void;
76
+ }
77
+ }
@@ -0,0 +1,12 @@
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 });
@@ -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 */
@@ -15,7 +15,7 @@ export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'pa
15
15
  body?: unknown;
16
16
  }
17
17
  export declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
18
- export interface HttpClientConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
18
+ export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
19
19
  securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
20
20
  secure?: boolean;
21
21
  format?: ResponseType;
@@ -29,13 +29,13 @@ export declare enum ContentType {
29
29
  export declare class HttpClient<SecurityDataType = unknown> {
30
30
  instance: AxiosInstance;
31
31
  private securityData;
32
- securityWorker?: HttpClientConfig<SecurityDataType>['securityWorker'];
32
+ private securityWorker?;
33
33
  private secure?;
34
34
  private format?;
35
- constructor({ securityWorker, secure, format, ...axiosConfig }?: HttpClientConfig<SecurityDataType>);
35
+ constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
36
36
  setSecurityData: (data: SecurityDataType | null) => void;
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,18 +1,13 @@
1
- export * from './Article';
2
- export * from './Auth';
3
- export * from './Category';
4
- export * from './Comment';
5
- export * from './File';
6
- export * from './Knowledge';
7
- export * from './Page';
8
- export * from './Search';
9
- export * from './Setting';
10
- export * from './Smtp';
11
- export * from './Tag';
12
- export * from './User';
13
- export * from './View';
14
- export * from './httpClient';
15
- export { HttpClient } from './httpClient';
16
- export type { HttpClientConfig } from './httpClient';
17
- export * from './api-instance';
18
- export { default as api } from './api-instance';
1
+ export { Article } from './Article';
2
+ export { Auth } from './Auth';
3
+ export { Category } from './Category';
4
+ export { Comment } from './Comment';
5
+ export { File } from './File';
6
+ export { Knowledge } from './Knowledge';
7
+ export { Page } from './Page';
8
+ export { Search } from './Search';
9
+ export { Setting } from './Setting';
10
+ export { Smtp } from './Smtp';
11
+ export { Tag } from './Tag';
12
+ export { User } from './User';
13
+ export { View } from './View';