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

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 (124) hide show
  1. package/README.md +190 -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 +11 -11
  33. package/dist/api/Article.js +12 -12
  34. package/dist/api/ArticleRoute.d.ts +201 -0
  35. package/dist/api/ArticleRoute.js +12 -0
  36. package/dist/api/Auth.d.ts +5 -5
  37. package/dist/api/Auth.js +6 -6
  38. package/dist/api/AuthRoute.d.ts +44 -0
  39. package/dist/api/AuthRoute.js +12 -0
  40. package/dist/api/Category.d.ts +1 -1
  41. package/dist/api/Category.js +2 -2
  42. package/dist/api/CategoryRoute.d.ts +79 -0
  43. package/dist/api/CategoryRoute.js +12 -0
  44. package/dist/api/Comment.d.ts +3 -3
  45. package/dist/api/Comment.js +4 -4
  46. package/dist/api/CommentRoute.d.ts +95 -0
  47. package/dist/api/CommentRoute.js +12 -0
  48. package/dist/api/File.d.ts +3 -3
  49. package/dist/api/File.js +4 -4
  50. package/dist/api/FileRoute.d.ts +63 -0
  51. package/dist/api/FileRoute.js +12 -0
  52. package/dist/api/Knowledge.d.ts +5 -5
  53. package/dist/api/Knowledge.js +6 -6
  54. package/dist/api/KnowledgeRoute.d.ts +125 -0
  55. package/dist/api/KnowledgeRoute.js +12 -0
  56. package/dist/api/Page.d.ts +3 -3
  57. package/dist/api/Page.js +4 -4
  58. package/dist/api/PageRoute.d.ts +95 -0
  59. package/dist/api/PageRoute.js +12 -0
  60. package/dist/api/Search.d.ts +3 -3
  61. package/dist/api/Search.js +4 -4
  62. package/dist/api/SearchRoute.d.ts +46 -0
  63. package/dist/api/SearchRoute.js +12 -0
  64. package/dist/api/Setting.d.ts +3 -3
  65. package/dist/api/Setting.js +4 -4
  66. package/dist/api/SettingRoute.d.ts +31 -0
  67. package/dist/api/SettingRoute.js +12 -0
  68. package/dist/api/Smtp.d.ts +1 -1
  69. package/dist/api/Smtp.js +2 -2
  70. package/dist/api/SmtpRoute.d.ts +47 -0
  71. package/dist/api/SmtpRoute.js +12 -0
  72. package/dist/api/Tag.d.ts +3 -3
  73. package/dist/api/Tag.js +4 -4
  74. package/dist/api/TagRoute.d.ts +95 -0
  75. package/dist/api/TagRoute.js +12 -0
  76. package/dist/api/User.d.ts +7 -7
  77. package/dist/api/User.js +8 -8
  78. package/dist/api/UserRoute.d.ts +60 -0
  79. package/dist/api/UserRoute.js +12 -0
  80. package/dist/api/View.d.ts +3 -3
  81. package/dist/api/View.js +4 -4
  82. package/dist/api/ViewRoute.d.ts +77 -0
  83. package/dist/api/ViewRoute.js +12 -0
  84. package/dist/api/httpClient.d.ts +1 -0
  85. package/dist/api/httpClient.js +1 -0
  86. package/dist/api/index.d.ts +5 -5
  87. package/dist/api/index.js +6 -7
  88. package/dist/data-contracts.d.ts +245 -0
  89. package/dist/data-contracts.js +12 -0
  90. package/dist/index.d.ts +5 -9
  91. package/dist/index.js +14 -15
  92. package/dist/utils/common.d.ts +1 -3
  93. package/dist/utils/common.js +5 -31
  94. package/dist/utils/http.js +4 -6
  95. package/package.json +5 -3
  96. package/demos/simple.ts +0 -65
  97. package/scripts/generate-api-types.js +0 -571
  98. package/scripts/generate-swagger.js +0 -47
  99. package/scripts/organize-api.js +0 -136
  100. package/src/api/Article.ts +0 -186
  101. package/src/api/Auth.ts +0 -54
  102. package/src/api/Category.ts +0 -82
  103. package/src/api/Comment.ts +0 -95
  104. package/src/api/File.ts +0 -69
  105. package/src/api/Knowledge.ts +0 -122
  106. package/src/api/Page.ts +0 -95
  107. package/src/api/Search.ts +0 -54
  108. package/src/api/Setting.ts +0 -43
  109. package/src/api/Smtp.ts +0 -56
  110. package/src/api/Tag.ts +0 -95
  111. package/src/api/User.ts +0 -72
  112. package/src/api/View.ts +0 -82
  113. package/src/api/api-instance.ts +0 -69
  114. package/src/api/httpClient.ts +0 -140
  115. package/src/api/index.ts +0 -25
  116. package/src/index.ts +0 -18
  117. package/src/types/data-contracts.ts +0 -198
  118. package/src/types/index.ts +0 -4
  119. package/src/utils/common.ts +0 -108
  120. package/src/utils/http.ts +0 -52
  121. package/src/utils/index.ts +0 -5
  122. package/test-final.js +0 -56
  123. package/test-import.js +0 -34
  124. package/tsconfig.json +0 -20
@@ -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;
@@ -0,0 +1,76 @@
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
+ }