@fecommunity/reactpress-toolkit 1.0.0-beta.1 → 1.0.0-beta.3
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.
- package/README.md +405 -0
- package/dist/api/Article.d.ts +44 -29
- package/dist/api/Article.js +42 -31
- package/dist/api/Auth.d.ts +11 -6
- package/dist/api/Auth.js +10 -8
- package/dist/api/Category.d.ts +20 -13
- package/dist/api/Category.js +18 -15
- package/dist/api/Comment.d.ts +22 -14
- package/dist/api/Comment.js +20 -16
- package/dist/api/File.d.ts +16 -10
- package/dist/api/File.js +14 -12
- package/dist/api/{http-client.d.ts → HttpClient.d.ts} +2 -2
- package/dist/api/{http-client.js → HttpClient.js} +4 -2
- package/dist/api/Knowledge.d.ts +29 -19
- package/dist/api/Knowledge.js +27 -22
- package/dist/api/Page.d.ts +23 -15
- package/dist/api/Page.js +21 -17
- package/dist/api/Search.d.ts +12 -7
- package/dist/api/Search.js +11 -9
- package/dist/api/Setting.d.ts +10 -6
- package/dist/api/Setting.js +8 -8
- package/dist/api/Smtp.d.ts +14 -9
- package/dist/api/Smtp.js +12 -11
- package/dist/api/Tag.d.ts +22 -14
- package/dist/api/Tag.js +20 -16
- package/dist/api/User.d.ts +15 -8
- package/dist/api/User.js +13 -13
- package/dist/api/View.d.ts +19 -12
- package/dist/api/View.js +17 -14
- package/dist/api/index.d.ts +13 -18
- package/dist/api/index.js +28 -41
- package/dist/api/instance.d.ts +47 -0
- package/dist/api/instance.js +71 -0
- package/dist/config/env.d.ts +1 -0
- package/dist/config/env.js +93 -0
- package/dist/config/global.d.ts +34 -0
- package/dist/config/global.js +382 -0
- package/dist/config/i18n.d.ts +5 -0
- package/dist/config/i18n.js +47 -0
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.js +30 -0
- package/dist/index.d.ts +8 -9
- package/dist/index.js +20 -18
- package/dist/locales/en.json +97 -0
- package/dist/locales/zh.json +97 -0
- package/dist/types/index.d.ts +245 -1
- package/dist/types/index.js +10 -17
- package/dist/utils/index.d.ts +33 -2
- package/dist/utils/index.js +57 -18
- package/package.json +15 -6
- package/demos/simple.ts +0 -65
- package/dist/api/Admin.d.ts +0 -14
- package/dist/api/Admin.js +0 -32
- package/dist/api/All.d.ts +0 -14
- package/dist/api/All.js +0 -32
- package/dist/api/Archives.d.ts +0 -14
- package/dist/api/Archives.js +0 -32
- package/dist/api/Book.d.ts +0 -15
- package/dist/api/Book.js +0 -33
- package/dist/api/Chapter.d.ts +0 -15
- package/dist/api/Chapter.js +0 -33
- package/dist/api/Get.d.ts +0 -14
- package/dist/api/Get.js +0 -32
- package/dist/api/Github.d.ts +0 -14
- package/dist/api/Github.js +0 -32
- package/dist/api/Host.d.ts +0 -14
- package/dist/api/Host.js +0 -32
- package/dist/api/Id.d.ts +0 -284
- package/dist/api/Id.js +0 -422
- package/dist/api/Login.d.ts +0 -14
- package/dist/api/Login.js +0 -32
- package/dist/api/Password.d.ts +0 -15
- package/dist/api/Password.js +0 -33
- package/dist/api/Recommend.d.ts +0 -14
- package/dist/api/Recommend.js +0 -32
- package/dist/api/Register.d.ts +0 -15
- package/dist/api/Register.js +0 -33
- package/dist/api/Update.d.ts +0 -15
- package/dist/api/Update.js +0 -33
- package/dist/api/Upload.d.ts +0 -15
- package/dist/api/Upload.js +0 -33
- package/dist/api/Url.d.ts +0 -14
- package/dist/api/Url.js +0 -32
- package/dist/api/api-instance.d.ts +0 -39
- package/dist/api/api-instance.js +0 -46
- package/dist/api/httpClient.d.ts +0 -41
- package/dist/api/httpClient.js +0 -94
- package/dist/types/data-contracts.d.ts +0 -177
- package/dist/types/data-contracts.js +0 -12
- package/dist/utils/common.d.ts +0 -23
- package/dist/utils/common.js +0 -78
- package/dist/utils/http.d.ts +0 -3
- package/dist/utils/http.js +0 -47
- package/scripts/generate-api-types.js +0 -571
- package/scripts/generate-swagger.js +0 -47
- package/scripts/organize-api.js +0 -136
- package/src/api/Article.ts +0 -186
- package/src/api/Auth.ts +0 -54
- package/src/api/Category.ts +0 -82
- package/src/api/Comment.ts +0 -95
- package/src/api/File.ts +0 -69
- package/src/api/Knowledge.ts +0 -122
- package/src/api/Page.ts +0 -95
- package/src/api/Search.ts +0 -54
- package/src/api/Setting.ts +0 -43
- package/src/api/Smtp.ts +0 -56
- package/src/api/Tag.ts +0 -95
- package/src/api/User.ts +0 -72
- package/src/api/View.ts +0 -82
- package/src/api/api-instance.ts +0 -69
- package/src/api/httpClient.ts +0 -140
- package/src/api/index.ts +0 -25
- package/src/index.ts +0 -18
- package/src/types/data-contracts.ts +0 -198
- package/src/types/index.ts +0 -4
- package/src/utils/common.ts +0 -108
- package/src/utils/http.ts +0 -52
- package/src/utils/index.ts +0 -5
- package/test-final.js +0 -56
- package/test-import.js +0 -34
- 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
|
+
[](https://www.npmjs.com/package/@fecommunity/reactpress-toolkit)
|
|
6
|
+
[](https://github.com/fecommunity/reactpress/blob/master/toolkit/LICENSE)
|
|
7
|
+
[](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
|
package/dist/api/Article.d.ts
CHANGED
|
@@ -1,108 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HttpClient, RequestParams } from './
|
|
3
|
-
export declare class Article<SecurityDataType = unknown>
|
|
1
|
+
import { IArticleControllerCreateData } from '../types';
|
|
2
|
+
import { HttpClient, RequestParams } from './HttpClient';
|
|
3
|
+
export declare class Article<SecurityDataType = unknown> {
|
|
4
|
+
http: HttpClient<SecurityDataType>;
|
|
5
|
+
constructor(http: HttpClient<SecurityDataType>);
|
|
4
6
|
/**
|
|
5
7
|
* No description
|
|
6
8
|
*
|
|
7
9
|
* @tags Article
|
|
8
|
-
* @name
|
|
10
|
+
* @name ArticleControllerCreate
|
|
9
11
|
* @request POST:/article
|
|
12
|
+
* @response `200` `IArticleControllerCreateData` 创建文章
|
|
10
13
|
*/
|
|
11
|
-
create: (params?: RequestParams) => Promise<
|
|
14
|
+
create: (params?: RequestParams) => Promise<IArticleControllerCreateData>;
|
|
12
15
|
/**
|
|
13
16
|
* No description
|
|
14
17
|
*
|
|
15
18
|
* @tags Article
|
|
16
|
-
* @name
|
|
19
|
+
* @name ArticleControllerFindAll
|
|
17
20
|
* @request GET:/article
|
|
21
|
+
* @response `200` `IArticleControllerFindAllData`
|
|
18
22
|
*/
|
|
19
|
-
findAll: (params?: RequestParams) => Promise<
|
|
23
|
+
findAll: (params?: RequestParams) => Promise<any>;
|
|
20
24
|
/**
|
|
21
25
|
* No description
|
|
22
26
|
*
|
|
23
27
|
* @tags Article
|
|
24
|
-
* @name
|
|
28
|
+
* @name ArticleControllerFindArticlesByCategory
|
|
25
29
|
* @request GET:/article/category/{id}
|
|
30
|
+
* @response `200` `IArticleControllerFindArticlesByCategoryData`
|
|
26
31
|
*/
|
|
27
|
-
|
|
32
|
+
findArticlesByCategory: (id: string, params?: RequestParams) => Promise<any>;
|
|
28
33
|
/**
|
|
29
34
|
* No description
|
|
30
35
|
*
|
|
31
36
|
* @tags Article
|
|
32
|
-
* @name
|
|
37
|
+
* @name ArticleControllerFindArticlesByTag
|
|
33
38
|
* @request GET:/article/tag/{id}
|
|
39
|
+
* @response `200` `IArticleControllerFindArticlesByTagData`
|
|
34
40
|
*/
|
|
35
|
-
|
|
41
|
+
findArticlesByTag: (id: string, params?: RequestParams) => Promise<any>;
|
|
36
42
|
/**
|
|
37
43
|
* No description
|
|
38
44
|
*
|
|
39
45
|
* @tags Article
|
|
40
|
-
* @name
|
|
46
|
+
* @name ArticleControllerGetRecommendArticles
|
|
41
47
|
* @request GET:/article/all/recommend
|
|
48
|
+
* @response `200` `IArticleControllerGetRecommendArticlesData`
|
|
42
49
|
*/
|
|
43
|
-
|
|
50
|
+
getRecommendArticles: (params?: RequestParams) => Promise<any>;
|
|
44
51
|
/**
|
|
45
52
|
* No description
|
|
46
53
|
*
|
|
47
54
|
* @tags Article
|
|
48
|
-
* @name
|
|
55
|
+
* @name ArticleControllerGetArchives
|
|
49
56
|
* @request GET:/article/archives
|
|
57
|
+
* @response `200` `IArticleControllerGetArchivesData`
|
|
50
58
|
*/
|
|
51
|
-
getArchives: (params?: RequestParams) => Promise<
|
|
59
|
+
getArchives: (params?: RequestParams) => Promise<any>;
|
|
52
60
|
/**
|
|
53
61
|
* No description
|
|
54
62
|
*
|
|
55
63
|
* @tags Article
|
|
56
|
-
* @name
|
|
64
|
+
* @name ArticleControllerRecommend
|
|
57
65
|
* @request GET:/article/recommend
|
|
66
|
+
* @response `200` `IArticleControllerRecommendData`
|
|
58
67
|
*/
|
|
59
|
-
recommend: (params?: RequestParams) => Promise<
|
|
68
|
+
recommend: (params?: RequestParams) => Promise<any>;
|
|
60
69
|
/**
|
|
61
70
|
* No description
|
|
62
71
|
*
|
|
63
72
|
* @tags Article
|
|
64
|
-
* @name
|
|
73
|
+
* @name ArticleControllerFindById
|
|
65
74
|
* @request GET:/article/{id}
|
|
75
|
+
* @response `200` `IArticleControllerFindByIdData`
|
|
66
76
|
*/
|
|
67
|
-
findById: (id: string, params?: RequestParams) => Promise<
|
|
77
|
+
findById: (id: string, params?: RequestParams) => Promise<any>;
|
|
68
78
|
/**
|
|
69
79
|
* No description
|
|
70
80
|
*
|
|
71
81
|
* @tags Article
|
|
72
|
-
* @name
|
|
82
|
+
* @name ArticleControllerUpdateById
|
|
73
83
|
* @request PATCH:/article/{id}
|
|
84
|
+
* @response `200` `IArticleControllerUpdateByIdData`
|
|
74
85
|
*/
|
|
75
|
-
updateById: (id: string, params?: RequestParams) => Promise<
|
|
86
|
+
updateById: (id: string, params?: RequestParams) => Promise<any>;
|
|
76
87
|
/**
|
|
77
88
|
* No description
|
|
78
89
|
*
|
|
79
90
|
* @tags Article
|
|
80
|
-
* @name
|
|
91
|
+
* @name ArticleControllerDeleteById
|
|
81
92
|
* @request DELETE:/article/{id}
|
|
93
|
+
* @response `200` `IArticleControllerDeleteByIdData`
|
|
82
94
|
*/
|
|
83
|
-
deleteById: (id: string, params?: RequestParams) => Promise<
|
|
95
|
+
deleteById: (id: string, params?: RequestParams) => Promise<any>;
|
|
84
96
|
/**
|
|
85
97
|
* No description
|
|
86
98
|
*
|
|
87
99
|
* @tags Article
|
|
88
|
-
* @name
|
|
100
|
+
* @name ArticleControllerCheckPassword
|
|
89
101
|
* @request POST:/article/{id}/checkPassword
|
|
102
|
+
* @response `200` `IArticleControllerCheckPasswordData`
|
|
90
103
|
*/
|
|
91
|
-
checkPassword: (id: string, params?: RequestParams) => Promise<
|
|
104
|
+
checkPassword: (id: string, params?: RequestParams) => Promise<any>;
|
|
92
105
|
/**
|
|
93
106
|
* No description
|
|
94
107
|
*
|
|
95
108
|
* @tags Article
|
|
96
|
-
* @name
|
|
109
|
+
* @name ArticleControllerUpdateViewsById
|
|
97
110
|
* @request POST:/article/{id}/views
|
|
111
|
+
* @response `200` `IArticleControllerUpdateViewsByIdData`
|
|
98
112
|
*/
|
|
99
|
-
|
|
113
|
+
updateViewsById: (id: string, params?: RequestParams) => Promise<any>;
|
|
100
114
|
/**
|
|
101
115
|
* No description
|
|
102
116
|
*
|
|
103
117
|
* @tags Article
|
|
104
|
-
* @name
|
|
118
|
+
* @name ArticleControllerUpdateLikesById
|
|
105
119
|
* @request POST:/article/{id}/likes
|
|
120
|
+
* @response `200` `IArticleControllerUpdateLikesByIdData`
|
|
106
121
|
*/
|
|
107
|
-
|
|
122
|
+
updateLikesById: (id: string, params?: RequestParams) => Promise<any>;
|
|
108
123
|
}
|