@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
package/dist/Auth.d.ts ADDED
@@ -0,0 +1,30 @@
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
+ * @response `200` `IAuthControllerLoginData`
10
+ */
11
+ authControllerLogin: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
12
+ /**
13
+ * No description
14
+ *
15
+ * @tags Auth
16
+ * @name AuthControllerCreateBook
17
+ * @request POST:/auth/admin
18
+ * @response `201` `IAuthControllerCreateBookData`
19
+ */
20
+ authControllerCreateBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
21
+ /**
22
+ * No description
23
+ *
24
+ * @tags Auth
25
+ * @name AuthControllerLoginWithGithub
26
+ * @request POST:/auth/github
27
+ * @response `201` `IAuthControllerLoginWithGithubData`
28
+ */
29
+ authControllerLoginWithGithub: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
30
+ }
package/dist/Auth.js ADDED
@@ -0,0 +1,59 @@
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
+ * @response `200` `IAuthControllerLoginData`
25
+ */
26
+ this.authControllerLogin = (params = {}) => this.request({
27
+ path: `/auth/login`,
28
+ method: 'POST',
29
+ ...params,
30
+ });
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Auth
35
+ * @name AuthControllerCreateBook
36
+ * @request POST:/auth/admin
37
+ * @response `201` `IAuthControllerCreateBookData`
38
+ */
39
+ this.authControllerCreateBook = (params = {}) => this.request({
40
+ path: `/auth/admin`,
41
+ method: 'POST',
42
+ ...params,
43
+ });
44
+ /**
45
+ * No description
46
+ *
47
+ * @tags Auth
48
+ * @name AuthControllerLoginWithGithub
49
+ * @request POST:/auth/github
50
+ * @response `201` `IAuthControllerLoginWithGithubData`
51
+ */
52
+ this.authControllerLoginWithGithub = (params = {}) => this.request({
53
+ path: `/auth/github`,
54
+ method: 'POST',
55
+ ...params,
56
+ });
57
+ }
58
+ }
59
+ exports.Auth = Auth;
@@ -0,0 +1,49 @@
1
+ import { ICategoryControllerCreateData } from './data-contracts';
2
+ import { HttpClient, RequestParams } from './HttpClient';
3
+ export declare class Category<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
+ /**
5
+ * No description
6
+ *
7
+ * @tags Category
8
+ * @name CategoryControllerCreate
9
+ * @request POST:/category
10
+ * @response `200` `ICategoryControllerCreateData` 添加分类
11
+ */
12
+ categoryControllerCreate: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ICategoryControllerCreateData, any, {}>>;
13
+ /**
14
+ * No description
15
+ *
16
+ * @tags Category
17
+ * @name CategoryControllerFindAll
18
+ * @request GET:/category
19
+ * @response `200` `ICategoryControllerFindAllData`
20
+ */
21
+ categoryControllerFindAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
22
+ /**
23
+ * No description
24
+ *
25
+ * @tags Category
26
+ * @name CategoryControllerFindById
27
+ * @request GET:/category/{id}
28
+ * @response `200` `ICategoryControllerFindByIdData`
29
+ */
30
+ categoryControllerFindById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Category
35
+ * @name CategoryControllerUpdateById
36
+ * @request PATCH:/category/{id}
37
+ * @response `200` `ICategoryControllerUpdateByIdData`
38
+ */
39
+ categoryControllerUpdateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
40
+ /**
41
+ * No description
42
+ *
43
+ * @tags Category
44
+ * @name CategoryControllerDeleteById
45
+ * @request DELETE:/category/{id}
46
+ * @response `200` `ICategoryControllerDeleteByIdData`
47
+ */
48
+ categoryControllerDeleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
49
+ }
@@ -0,0 +1,85 @@
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.Category = void 0;
14
+ const HttpClient_1 = require("./HttpClient");
15
+ class Category extends HttpClient_1.HttpClient {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * No description
20
+ *
21
+ * @tags Category
22
+ * @name CategoryControllerCreate
23
+ * @request POST:/category
24
+ * @response `200` `ICategoryControllerCreateData` 添加分类
25
+ */
26
+ this.categoryControllerCreate = (params = {}) => this.request({
27
+ path: `/category`,
28
+ method: 'POST',
29
+ ...params,
30
+ });
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Category
35
+ * @name CategoryControllerFindAll
36
+ * @request GET:/category
37
+ * @response `200` `ICategoryControllerFindAllData`
38
+ */
39
+ this.categoryControllerFindAll = (params = {}) => this.request({
40
+ path: `/category`,
41
+ method: 'GET',
42
+ ...params,
43
+ });
44
+ /**
45
+ * No description
46
+ *
47
+ * @tags Category
48
+ * @name CategoryControllerFindById
49
+ * @request GET:/category/{id}
50
+ * @response `200` `ICategoryControllerFindByIdData`
51
+ */
52
+ this.categoryControllerFindById = (id, params = {}) => this.request({
53
+ path: `/category/${id}`,
54
+ method: 'GET',
55
+ ...params,
56
+ });
57
+ /**
58
+ * No description
59
+ *
60
+ * @tags Category
61
+ * @name CategoryControllerUpdateById
62
+ * @request PATCH:/category/{id}
63
+ * @response `200` `ICategoryControllerUpdateByIdData`
64
+ */
65
+ this.categoryControllerUpdateById = (id, params = {}) => this.request({
66
+ path: `/category/${id}`,
67
+ method: 'PATCH',
68
+ ...params,
69
+ });
70
+ /**
71
+ * No description
72
+ *
73
+ * @tags Category
74
+ * @name CategoryControllerDeleteById
75
+ * @request DELETE:/category/{id}
76
+ * @response `200` `ICategoryControllerDeleteByIdData`
77
+ */
78
+ this.categoryControllerDeleteById = (id, params = {}) => this.request({
79
+ path: `/category/${id}`,
80
+ method: 'DELETE',
81
+ ...params,
82
+ });
83
+ }
84
+ }
85
+ exports.Category = Category;
@@ -0,0 +1,58 @@
1
+ import { ICommentControllerCreateData } from './data-contracts';
2
+ import { HttpClient, RequestParams } from './HttpClient';
3
+ export declare class Comment<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
+ /**
5
+ * No description
6
+ *
7
+ * @tags Comment
8
+ * @name CommentControllerCreate
9
+ * @request POST:/comment
10
+ * @response `200` `ICommentControllerCreateData` 创建评论
11
+ */
12
+ commentControllerCreate: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ICommentControllerCreateData, any, {}>>;
13
+ /**
14
+ * No description
15
+ *
16
+ * @tags Comment
17
+ * @name CommentControllerFindAll
18
+ * @request GET:/comment
19
+ * @response `200` `ICommentControllerFindAllData`
20
+ */
21
+ commentControllerFindAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
22
+ /**
23
+ * No description
24
+ *
25
+ * @tags Comment
26
+ * @name CommentControllerFindById
27
+ * @request GET:/comment/{id}
28
+ * @response `200` `ICommentControllerFindByIdData`
29
+ */
30
+ commentControllerFindById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Comment
35
+ * @name CommentControllerUpdateById
36
+ * @request PATCH:/comment/{id}
37
+ * @response `200` `ICommentControllerUpdateByIdData`
38
+ */
39
+ commentControllerUpdateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
40
+ /**
41
+ * No description
42
+ *
43
+ * @tags Comment
44
+ * @name CommentControllerDeleteById
45
+ * @request DELETE:/comment/{id}
46
+ * @response `200` `ICommentControllerDeleteByIdData`
47
+ */
48
+ commentControllerDeleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
49
+ /**
50
+ * No description
51
+ *
52
+ * @tags Comment
53
+ * @name CommentControllerGetArticleComments
54
+ * @request GET:/comment/host/{hostId}
55
+ * @response `200` `ICommentControllerGetArticleCommentsData`
56
+ */
57
+ commentControllerGetArticleComments: (hostId: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
58
+ }
@@ -0,0 +1,98 @@
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.Comment = void 0;
14
+ const HttpClient_1 = require("./HttpClient");
15
+ class Comment extends HttpClient_1.HttpClient {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * No description
20
+ *
21
+ * @tags Comment
22
+ * @name CommentControllerCreate
23
+ * @request POST:/comment
24
+ * @response `200` `ICommentControllerCreateData` 创建评论
25
+ */
26
+ this.commentControllerCreate = (params = {}) => this.request({
27
+ path: `/comment`,
28
+ method: 'POST',
29
+ ...params,
30
+ });
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Comment
35
+ * @name CommentControllerFindAll
36
+ * @request GET:/comment
37
+ * @response `200` `ICommentControllerFindAllData`
38
+ */
39
+ this.commentControllerFindAll = (params = {}) => this.request({
40
+ path: `/comment`,
41
+ method: 'GET',
42
+ ...params,
43
+ });
44
+ /**
45
+ * No description
46
+ *
47
+ * @tags Comment
48
+ * @name CommentControllerFindById
49
+ * @request GET:/comment/{id}
50
+ * @response `200` `ICommentControllerFindByIdData`
51
+ */
52
+ this.commentControllerFindById = (id, params = {}) => this.request({
53
+ path: `/comment/${id}`,
54
+ method: 'GET',
55
+ ...params,
56
+ });
57
+ /**
58
+ * No description
59
+ *
60
+ * @tags Comment
61
+ * @name CommentControllerUpdateById
62
+ * @request PATCH:/comment/{id}
63
+ * @response `200` `ICommentControllerUpdateByIdData`
64
+ */
65
+ this.commentControllerUpdateById = (id, params = {}) => this.request({
66
+ path: `/comment/${id}`,
67
+ method: 'PATCH',
68
+ ...params,
69
+ });
70
+ /**
71
+ * No description
72
+ *
73
+ * @tags Comment
74
+ * @name CommentControllerDeleteById
75
+ * @request DELETE:/comment/{id}
76
+ * @response `200` `ICommentControllerDeleteByIdData`
77
+ */
78
+ this.commentControllerDeleteById = (id, params = {}) => this.request({
79
+ path: `/comment/${id}`,
80
+ method: 'DELETE',
81
+ ...params,
82
+ });
83
+ /**
84
+ * No description
85
+ *
86
+ * @tags Comment
87
+ * @name CommentControllerGetArticleComments
88
+ * @request GET:/comment/host/{hostId}
89
+ * @response `200` `ICommentControllerGetArticleCommentsData`
90
+ */
91
+ this.commentControllerGetArticleComments = (hostId, params = {}) => this.request({
92
+ path: `/comment/host/${hostId}`,
93
+ method: 'GET',
94
+ ...params,
95
+ });
96
+ }
97
+ }
98
+ exports.Comment = Comment;
package/dist/File.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { IFileControllerUploadFileData } from './data-contracts';
2
+ import { HttpClient, RequestParams } from './HttpClient';
3
+ export declare class File<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
+ /**
5
+ * No description
6
+ *
7
+ * @tags File
8
+ * @name FileControllerUploadFile
9
+ * @request POST:/file/upload
10
+ * @response `200` `IFileControllerUploadFileData` 上传文件
11
+ */
12
+ fileControllerUploadFile: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IFileControllerUploadFileData, any, {}>>;
13
+ /**
14
+ * No description
15
+ *
16
+ * @tags File
17
+ * @name FileControllerFindAll
18
+ * @request GET:/file
19
+ * @response `200` `IFileControllerFindAllData`
20
+ */
21
+ fileControllerFindAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
22
+ /**
23
+ * No description
24
+ *
25
+ * @tags File
26
+ * @name FileControllerFindById
27
+ * @request GET:/file/{id}
28
+ * @response `200` `IFileControllerFindByIdData`
29
+ */
30
+ fileControllerFindById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags File
35
+ * @name FileControllerDeleteById
36
+ * @request DELETE:/file/{id}
37
+ * @response `200` `IFileControllerDeleteByIdData`
38
+ */
39
+ fileControllerDeleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
40
+ }
package/dist/File.js ADDED
@@ -0,0 +1,72 @@
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.File = void 0;
14
+ const HttpClient_1 = require("./HttpClient");
15
+ class File extends HttpClient_1.HttpClient {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * No description
20
+ *
21
+ * @tags File
22
+ * @name FileControllerUploadFile
23
+ * @request POST:/file/upload
24
+ * @response `200` `IFileControllerUploadFileData` 上传文件
25
+ */
26
+ this.fileControllerUploadFile = (params = {}) => this.request({
27
+ path: `/file/upload`,
28
+ method: 'POST',
29
+ ...params,
30
+ });
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags File
35
+ * @name FileControllerFindAll
36
+ * @request GET:/file
37
+ * @response `200` `IFileControllerFindAllData`
38
+ */
39
+ this.fileControllerFindAll = (params = {}) => this.request({
40
+ path: `/file`,
41
+ method: 'GET',
42
+ ...params,
43
+ });
44
+ /**
45
+ * No description
46
+ *
47
+ * @tags File
48
+ * @name FileControllerFindById
49
+ * @request GET:/file/{id}
50
+ * @response `200` `IFileControllerFindByIdData`
51
+ */
52
+ this.fileControllerFindById = (id, params = {}) => this.request({
53
+ path: `/file/${id}`,
54
+ method: 'GET',
55
+ ...params,
56
+ });
57
+ /**
58
+ * No description
59
+ *
60
+ * @tags File
61
+ * @name FileControllerDeleteById
62
+ * @request DELETE:/file/{id}
63
+ * @response `200` `IFileControllerDeleteByIdData`
64
+ */
65
+ this.fileControllerDeleteById = (id, params = {}) => this.request({
66
+ path: `/file/${id}`,
67
+ method: 'DELETE',
68
+ ...params,
69
+ });
70
+ }
71
+ }
72
+ exports.File = File;
@@ -0,0 +1,41 @@
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios';
2
+ export declare type QueryParamsType = Record<string | number, any>;
3
+ export interface FullRequestParams extends Omit<AxiosRequestConfig, 'data' | 'params' | 'url' | 'responseType'> {
4
+ /** set parameter to `true` for call `securityWorker` for this request */
5
+ secure?: boolean;
6
+ /** request path */
7
+ path: string;
8
+ /** content type of request body */
9
+ type?: ContentType;
10
+ /** query params */
11
+ query?: QueryParamsType;
12
+ /** format of response (i.e. response.json() -> format: "json") */
13
+ format?: ResponseType;
14
+ /** request body */
15
+ body?: unknown;
16
+ }
17
+ export declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
18
+ export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, 'data' | 'cancelToken'> {
19
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
20
+ secure?: boolean;
21
+ format?: ResponseType;
22
+ }
23
+ export declare enum ContentType {
24
+ Json = "application/json",
25
+ FormData = "multipart/form-data",
26
+ UrlEncoded = "application/x-www-form-urlencoded",
27
+ Text = "text/plain"
28
+ }
29
+ export declare class HttpClient<SecurityDataType = unknown> {
30
+ instance: AxiosInstance;
31
+ private securityData;
32
+ private securityWorker?;
33
+ private secure?;
34
+ private format?;
35
+ constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig<SecurityDataType>);
36
+ setSecurityData: (data: SecurityDataType | null) => void;
37
+ protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
38
+ protected stringifyFormItem(formItem: unknown): string;
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, {}>>;
41
+ }
@@ -0,0 +1,94 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.HttpClient = exports.ContentType = void 0;
17
+ const axios_1 = __importDefault(require("axios"));
18
+ var ContentType;
19
+ (function (ContentType) {
20
+ ContentType["Json"] = "application/json";
21
+ ContentType["FormData"] = "multipart/form-data";
22
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
23
+ ContentType["Text"] = "text/plain";
24
+ })(ContentType = exports.ContentType || (exports.ContentType = {}));
25
+ class HttpClient {
26
+ constructor({ securityWorker, secure, format, ...axiosConfig } = {}) {
27
+ this.securityData = null;
28
+ this.setSecurityData = (data) => {
29
+ this.securityData = data;
30
+ };
31
+ this.request = async ({ secure, path, type, query, format, body, ...params }) => {
32
+ const secureParams = ((typeof secure === 'boolean' ? secure : this.secure) &&
33
+ this.securityWorker &&
34
+ (await this.securityWorker(this.securityData))) ||
35
+ {};
36
+ const requestParams = this.mergeRequestParams(params, secureParams);
37
+ const responseFormat = format || this.format || undefined;
38
+ if (type === ContentType.FormData && body && body !== null && typeof body === 'object') {
39
+ body = this.createFormData(body);
40
+ }
41
+ if (type === ContentType.Text && body && body !== null && typeof body !== 'string') {
42
+ body = JSON.stringify(body);
43
+ }
44
+ return this.instance.request({
45
+ ...requestParams,
46
+ headers: {
47
+ ...(requestParams.headers || {}),
48
+ ...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
49
+ },
50
+ params: query,
51
+ responseType: responseFormat,
52
+ data: body,
53
+ url: path,
54
+ });
55
+ };
56
+ this.instance = axios_1.default.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || 'http://localhost:3002' });
57
+ this.secure = secure;
58
+ this.format = format;
59
+ this.securityWorker = securityWorker;
60
+ }
61
+ mergeRequestParams(params1, params2) {
62
+ const method = params1.method || (params2 && params2.method);
63
+ return {
64
+ ...this.instance.defaults,
65
+ ...params1,
66
+ ...(params2 || {}),
67
+ headers: {
68
+ ...((method && this.instance.defaults.headers[method.toLowerCase()]) || {}),
69
+ ...(params1.headers || {}),
70
+ ...((params2 && params2.headers) || {}),
71
+ },
72
+ };
73
+ }
74
+ stringifyFormItem(formItem) {
75
+ if (typeof formItem === 'object' && formItem !== null) {
76
+ return JSON.stringify(formItem);
77
+ }
78
+ else {
79
+ return `${formItem}`;
80
+ }
81
+ }
82
+ createFormData(input) {
83
+ return Object.keys(input || {}).reduce((formData, key) => {
84
+ const property = input[key];
85
+ const propertyContent = property instanceof Array ? property : [property];
86
+ for (const formItem of propertyContent) {
87
+ const isFileType = formItem instanceof Blob || formItem instanceof File;
88
+ formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
89
+ }
90
+ return formData;
91
+ }, new FormData());
92
+ }
93
+ }
94
+ exports.HttpClient = HttpClient;