Skip to content

Commit 7ad097b

Browse files
committed
feat(api): 添加计划任务相关接口文档和模型定义
- 新增 schedule 相关端点文档(中英文) - 新增 schedule 相关数据模型文档(中英文) - 在 sidebar 中添加计划任务导航项 - 更新模型文档中的字段描述和命名规范
1 parent ede42ae commit 7ad097b

27 files changed

Lines changed: 414 additions & 88 deletions

.vitepress/sidebar/en.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
import { DefaultTheme } from "vitepress";
2-
export const enSidebar: DefaultTheme.Sidebar = {
2+
export const zhSidebar: DefaultTheme.Sidebar = {
33
"/": [
44
{
5-
text: "Guide",
5+
text: "User Guide",
66
collapsed: false,
77
items: [
88
{ text: "Quick Start", link: `/en/quick-started` },
99
{ text: "Initialization", link: `/en/initialization` },
1010
],
1111
},
1212
{
13-
text: "APIs",
13+
text: "Endpoints",
1414
items: [
15-
{ text: "Dashboard", link: "/en/endpoints/overview" },
16-
{ text: "User", link: "/en/endpoints/user" },
17-
{ text: "Instance", link: "/en/endpoints/instance" },
18-
{ text: "Image", link: "/en/endpoints/image" },
19-
{ text: "File", link: "/en/endpoints/file" },
20-
{ text: "Node", link: "/en/endpoints/daemon" },
15+
{ text: "Dashboard Data", link: "/en/endpoints/overview" },
16+
{ text: "Users", link: "/en/endpoints/user" },
17+
{ text: "Instances", link: "/en/endpoints/instance" },
18+
{ text: "Images", link: "/en/endpoints/image" },
19+
{ text: "Files", link: "/en/endpoints/file" },
20+
{ text: "Daemons", link: "/en/endpoints/daemon" },
21+
{ text: "Scheduled Tasks", link: "/en/endpoints/schedule" },
2122
],
2223
},
2324
{
2425
text: "Models",
2526
collapsed: true,
2627
items: [
27-
{ text: "Dashboard Models", link: "/en/models/overview" },
28-
{ text: "User Models", link: "/en/models/user" },
29-
{ text: "Instance Models", link: "/en/models/instance" },
30-
{ text: "Image Models", link: "/en/models/image" },
31-
{ text: "File Models", link: "/en/models/file" },
32-
{ text: "Node Models", link: "/en/models/daemon" },
33-
{ text: "Common Models", link: "/en/models/common" },
28+
{ text: "Dashboard Model", link: "/en/models/overview" },
29+
{ text: "User Model", link: "/en/models/user" },
30+
{ text: "Instance Model", link: "/en/models/instance" },
31+
{ text: "Image Model", link: "/en/models/image" },
32+
{ text: "File Model", link: "/en/models/file" },
33+
{ text: "Node Model", link: "/en/models/daemon" },
34+
{ text: "Common Model", link: "/en/models/common" },
35+
{ text: "Scheduled Task Model", link: "/en/models/schedule" },
3436
],
3537
},
3638
],

.vitepress/sidebar/zh.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const zhSidebar: DefaultTheme.Sidebar = {
1818
{ text: "镜像", link: "/endpoints/image" },
1919
{ text: "文件", link: "/endpoints/file" },
2020
{ text: "节点", link: "/endpoints/daemon" },
21+
{ text: "计划任务", link: "/endpoints/schedule" },
2122
],
2223
},
2324
{
@@ -31,6 +32,7 @@ export const zhSidebar: DefaultTheme.Sidebar = {
3132
{ text: "文件模型", link: "/models/file" },
3233
{ text: "节点模型", link: "/models/daemon" },
3334
{ text: "通用模型", link: "/models/common" },
35+
{ text: "计划任务模型", link: "/models/schedule" },
3436
],
3537
},
3638
],

en/endpoints/daemon.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Obtain the subclass for node operations
66

77
```py
8-
api = mcsm.daemon()
8+
api = mcsm.daemon
99
```
1010

1111
---
@@ -34,13 +34,13 @@ Get system information for all nodes
3434

3535
- `list[DaemonSystemInfo]`: List of node system information
3636

37-
### _method_ `add(config: dict[str, Any])`
37+
### _method_ `add(config: DaemonConfig)`
3838

3939
Add a new node
4040

4141
#### Parameters
4242

43-
- `config`: Node configuration provided as a dictionary, missing fields will be supplemented by the `DaemonConfig` model
43+
- `config`: Node configuration information
4444

4545
#### Returns
4646

en/endpoints/file.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Obtain the subclass for file operations
66

77
```py
8-
api = mcsm.file()
8+
api = mcsm.file
99
```
1010

1111
---
@@ -89,7 +89,7 @@ Upload file
8989

9090
- `bool`: Returns True after successful operation
9191

92-
### _method_ `copy(daemonId: str, uuid: str, copy_map: dict[str, str])`
92+
### _method_ `copy_to(daemonId: str, uuid: str, copy_map: dict[str, str])`
9393

9494
Copy multiple files or folders to the specified location
9595

en/endpoints/image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Obtain the subclass for image operations
66

77
```py
8-
api = mcsm.image()
8+
api = mcsm.image
99
```
1010

1111
---

en/endpoints/instance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Get subclasses of the operation instance.
66

77
```py
8-
api = mcsm.instance()
8+
api = mcsm.instance
99
```
1010

1111
---

en/endpoints/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Get panel operation logs.
4040
### Get system overview information
4141

4242
```python
43-
overview = api.overview()
43+
overview = api.overview
4444

4545
print("Server version:", overview.version)
4646
print("System memory remaining:", overview.system.freemem)

en/endpoints/schedule.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Scheduled Tasks
2+
3+
## _class_ `Schedule`
4+
5+
Subclass for managing scheduled tasks
6+
7+
```python
8+
api = mcsm.schedule
9+
```
10+
11+
---
12+
13+
### _method_ `list(daemonId: str, uuid: str)`
14+
15+
Retrieve list of scheduled tasks for an instance
16+
17+
#### Parameters
18+
19+
- `daemonId`: Node ID
20+
- `uuid`: Instance ID
21+
22+
#### Returns
23+
24+
- `list[ScheduleDetail]`: List of scheduled tasks
25+
26+
### _method_ `delete(daemonId: str, uuid: str, task_name: str)`
27+
28+
Delete a scheduled task
29+
30+
#### Parameters
31+
32+
- `daemonId`: Node ID
33+
- `uuid`: Instance ID
34+
- `task_name`: Scheduled task name
35+
36+
#### Returns
37+
38+
- `bool`: Success status
39+
40+
### _method_ `create(daemonId: str, uuid: str, config: SchedulePostBody)`
41+
42+
Create a scheduled task
43+
44+
#### Parameters
45+
46+
- `daemonId`: Node ID
47+
- `uuid`: Instance ID
48+
- `config`: Scheduled task configuration
49+
50+
#### Returns
51+
52+
- `bool`: Success status
53+
54+
### _method_ `update(daemonId: str, uuid: str, config: SchedulePostBody)`
55+
56+
Update scheduled task
57+
58+
#### Parameters
59+
60+
- `daemonId`: Node ID
61+
- `uuid`: Instance ID
62+
- `config`: Scheduled task configuration
63+
64+
#### Returns
65+
66+
- `bool`: Success status

en/endpoints/user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Get subclasses for operating users.
66

77
```python
8-
api = mcsm.user()
8+
api = mcsm.user
99
```
1010

1111
---

en/models/common.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Common Models
1+
# Common Model
22

33
## _class_ `CpuMemChart(BaseModel)`
44

0 commit comments

Comments
 (0)