@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/README.md ADDED
@@ -0,0 +1,405 @@
1
+ # @fecommunity/reactpress-toolkit
2
+
3
+ TypeScript-based API client toolkit for ReactPress, automatically generated from OpenAPI/Swagger specifications.
4
+
5
+ [![NPM Version](https://img.shields.io/npm/v/@fecommunity/reactpress-toolkit.svg)](https://www.npmjs.com/package/@fecommunity/reactpress-toolkit)
6
+ [![License](https://img.shields.io/npm/l/@fecommunity/reactpress-toolkit.svg)](https://github.com/fecommunity/reactpress/blob/master/toolkit/LICENSE)
7
+ [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
8
+
9
+ ## Overview
10
+
11
+ The ReactPress Toolkit is an API client library that provides strongly-typed interfaces for interacting with the ReactPress backend services. It includes:
12
+
13
+ - **Auto-generated API clients** for all ReactPress modules
14
+ - **TypeScript definitions** for all data contracts
15
+ - **Utility functions** for common operations
16
+ - **HTTP client** with built-in authentication and error handling
17
+ - **Automatic retry mechanisms** for failed requests
18
+ - **Request/response interceptors** for logging
19
+
20
+ The toolkit is automatically generated from the ReactPress backend's OpenAPI specification, ensuring that it's always in sync with the latest API changes. This eliminates manual API client maintenance and reduces the likelihood of API integration errors.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @fecommunity/reactpress-toolkit
26
+ ```
27
+
28
+ or
29
+
30
+ ```bash
31
+ yarn add @fecommunity/reactpress-toolkit
32
+ ```
33
+
34
+ or
35
+
36
+ ```bash
37
+ pnpm add @fecommunity/reactpress-toolkit
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### Using the Default API Instance
43
+
44
+ ```typescript
45
+ import api from '@fecommunity/reactpress-toolkit';
46
+
47
+ // Get all articles
48
+ const articles = await api.article.findAll();
49
+
50
+ // Get a specific article by ID
51
+ const article = await api.article.findById('article-id');
52
+
53
+ // Create a new article
54
+ const newArticle = await api.article.create({
55
+ title: 'My New Article',
56
+ content: 'Article content here...',
57
+ // ... other properties
58
+ });
59
+ ```
60
+
61
+ ### Using Named Exports
62
+
63
+ ```typescript
64
+ import { api, types, utils } from '@fecommunity/reactpress-toolkit';
65
+
66
+ // Working with typed data
67
+ const article: types.IArticle = {
68
+ id: '1',
69
+ title: 'Sample Article',
70
+ // ... other properties
71
+ };
72
+
73
+ // Using utility functions
74
+ const formattedDate = utils.formatDate(new Date());
75
+ ```
76
+
77
+ ## API Modules
78
+
79
+ The toolkit provides clients for all ReactPress backend modules:
80
+
81
+ - `api.article` - Article management
82
+ - `api.auth` - Authentication services
83
+ - `api.category` - Category management
84
+ - `api.comment` - Comment system
85
+ - `api.file` - File management
86
+ - `api.knowledge` - Knowledge base
87
+ - `api.page` - Page management
88
+ - `api.search` - Search functionality
89
+ - `api.setting` - System settings
90
+ - `api.smtp` - SMTP services
91
+ - `api.tag` - Tag management
92
+ - `api.user` - User management
93
+ - `api.view` - View analytics
94
+
95
+ ## Configuration
96
+
97
+ You can create a custom API instance with specific configuration:
98
+
99
+ ```typescript
100
+ import { api } from '@fecommunity/reactpress-toolkit';
101
+
102
+ const customApi = api.createApiInstance({
103
+ baseURL: 'https://api.yourdomain.com',
104
+ timeout: 10000,
105
+ // ... other axios configuration options
106
+ });
107
+
108
+ // Use the custom instance
109
+ const articles = await customApi.article.findAll();
110
+ ```
111
+
112
+ ## Enterprise Features
113
+
114
+ ### Automatic Retry Mechanisms
115
+ ```typescript
116
+ import { api } from '@fecommunity/reactpress-toolkit';
117
+
118
+ // Configure retry settings
119
+ const customApi = api.createApiInstance({
120
+ baseURL: 'https://api.yourdomain.com',
121
+ retry: {
122
+ retries: 3,
123
+ retryDelay: 1000,
124
+ retryCondition: (error) => {
125
+ return error.response?.status === 503 || error.code === 'ECONNABORTED';
126
+ }
127
+ }
128
+ });
129
+ ```
130
+
131
+ ### Request/Response Interceptors
132
+ ```typescript
133
+ import { api } from '@fecommunity/reactpress-toolkit';
134
+
135
+ const monitoredApi = api.createApiInstance({
136
+ baseURL: 'https://api.yourdomain.com',
137
+ interceptors: {
138
+ request: (config) => {
139
+ // Add logging, metrics, etc.
140
+ console.log(`Request: ${config.method?.toUpperCase()} ${config.url}`);
141
+ return config;
142
+ },
143
+ response: (response) => {
144
+ // Add logging, metrics, etc.
145
+ console.log(`Response: ${response.status} ${response.config.url}`);
146
+ return response;
147
+ }
148
+ }
149
+ });
150
+ ```
151
+
152
+ ### Authentication Handling
153
+ ```typescript
154
+ import { api, utils } from '@fecommunity/reactpress-toolkit';
155
+
156
+ // Automatic token refresh
157
+ const secureApi = api.createApiInstance({
158
+ baseURL: 'https://api.yourdomain.com',
159
+ auth: {
160
+ tokenRefresh: async (refreshToken) => {
161
+ const response = await api.auth.refresh({ refreshToken });
162
+ return response.data.accessToken;
163
+ }
164
+ }
165
+ });
166
+ ```
167
+
168
+ ## Type Definitions
169
+
170
+ All data models are strongly typed and available through the `types` export:
171
+
172
+ ```typescript
173
+ import { types } from '@fecommunity/reactpress-toolkit';
174
+
175
+ const user: types.IUser = {
176
+ name: 'John Doe',
177
+ email: 'john@example.com',
178
+ // ... other properties
179
+ };
180
+ ```
181
+
182
+ Available type definitions include:
183
+ - `types.IUser`
184
+ - `types.IArticle`
185
+ - `types.ICategory`
186
+ - `types.ITag`
187
+ - `types.IComment`
188
+ - `types.IFile`
189
+ - `types.ISetting`
190
+ - `types.IPage`
191
+ - `types.IKnowledge`
192
+ - `types.IView`
193
+ - `types.I_SMTP`
194
+
195
+ ## Utility Functions
196
+
197
+ The toolkit includes helpful utility functions:
198
+
199
+ ```typescript
200
+ import { utils } from '@fecommunity/reactpress-toolkit';
201
+
202
+ // Date formatting
203
+ const formattedDate = utils.formatDate(new Date(), 'YYYY-MM-DD');
204
+
205
+ // Deep cloning
206
+ const clonedObject = utils.deepClone(originalObject);
207
+
208
+ // Error handling
209
+ if (utils.ApiError.isInstance(error)) {
210
+ console.log(`API Error: ${error.code} - ${error.message}`);
211
+ }
212
+
213
+ // Data validation
214
+ const isValidEmail = utils.validateEmail('user@example.com');
215
+
216
+ // String manipulation
217
+ const slug = utils.createSlug('My Article Title');
218
+ ```
219
+
220
+ ## Development
221
+
222
+ ### Generating API Definitions
223
+
224
+ The toolkit is automatically generated from the ReactPress backend's OpenAPI specification:
225
+
226
+ ```bash
227
+ npm run generate
228
+ ```
229
+
230
+ This command will:
231
+ 1. Generate a new Swagger JSON from the ReactPress server
232
+ 2. Create TypeScript definitions from the specification
233
+ 3. Organize the generated files into appropriate directories
234
+ 4. Create API clients for each module
235
+
236
+ ### Building
237
+
238
+ ```bash
239
+ npm run build
240
+ ```
241
+
242
+ This will compile the TypeScript code to JavaScript in the `dist` directory.
243
+
244
+ ## Testing
245
+
246
+ ```bash
247
+ # Run unit tests
248
+ npm run test
249
+
250
+ # Run tests with coverage
251
+ npm run test:cov
252
+
253
+ # Run linting
254
+ npm run lint
255
+
256
+ # Run formatting
257
+ npm run format
258
+ ```
259
+
260
+ ## Integration Examples
261
+
262
+ ### React Integration
263
+ ```typescript
264
+ import { useState, useEffect } from 'react';
265
+ import { api, types } from '@fecommunity/reactpress-toolkit';
266
+
267
+ const ArticleList = () => {
268
+ const [articles, setArticles] = useState<types.IArticle[]>([]);
269
+ const [loading, setLoading] = useState(true);
270
+
271
+ useEffect(() => {
272
+ const fetchArticles = async () => {
273
+ try {
274
+ const response = await api.article.findAll();
275
+ setArticles(response.data);
276
+ } catch (error) {
277
+ console.error('Failed to fetch articles:', error);
278
+ } finally {
279
+ setLoading(false);
280
+ }
281
+ };
282
+
283
+ fetchArticles();
284
+ }, []);
285
+
286
+ if (loading) return <div>Loading...</div>;
287
+
288
+ return (
289
+ <div>
290
+ {articles.map(article => (
291
+ <div key={article.id}>
292
+ <h2>{article.title}</h2>
293
+ <p>{article.content}</p>
294
+ </div>
295
+ ))}
296
+ </div>
297
+ );
298
+ };
299
+ ```
300
+
301
+ ### Node.js Integration
302
+ ```typescript
303
+ import { api, types } from '@fecommunity/reactpress-toolkit';
304
+
305
+ async function syncArticles() {
306
+ try {
307
+ // Fetch articles from ReactPress
308
+ const response = await api.article.findAll({
309
+ limit: 100,
310
+ offset: 0
311
+ });
312
+
313
+ // Process articles
314
+ const articles: types.IArticle[] = response.data;
315
+
316
+ // Sync with another system
317
+ for (const article of articles) {
318
+ // Your sync logic here
319
+ console.log(`Synced article: ${article.title}`);
320
+ }
321
+ } catch (error) {
322
+ console.error('Sync failed:', error);
323
+ }
324
+ }
325
+
326
+ syncArticles();
327
+ ```
328
+
329
+ ## Best Practices
330
+
331
+ ### Error Handling
332
+ ```typescript
333
+ import { api, utils } from '@fecommunity/reactpress-toolkit';
334
+
335
+ try {
336
+ const articles = await api.article.findAll();
337
+ // Process articles
338
+ } catch (error) {
339
+ if (utils.ApiError.isInstance(error)) {
340
+ switch (error.code) {
341
+ case 401:
342
+ // Handle unauthorized access
343
+ redirectToLogin();
344
+ break;
345
+ case 403:
346
+ // Handle forbidden access
347
+ showPermissionError();
348
+ break;
349
+ case 500:
350
+ // Handle server errors
351
+ showServerError();
352
+ break;
353
+ default:
354
+ // Handle other API errors
355
+ showGenericError(error.message);
356
+ }
357
+ } else {
358
+ // Handle network errors
359
+ showNetworkError();
360
+ }
361
+ }
362
+ ```
363
+
364
+ ### Pagination
365
+ ```typescript
366
+ import { api, types } from '@fecommunity/reactpress-toolkit';
367
+
368
+ async function fetchAllArticles(): Promise<types.IArticle[]> {
369
+ const allArticles: types.IArticle[] = [];
370
+ let offset = 0;
371
+ const limit = 50;
372
+
373
+ while (true) {
374
+ const response = await api.article.findAll({ limit, offset });
375
+ allArticles.push(...response.data);
376
+
377
+ if (response.data.length < limit) {
378
+ // No more articles to fetch
379
+ break;
380
+ }
381
+
382
+ offset += limit;
383
+ }
384
+
385
+ return allArticles;
386
+ }
387
+ ```
388
+
389
+ ## Contributing
390
+
391
+ 1. Fork the repository
392
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
393
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
394
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
395
+ 5. Open a pull request
396
+
397
+ ## License
398
+
399
+ ISC
400
+
401
+ ## Related Projects
402
+
403
+ - [ReactPress](https://github.com/fecommunity/reactpress) - The main ReactPress platform
404
+ - [ReactPress Server](https://github.com/fecommunity/reactpress/server) - Backend server
405
+ - [ReactPress Client](https://github.com/fecommunity/reactpress/client) - Frontend client
@@ -0,0 +1,121 @@
1
+ import { IArticleControllerCreateData } from './data-contracts';
2
+ import { HttpClient, RequestParams } from './HttpClient';
3
+ export declare class Article<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
+ /**
5
+ * No description
6
+ *
7
+ * @tags Article
8
+ * @name ArticleControllerCreate
9
+ * @request POST:/article
10
+ * @response `200` `IArticleControllerCreateData` 创建文章
11
+ */
12
+ articleControllerCreate: (params?: RequestParams) => Promise<import("axios").AxiosResponse<IArticleControllerCreateData, any, {}>>;
13
+ /**
14
+ * No description
15
+ *
16
+ * @tags Article
17
+ * @name ArticleControllerFindAll
18
+ * @request GET:/article
19
+ * @response `200` `IArticleControllerFindAllData`
20
+ */
21
+ articleControllerFindAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
22
+ /**
23
+ * No description
24
+ *
25
+ * @tags Article
26
+ * @name ArticleControllerFindArticlesByCategory
27
+ * @request GET:/article/category/{id}
28
+ * @response `200` `IArticleControllerFindArticlesByCategoryData`
29
+ */
30
+ articleControllerFindArticlesByCategory: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Article
35
+ * @name ArticleControllerFindArticlesByTag
36
+ * @request GET:/article/tag/{id}
37
+ * @response `200` `IArticleControllerFindArticlesByTagData`
38
+ */
39
+ articleControllerFindArticlesByTag: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
40
+ /**
41
+ * No description
42
+ *
43
+ * @tags Article
44
+ * @name ArticleControllerGetRecommendArticles
45
+ * @request GET:/article/all/recommend
46
+ * @response `200` `IArticleControllerGetRecommendArticlesData`
47
+ */
48
+ articleControllerGetRecommendArticles: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
49
+ /**
50
+ * No description
51
+ *
52
+ * @tags Article
53
+ * @name ArticleControllerGetArchives
54
+ * @request GET:/article/archives
55
+ * @response `200` `IArticleControllerGetArchivesData`
56
+ */
57
+ articleControllerGetArchives: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
58
+ /**
59
+ * No description
60
+ *
61
+ * @tags Article
62
+ * @name ArticleControllerRecommend
63
+ * @request GET:/article/recommend
64
+ * @response `200` `IArticleControllerRecommendData`
65
+ */
66
+ articleControllerRecommend: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
67
+ /**
68
+ * No description
69
+ *
70
+ * @tags Article
71
+ * @name ArticleControllerFindById
72
+ * @request GET:/article/{id}
73
+ * @response `200` `IArticleControllerFindByIdData`
74
+ */
75
+ articleControllerFindById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
76
+ /**
77
+ * No description
78
+ *
79
+ * @tags Article
80
+ * @name ArticleControllerUpdateById
81
+ * @request PATCH:/article/{id}
82
+ * @response `200` `IArticleControllerUpdateByIdData`
83
+ */
84
+ articleControllerUpdateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
85
+ /**
86
+ * No description
87
+ *
88
+ * @tags Article
89
+ * @name ArticleControllerDeleteById
90
+ * @request DELETE:/article/{id}
91
+ * @response `200` `IArticleControllerDeleteByIdData`
92
+ */
93
+ articleControllerDeleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
94
+ /**
95
+ * No description
96
+ *
97
+ * @tags Article
98
+ * @name ArticleControllerCheckPassword
99
+ * @request POST:/article/{id}/checkPassword
100
+ * @response `200` `IArticleControllerCheckPasswordData`
101
+ */
102
+ articleControllerCheckPassword: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
103
+ /**
104
+ * No description
105
+ *
106
+ * @tags Article
107
+ * @name ArticleControllerUpdateViewsById
108
+ * @request POST:/article/{id}/views
109
+ * @response `200` `IArticleControllerUpdateViewsByIdData`
110
+ */
111
+ articleControllerUpdateViewsById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
112
+ /**
113
+ * No description
114
+ *
115
+ * @tags Article
116
+ * @name ArticleControllerUpdateLikesById
117
+ * @request POST:/article/{id}/likes
118
+ * @response `200` `IArticleControllerUpdateLikesByIdData`
119
+ */
120
+ articleControllerUpdateLikesById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
121
+ }
@@ -0,0 +1,189 @@
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.Article = void 0;
14
+ const HttpClient_1 = require("./HttpClient");
15
+ class Article extends HttpClient_1.HttpClient {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * No description
20
+ *
21
+ * @tags Article
22
+ * @name ArticleControllerCreate
23
+ * @request POST:/article
24
+ * @response `200` `IArticleControllerCreateData` 创建文章
25
+ */
26
+ this.articleControllerCreate = (params = {}) => this.request({
27
+ path: `/article`,
28
+ method: 'POST',
29
+ ...params,
30
+ });
31
+ /**
32
+ * No description
33
+ *
34
+ * @tags Article
35
+ * @name ArticleControllerFindAll
36
+ * @request GET:/article
37
+ * @response `200` `IArticleControllerFindAllData`
38
+ */
39
+ this.articleControllerFindAll = (params = {}) => this.request({
40
+ path: `/article`,
41
+ method: 'GET',
42
+ ...params,
43
+ });
44
+ /**
45
+ * No description
46
+ *
47
+ * @tags Article
48
+ * @name ArticleControllerFindArticlesByCategory
49
+ * @request GET:/article/category/{id}
50
+ * @response `200` `IArticleControllerFindArticlesByCategoryData`
51
+ */
52
+ this.articleControllerFindArticlesByCategory = (id, params = {}) => this.request({
53
+ path: `/article/category/${id}`,
54
+ method: 'GET',
55
+ ...params,
56
+ });
57
+ /**
58
+ * No description
59
+ *
60
+ * @tags Article
61
+ * @name ArticleControllerFindArticlesByTag
62
+ * @request GET:/article/tag/{id}
63
+ * @response `200` `IArticleControllerFindArticlesByTagData`
64
+ */
65
+ this.articleControllerFindArticlesByTag = (id, params = {}) => this.request({
66
+ path: `/article/tag/${id}`,
67
+ method: 'GET',
68
+ ...params,
69
+ });
70
+ /**
71
+ * No description
72
+ *
73
+ * @tags Article
74
+ * @name ArticleControllerGetRecommendArticles
75
+ * @request GET:/article/all/recommend
76
+ * @response `200` `IArticleControllerGetRecommendArticlesData`
77
+ */
78
+ this.articleControllerGetRecommendArticles = (params = {}) => this.request({
79
+ path: `/article/all/recommend`,
80
+ method: 'GET',
81
+ ...params,
82
+ });
83
+ /**
84
+ * No description
85
+ *
86
+ * @tags Article
87
+ * @name ArticleControllerGetArchives
88
+ * @request GET:/article/archives
89
+ * @response `200` `IArticleControllerGetArchivesData`
90
+ */
91
+ this.articleControllerGetArchives = (params = {}) => this.request({
92
+ path: `/article/archives`,
93
+ method: 'GET',
94
+ ...params,
95
+ });
96
+ /**
97
+ * No description
98
+ *
99
+ * @tags Article
100
+ * @name ArticleControllerRecommend
101
+ * @request GET:/article/recommend
102
+ * @response `200` `IArticleControllerRecommendData`
103
+ */
104
+ this.articleControllerRecommend = (params = {}) => this.request({
105
+ path: `/article/recommend`,
106
+ method: 'GET',
107
+ ...params,
108
+ });
109
+ /**
110
+ * No description
111
+ *
112
+ * @tags Article
113
+ * @name ArticleControllerFindById
114
+ * @request GET:/article/{id}
115
+ * @response `200` `IArticleControllerFindByIdData`
116
+ */
117
+ this.articleControllerFindById = (id, params = {}) => this.request({
118
+ path: `/article/${id}`,
119
+ method: 'GET',
120
+ ...params,
121
+ });
122
+ /**
123
+ * No description
124
+ *
125
+ * @tags Article
126
+ * @name ArticleControllerUpdateById
127
+ * @request PATCH:/article/{id}
128
+ * @response `200` `IArticleControllerUpdateByIdData`
129
+ */
130
+ this.articleControllerUpdateById = (id, params = {}) => this.request({
131
+ path: `/article/${id}`,
132
+ method: 'PATCH',
133
+ ...params,
134
+ });
135
+ /**
136
+ * No description
137
+ *
138
+ * @tags Article
139
+ * @name ArticleControllerDeleteById
140
+ * @request DELETE:/article/{id}
141
+ * @response `200` `IArticleControllerDeleteByIdData`
142
+ */
143
+ this.articleControllerDeleteById = (id, params = {}) => this.request({
144
+ path: `/article/${id}`,
145
+ method: 'DELETE',
146
+ ...params,
147
+ });
148
+ /**
149
+ * No description
150
+ *
151
+ * @tags Article
152
+ * @name ArticleControllerCheckPassword
153
+ * @request POST:/article/{id}/checkPassword
154
+ * @response `200` `IArticleControllerCheckPasswordData`
155
+ */
156
+ this.articleControllerCheckPassword = (id, params = {}) => this.request({
157
+ path: `/article/${id}/checkPassword`,
158
+ method: 'POST',
159
+ ...params,
160
+ });
161
+ /**
162
+ * No description
163
+ *
164
+ * @tags Article
165
+ * @name ArticleControllerUpdateViewsById
166
+ * @request POST:/article/{id}/views
167
+ * @response `200` `IArticleControllerUpdateViewsByIdData`
168
+ */
169
+ this.articleControllerUpdateViewsById = (id, params = {}) => this.request({
170
+ path: `/article/${id}/views`,
171
+ method: 'POST',
172
+ ...params,
173
+ });
174
+ /**
175
+ * No description
176
+ *
177
+ * @tags Article
178
+ * @name ArticleControllerUpdateLikesById
179
+ * @request POST:/article/{id}/likes
180
+ * @response `200` `IArticleControllerUpdateLikesByIdData`
181
+ */
182
+ this.articleControllerUpdateLikesById = (id, params = {}) => this.request({
183
+ path: `/article/${id}/likes`,
184
+ method: 'POST',
185
+ ...params,
186
+ });
187
+ }
188
+ }
189
+ exports.Article = Article;