@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.
- package/README.md +190 -0
- package/dist/Article.d.ts +121 -0
- package/dist/Article.js +189 -0
- package/dist/Auth.d.ts +30 -0
- package/dist/Auth.js +59 -0
- package/dist/Category.d.ts +49 -0
- package/dist/Category.js +85 -0
- package/dist/Comment.d.ts +58 -0
- package/dist/Comment.js +98 -0
- package/dist/File.d.ts +40 -0
- package/dist/File.js +72 -0
- package/dist/HttpClient.d.ts +41 -0
- package/dist/HttpClient.js +94 -0
- package/dist/Knowledge.d.ts +76 -0
- package/dist/Knowledge.js +124 -0
- package/dist/Page.d.ts +58 -0
- package/dist/Page.js +98 -0
- package/dist/Search.d.ts +30 -0
- package/dist/Search.js +59 -0
- package/dist/Setting.d.ts +22 -0
- package/dist/Setting.js +46 -0
- package/dist/Smtp.d.ts +31 -0
- package/dist/Smtp.js +59 -0
- package/dist/Tag.d.ts +58 -0
- package/dist/Tag.js +98 -0
- package/dist/User.d.ts +41 -0
- package/dist/User.js +73 -0
- package/dist/View.d.ts +49 -0
- package/dist/View.js +85 -0
- package/dist/api/ApiInstance.d.ts +39 -0
- package/dist/api/ApiInstance.js +46 -0
- package/dist/api/Article.d.ts +11 -11
- package/dist/api/Article.js +12 -12
- package/dist/api/ArticleRoute.d.ts +201 -0
- package/dist/api/ArticleRoute.js +12 -0
- package/dist/api/Auth.d.ts +5 -5
- package/dist/api/Auth.js +6 -6
- package/dist/api/AuthRoute.d.ts +44 -0
- package/dist/api/AuthRoute.js +12 -0
- package/dist/api/Category.d.ts +1 -1
- package/dist/api/Category.js +2 -2
- package/dist/api/CategoryRoute.d.ts +79 -0
- package/dist/api/CategoryRoute.js +12 -0
- package/dist/api/Comment.d.ts +3 -3
- package/dist/api/Comment.js +4 -4
- package/dist/api/CommentRoute.d.ts +95 -0
- package/dist/api/CommentRoute.js +12 -0
- package/dist/api/File.d.ts +3 -3
- package/dist/api/File.js +4 -4
- package/dist/api/FileRoute.d.ts +63 -0
- package/dist/api/FileRoute.js +12 -0
- package/dist/api/Knowledge.d.ts +5 -5
- package/dist/api/Knowledge.js +6 -6
- package/dist/api/KnowledgeRoute.d.ts +125 -0
- package/dist/api/KnowledgeRoute.js +12 -0
- package/dist/api/Page.d.ts +3 -3
- package/dist/api/Page.js +4 -4
- package/dist/api/PageRoute.d.ts +95 -0
- package/dist/api/PageRoute.js +12 -0
- package/dist/api/Search.d.ts +3 -3
- package/dist/api/Search.js +4 -4
- package/dist/api/SearchRoute.d.ts +46 -0
- package/dist/api/SearchRoute.js +12 -0
- package/dist/api/Setting.d.ts +3 -3
- package/dist/api/Setting.js +4 -4
- package/dist/api/SettingRoute.d.ts +31 -0
- package/dist/api/SettingRoute.js +12 -0
- package/dist/api/Smtp.d.ts +1 -1
- package/dist/api/Smtp.js +2 -2
- package/dist/api/SmtpRoute.d.ts +47 -0
- package/dist/api/SmtpRoute.js +12 -0
- package/dist/api/Tag.d.ts +3 -3
- package/dist/api/Tag.js +4 -4
- package/dist/api/TagRoute.d.ts +95 -0
- package/dist/api/TagRoute.js +12 -0
- package/dist/api/User.d.ts +7 -7
- package/dist/api/User.js +8 -8
- package/dist/api/UserRoute.d.ts +60 -0
- package/dist/api/UserRoute.js +12 -0
- package/dist/api/View.d.ts +3 -3
- package/dist/api/View.js +4 -4
- package/dist/api/ViewRoute.d.ts +77 -0
- package/dist/api/ViewRoute.js +12 -0
- package/dist/api/httpClient.d.ts +1 -0
- package/dist/api/httpClient.js +1 -0
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.js +6 -7
- package/dist/data-contracts.d.ts +245 -0
- package/dist/data-contracts.js +12 -0
- package/dist/index.d.ts +5 -9
- package/dist/index.js +14 -15
- package/dist/utils/common.d.ts +1 -3
- package/dist/utils/common.js +5 -31
- package/dist/utils/http.js +4 -6
- package/package.json +5 -3
- package/demos/simple.ts +0 -65
- 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,190 @@
|
|
|
1
|
+
# @fecommunity/reactpress-toolkit
|
|
2
|
+
|
|
3
|
+
A TypeScript-based API client toolkit for ReactPress, automatically generated from OpenAPI/Swagger specifications.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The ReactPress Toolkit is a comprehensive API client library that provides strongly-typed interfaces for interacting with the ReactPress backend services. It includes:
|
|
8
|
+
|
|
9
|
+
- **Auto-generated API clients** for all ReactPress modules
|
|
10
|
+
- **TypeScript definitions** for all data contracts
|
|
11
|
+
- **Utility functions** for common operations
|
|
12
|
+
- **HTTP client** with built-in authentication and error handling
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @fecommunity/reactpress-toolkit
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
or
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add @fecommunity/reactpress-toolkit
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
or
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @fecommunity/reactpress-toolkit
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
### Using the Default API Instance
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import api from '@fecommunity/reactpress-toolkit';
|
|
38
|
+
|
|
39
|
+
// Get all articles
|
|
40
|
+
const articles = await api.article.findAll();
|
|
41
|
+
|
|
42
|
+
// Get a specific article by ID
|
|
43
|
+
const article = await api.article.findById('article-id');
|
|
44
|
+
|
|
45
|
+
// Create a new article
|
|
46
|
+
const newArticle = await api.article.create({
|
|
47
|
+
title: 'My New Article',
|
|
48
|
+
content: 'Article content here...',
|
|
49
|
+
// ... other properties
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Using Named Exports
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { api, types, utils } from '@fecommunity/reactpress-toolkit';
|
|
57
|
+
|
|
58
|
+
// Working with typed data
|
|
59
|
+
const article: types.IArticle = {
|
|
60
|
+
id: '1',
|
|
61
|
+
title: 'Sample Article',
|
|
62
|
+
// ... other properties
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Using utility functions
|
|
66
|
+
const formattedDate = utils.formatDate(new Date());
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API Modules
|
|
70
|
+
|
|
71
|
+
The toolkit provides clients for all ReactPress backend modules:
|
|
72
|
+
|
|
73
|
+
- `api.article` - Article management
|
|
74
|
+
- `api.auth` - Authentication services
|
|
75
|
+
- `api.category` - Category management
|
|
76
|
+
- `api.comment` - Comment system
|
|
77
|
+
- `api.file` - File management
|
|
78
|
+
- `api.knowledge` - Knowledge base
|
|
79
|
+
- `api.page` - Page management
|
|
80
|
+
- `api.search` - Search functionality
|
|
81
|
+
- `api.setting` - System settings
|
|
82
|
+
- `api.smtp` - SMTP services
|
|
83
|
+
- `api.tag` - Tag management
|
|
84
|
+
- `api.user` - User management
|
|
85
|
+
- `api.view` - View analytics
|
|
86
|
+
|
|
87
|
+
## Configuration
|
|
88
|
+
|
|
89
|
+
You can create a custom API instance with specific configuration:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { createApiInstance } from '@fecommunity/reactpress-toolkit';
|
|
93
|
+
|
|
94
|
+
const customApi = createApiInstance({
|
|
95
|
+
baseURL: 'https://api.yourdomain.com',
|
|
96
|
+
timeout: 5000,
|
|
97
|
+
// ... other axios configuration options
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Use the custom instance
|
|
101
|
+
const articles = await customApi.article.findAll();
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Type Definitions
|
|
105
|
+
|
|
106
|
+
All data models are strongly typed and available through the `types` export:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { types } from '@fecommunity/reactpress-toolkit';
|
|
110
|
+
|
|
111
|
+
const user: types.IUser = {
|
|
112
|
+
name: 'John Doe',
|
|
113
|
+
email: 'john@example.com',
|
|
114
|
+
// ... other properties
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Available type definitions include:
|
|
119
|
+
- `types.IUser`
|
|
120
|
+
- `types.IArticle`
|
|
121
|
+
- `types.ICategory`
|
|
122
|
+
- `types.ITag`
|
|
123
|
+
- `types.IComment`
|
|
124
|
+
- `types.IFile`
|
|
125
|
+
- `types.ISetting`
|
|
126
|
+
- `types.IPage`
|
|
127
|
+
- `types.IKnowledge`
|
|
128
|
+
- `types.IView`
|
|
129
|
+
- `types.I_SMTP`
|
|
130
|
+
|
|
131
|
+
## Utility Functions
|
|
132
|
+
|
|
133
|
+
The toolkit includes helpful utility functions:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { utils } from '@fecommunity/reactpress-toolkit';
|
|
137
|
+
|
|
138
|
+
// Date formatting
|
|
139
|
+
const formattedDate = utils.formatDate(new Date(), 'YYYY-MM-DD');
|
|
140
|
+
|
|
141
|
+
// Deep cloning
|
|
142
|
+
const clonedObject = utils.deepClone(originalObject);
|
|
143
|
+
|
|
144
|
+
// Error handling
|
|
145
|
+
if (utils.ApiError.isInstance(error)) {
|
|
146
|
+
console.log(`API Error: ${error.code} - ${error.message}`);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
### Generating API Definitions
|
|
153
|
+
|
|
154
|
+
The toolkit is automatically generated from the ReactPress backend's OpenAPI specification:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm run generate
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This command will:
|
|
161
|
+
1. Generate a new Swagger JSON from the ReactPress server
|
|
162
|
+
2. Create TypeScript definitions from the specification
|
|
163
|
+
3. Organize the generated files into appropriate directories
|
|
164
|
+
4. Create API clients for each module
|
|
165
|
+
|
|
166
|
+
### Building
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm run build
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
This will compile the TypeScript code to JavaScript in the `dist` directory.
|
|
173
|
+
|
|
174
|
+
## Contributing
|
|
175
|
+
|
|
176
|
+
1. Fork the repository
|
|
177
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
178
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
179
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
180
|
+
5. Open a pull request
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
ISC
|
|
185
|
+
|
|
186
|
+
## Related Projects
|
|
187
|
+
|
|
188
|
+
- [ReactPress](https://github.com/fecommunity/reactpress) - The main ReactPress platform
|
|
189
|
+
- [ReactPress Server](https://github.com/fecommunity/reactpress/server) - Backend server
|
|
190
|
+
- [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
|
+
}
|
package/dist/Article.js
ADDED
|
@@ -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;
|
package/dist/Auth.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpClient, RequestParams } from './HttpClient';
|
|
2
|
+
export declare class Auth<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
3
|
+
/**
|
|
4
|
+
* No description
|
|
5
|
+
*
|
|
6
|
+
* @tags Auth
|
|
7
|
+
* @name AuthControllerLogin
|
|
8
|
+
* @request POST:/auth/login
|
|
9
|
+
* @response `200` `IAuthControllerLoginData`
|
|
10
|
+
*/
|
|
11
|
+
authControllerLogin: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
12
|
+
/**
|
|
13
|
+
* No description
|
|
14
|
+
*
|
|
15
|
+
* @tags Auth
|
|
16
|
+
* @name AuthControllerCreateBook
|
|
17
|
+
* @request POST:/auth/admin
|
|
18
|
+
* @response `201` `IAuthControllerCreateBookData`
|
|
19
|
+
*/
|
|
20
|
+
authControllerCreateBook: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
21
|
+
/**
|
|
22
|
+
* No description
|
|
23
|
+
*
|
|
24
|
+
* @tags Auth
|
|
25
|
+
* @name AuthControllerLoginWithGithub
|
|
26
|
+
* @request POST:/auth/github
|
|
27
|
+
* @response `201` `IAuthControllerLoginWithGithubData`
|
|
28
|
+
*/
|
|
29
|
+
authControllerLoginWithGithub: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
30
|
+
}
|
package/dist/Auth.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.Auth = void 0;
|
|
14
|
+
const HttpClient_1 = require("./HttpClient");
|
|
15
|
+
class Auth extends HttpClient_1.HttpClient {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
/**
|
|
19
|
+
* No description
|
|
20
|
+
*
|
|
21
|
+
* @tags Auth
|
|
22
|
+
* @name AuthControllerLogin
|
|
23
|
+
* @request POST:/auth/login
|
|
24
|
+
* @response `200` `IAuthControllerLoginData`
|
|
25
|
+
*/
|
|
26
|
+
this.authControllerLogin = (params = {}) => this.request({
|
|
27
|
+
path: `/auth/login`,
|
|
28
|
+
method: 'POST',
|
|
29
|
+
...params,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* No description
|
|
33
|
+
*
|
|
34
|
+
* @tags Auth
|
|
35
|
+
* @name AuthControllerCreateBook
|
|
36
|
+
* @request POST:/auth/admin
|
|
37
|
+
* @response `201` `IAuthControllerCreateBookData`
|
|
38
|
+
*/
|
|
39
|
+
this.authControllerCreateBook = (params = {}) => this.request({
|
|
40
|
+
path: `/auth/admin`,
|
|
41
|
+
method: 'POST',
|
|
42
|
+
...params,
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* No description
|
|
46
|
+
*
|
|
47
|
+
* @tags Auth
|
|
48
|
+
* @name AuthControllerLoginWithGithub
|
|
49
|
+
* @request POST:/auth/github
|
|
50
|
+
* @response `201` `IAuthControllerLoginWithGithubData`
|
|
51
|
+
*/
|
|
52
|
+
this.authControllerLoginWithGithub = (params = {}) => this.request({
|
|
53
|
+
path: `/auth/github`,
|
|
54
|
+
method: 'POST',
|
|
55
|
+
...params,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.Auth = Auth;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ICategoryControllerCreateData } from './data-contracts';
|
|
2
|
+
import { HttpClient, RequestParams } from './HttpClient';
|
|
3
|
+
export declare class Category<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
|
+
/**
|
|
5
|
+
* No description
|
|
6
|
+
*
|
|
7
|
+
* @tags Category
|
|
8
|
+
* @name CategoryControllerCreate
|
|
9
|
+
* @request POST:/category
|
|
10
|
+
* @response `200` `ICategoryControllerCreateData` 添加分类
|
|
11
|
+
*/
|
|
12
|
+
categoryControllerCreate: (params?: RequestParams) => Promise<import("axios").AxiosResponse<ICategoryControllerCreateData, any, {}>>;
|
|
13
|
+
/**
|
|
14
|
+
* No description
|
|
15
|
+
*
|
|
16
|
+
* @tags Category
|
|
17
|
+
* @name CategoryControllerFindAll
|
|
18
|
+
* @request GET:/category
|
|
19
|
+
* @response `200` `ICategoryControllerFindAllData`
|
|
20
|
+
*/
|
|
21
|
+
categoryControllerFindAll: (params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
22
|
+
/**
|
|
23
|
+
* No description
|
|
24
|
+
*
|
|
25
|
+
* @tags Category
|
|
26
|
+
* @name CategoryControllerFindById
|
|
27
|
+
* @request GET:/category/{id}
|
|
28
|
+
* @response `200` `ICategoryControllerFindByIdData`
|
|
29
|
+
*/
|
|
30
|
+
categoryControllerFindById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
31
|
+
/**
|
|
32
|
+
* No description
|
|
33
|
+
*
|
|
34
|
+
* @tags Category
|
|
35
|
+
* @name CategoryControllerUpdateById
|
|
36
|
+
* @request PATCH:/category/{id}
|
|
37
|
+
* @response `200` `ICategoryControllerUpdateByIdData`
|
|
38
|
+
*/
|
|
39
|
+
categoryControllerUpdateById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
40
|
+
/**
|
|
41
|
+
* No description
|
|
42
|
+
*
|
|
43
|
+
* @tags Category
|
|
44
|
+
* @name CategoryControllerDeleteById
|
|
45
|
+
* @request DELETE:/category/{id}
|
|
46
|
+
* @response `200` `ICategoryControllerDeleteByIdData`
|
|
47
|
+
*/
|
|
48
|
+
categoryControllerDeleteById: (id: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
49
|
+
}
|