@fecommunity/reactpress-toolkit 1.0.0 → 3.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 (116) hide show
  1. package/README.md +9 -27
  2. package/dist/config/env.d.ts +1 -0
  3. package/dist/config/env.js +89 -0
  4. package/dist/config/global.d.ts +34 -0
  5. package/dist/config/global.js +390 -0
  6. package/dist/config/i18n.d.ts +4 -0
  7. package/dist/config/i18n.js +43 -0
  8. package/dist/config/index.d.ts +15 -0
  9. package/dist/config/index.js +25 -0
  10. package/dist/index.d.ts +11 -5
  11. package/dist/index.js +17 -20
  12. package/dist/locales/en.json +97 -0
  13. package/dist/locales/zh.json +97 -0
  14. package/package.json +15 -3
  15. package/dist/Article.d.ts +0 -121
  16. package/dist/Article.js +0 -189
  17. package/dist/Auth.d.ts +0 -30
  18. package/dist/Auth.js +0 -59
  19. package/dist/Category.d.ts +0 -49
  20. package/dist/Category.js +0 -85
  21. package/dist/Comment.d.ts +0 -58
  22. package/dist/Comment.js +0 -98
  23. package/dist/File.d.ts +0 -40
  24. package/dist/File.js +0 -72
  25. package/dist/HttpClient.d.ts +0 -41
  26. package/dist/HttpClient.js +0 -94
  27. package/dist/Knowledge.d.ts +0 -76
  28. package/dist/Knowledge.js +0 -124
  29. package/dist/Page.d.ts +0 -58
  30. package/dist/Page.js +0 -98
  31. package/dist/Search.d.ts +0 -30
  32. package/dist/Search.js +0 -59
  33. package/dist/Setting.d.ts +0 -22
  34. package/dist/Setting.js +0 -46
  35. package/dist/Smtp.d.ts +0 -31
  36. package/dist/Smtp.js +0 -59
  37. package/dist/Tag.d.ts +0 -58
  38. package/dist/Tag.js +0 -98
  39. package/dist/User.d.ts +0 -41
  40. package/dist/User.js +0 -73
  41. package/dist/View.d.ts +0 -49
  42. package/dist/View.js +0 -85
  43. package/dist/api/Admin.d.ts +0 -14
  44. package/dist/api/Admin.js +0 -32
  45. package/dist/api/All.d.ts +0 -14
  46. package/dist/api/All.js +0 -32
  47. package/dist/api/ApiInstance.d.ts +0 -39
  48. package/dist/api/ApiInstance.js +0 -46
  49. package/dist/api/Archives.d.ts +0 -14
  50. package/dist/api/Archives.js +0 -32
  51. package/dist/api/ArticleRoute.d.ts +0 -201
  52. package/dist/api/ArticleRoute.js +0 -12
  53. package/dist/api/AuthRoute.d.ts +0 -44
  54. package/dist/api/AuthRoute.js +0 -12
  55. package/dist/api/Book.d.ts +0 -15
  56. package/dist/api/Book.js +0 -33
  57. package/dist/api/CategoryRoute.d.ts +0 -79
  58. package/dist/api/CategoryRoute.js +0 -12
  59. package/dist/api/Chapter.d.ts +0 -15
  60. package/dist/api/Chapter.js +0 -33
  61. package/dist/api/CommentRoute.d.ts +0 -95
  62. package/dist/api/CommentRoute.js +0 -12
  63. package/dist/api/FileRoute.d.ts +0 -63
  64. package/dist/api/FileRoute.js +0 -12
  65. package/dist/api/Get.d.ts +0 -14
  66. package/dist/api/Get.js +0 -32
  67. package/dist/api/Github.d.ts +0 -14
  68. package/dist/api/Github.js +0 -32
  69. package/dist/api/Host.d.ts +0 -14
  70. package/dist/api/Host.js +0 -32
  71. package/dist/api/Id.d.ts +0 -284
  72. package/dist/api/Id.js +0 -422
  73. package/dist/api/KnowledgeRoute.d.ts +0 -125
  74. package/dist/api/KnowledgeRoute.js +0 -12
  75. package/dist/api/Login.d.ts +0 -14
  76. package/dist/api/Login.js +0 -32
  77. package/dist/api/PageRoute.d.ts +0 -95
  78. package/dist/api/PageRoute.js +0 -12
  79. package/dist/api/Password.d.ts +0 -15
  80. package/dist/api/Password.js +0 -33
  81. package/dist/api/Recommend.d.ts +0 -14
  82. package/dist/api/Recommend.js +0 -32
  83. package/dist/api/Register.d.ts +0 -15
  84. package/dist/api/Register.js +0 -33
  85. package/dist/api/SearchRoute.d.ts +0 -46
  86. package/dist/api/SearchRoute.js +0 -12
  87. package/dist/api/SettingRoute.d.ts +0 -31
  88. package/dist/api/SettingRoute.js +0 -12
  89. package/dist/api/SmtpRoute.d.ts +0 -47
  90. package/dist/api/SmtpRoute.js +0 -12
  91. package/dist/api/TagRoute.d.ts +0 -95
  92. package/dist/api/TagRoute.js +0 -12
  93. package/dist/api/Update.d.ts +0 -15
  94. package/dist/api/Update.js +0 -33
  95. package/dist/api/Upload.d.ts +0 -15
  96. package/dist/api/Upload.js +0 -33
  97. package/dist/api/Url.d.ts +0 -14
  98. package/dist/api/Url.js +0 -32
  99. package/dist/api/UserRoute.d.ts +0 -60
  100. package/dist/api/UserRoute.js +0 -12
  101. package/dist/api/ViewRoute.d.ts +0 -77
  102. package/dist/api/ViewRoute.js +0 -12
  103. package/dist/api/api-instance.d.ts +0 -39
  104. package/dist/api/api-instance.js +0 -46
  105. package/dist/api/http-client.d.ts +0 -41
  106. package/dist/api/http-client.js +0 -94
  107. package/dist/data-contracts.d.ts +0 -245
  108. package/dist/data-contracts.js +0 -12
  109. package/dist/types/data-contracts.d.ts +0 -177
  110. package/dist/types/data-contracts.js +0 -12
  111. package/dist/utils/common.d.ts +0 -21
  112. package/dist/utils/common.js +0 -52
  113. package/dist/utils/http.d.ts +0 -3
  114. package/dist/utils/http.js +0 -45
  115. /package/dist/api/{httpClient.d.ts → HttpClient.d.ts} +0 -0
  116. /package/dist/api/{httpClient.js → HttpClient.js} +0 -0
package/dist/Auth.js DELETED
@@ -1,59 +0,0 @@
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;
@@ -1,49 +0,0 @@
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
- }
package/dist/Category.js DELETED
@@ -1,85 +0,0 @@
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;
package/dist/Comment.d.ts DELETED
@@ -1,58 +0,0 @@
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
- }
package/dist/Comment.js DELETED
@@ -1,98 +0,0 @@
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 DELETED
@@ -1,40 +0,0 @@
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 DELETED
@@ -1,72 +0,0 @@
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;
@@ -1,41 +0,0 @@
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
- }
@@ -1,94 +0,0 @@
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;
@@ -1,76 +0,0 @@
1
- import { IKnowledgeControllerCreateBookData, IKnowledgeControllerCreateChapterData } from './data-contracts';
2
- import { HttpClient, RequestParams } from './HttpClient';
3
- export declare class Knowledge<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
- /**
5
- * No description
6
- *
7
- * @tags Knowledge
8
- * @name KnowledgeControllerCreateBook
9
- * @request POST:/Knowledge/book
10
- * @response `200` `IKnowledgeControllerCreateBookData` 创建知识库
11
- */
12
- knowledgeControllerCreateBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IKnowledgeControllerCreateBookData, any, {}>>;
13
- /**
14
- * No description
15
- *
16
- * @tags Knowledge
17
- * @name KnowledgeControllerCreateChapter
18
- * @request POST:/Knowledge/chapter
19
- * @response `200` `IKnowledgeControllerCreateChapterData` 创建知识章节
20
- */
21
- knowledgeControllerCreateChapter: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IKnowledgeControllerCreateChapterData, any, {}>>;
22
- /**
23
- * No description
24
- *
25
- * @tags Knowledge
26
- * @name KnowledgeControllerDeleteById
27
- * @request DELETE:/Knowledge/{id}
28
- * @response `200` `IKnowledgeControllerDeleteByIdData`
29
- */
30
- knowledgeControllerDeleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
31
- /**
32
- * No description
33
- *
34
- * @tags Knowledge
35
- * @name KnowledgeControllerUpdateById
36
- * @request PATCH:/Knowledge/{id}
37
- * @response `200` `IKnowledgeControllerUpdateByIdData`
38
- */
39
- knowledgeControllerUpdateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
40
- /**
41
- * No description
42
- *
43
- * @tags Knowledge
44
- * @name KnowledgeControllerFindById
45
- * @request GET:/Knowledge/{id}
46
- * @response `200` `IKnowledgeControllerFindByIdData`
47
- */
48
- knowledgeControllerFindById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
49
- /**
50
- * No description
51
- *
52
- * @tags Knowledge
53
- * @name KnowledgeControllerFindAll
54
- * @request GET:/Knowledge
55
- * @response `200` `IKnowledgeControllerFindAllData`
56
- */
57
- knowledgeControllerFindAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
58
- /**
59
- * No description
60
- *
61
- * @tags Knowledge
62
- * @name KnowledgeControllerUpdateViewsById
63
- * @request POST:/Knowledge/{id}/views
64
- * @response `200` `IKnowledgeControllerUpdateViewsByIdData`
65
- */
66
- knowledgeControllerUpdateViewsById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
67
- /**
68
- * No description
69
- *
70
- * @tags Knowledge
71
- * @name KnowledgeControllerUpdateLikesById
72
- * @request POST:/Knowledge/{id}/likes
73
- * @response `200` `IKnowledgeControllerUpdateLikesByIdData`
74
- */
75
- knowledgeControllerUpdateLikesById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
76
- }