mcsmapi 0.1.7__tar.gz → 0.1.8__tar.gz

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 (38) hide show
  1. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/PKG-INFO +8 -14
  2. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/README.md +6 -12
  3. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/__init__.py +14 -8
  4. mcsmapi-0.1.8/mcsmapi/apis/daemon.py +109 -0
  5. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/apis/file.py +92 -118
  6. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/apis/image.py +18 -24
  7. mcsmapi-0.1.8/mcsmapi/apis/instance.py +281 -0
  8. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/apis/overview.py +1 -1
  9. mcsmapi-0.1.8/mcsmapi/apis/schedule.py +71 -0
  10. mcsmapi-0.1.8/mcsmapi/apis/user.py +82 -0
  11. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/models/common.py +6 -6
  12. mcsmapi-0.1.8/mcsmapi/models/daemon.py +181 -0
  13. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/models/file.py +70 -67
  14. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/models/image.py +17 -11
  15. mcsmapi-0.1.8/mcsmapi/models/instance.py +333 -0
  16. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/models/overview.py +74 -41
  17. mcsmapi-0.1.8/mcsmapi/models/schedule.py +80 -0
  18. mcsmapi-0.1.8/mcsmapi/models/user.py +102 -0
  19. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/pool.py +1 -0
  20. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/request.py +1 -4
  21. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi.egg-info/PKG-INFO +8 -14
  22. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi.egg-info/SOURCES.txt +2 -1
  23. mcsmapi-0.1.8/mcsmapi.egg-info/requires.txt +2 -0
  24. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/pyproject.toml +2 -2
  25. mcsmapi-0.1.7/mcsmapi/apis/daemon.py +0 -99
  26. mcsmapi-0.1.7/mcsmapi/apis/instance.py +0 -310
  27. mcsmapi-0.1.7/mcsmapi/apis/user.py +0 -86
  28. mcsmapi-0.1.7/mcsmapi/models/__init__.py +0 -0
  29. mcsmapi-0.1.7/mcsmapi/models/daemon.py +0 -154
  30. mcsmapi-0.1.7/mcsmapi/models/instance.py +0 -319
  31. mcsmapi-0.1.7/mcsmapi/models/user.py +0 -117
  32. mcsmapi-0.1.7/mcsmapi.egg-info/requires.txt +0 -2
  33. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/LICENSE +0 -0
  34. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/apis/__init__.py +0 -0
  35. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi/exceptions.py +0 -0
  36. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi.egg-info/dependency_links.txt +0 -0
  37. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/mcsmapi.egg-info/top_level.txt +0 -0
  38. {mcsmapi-0.1.7 → mcsmapi-0.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcsmapi
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Shortcut the pypi package of MCSM./快捷操作MCSM的pypi包
5
5
  Author-email: molanp <molanpp@outlook.com>
6
6
  License-Expression: MIT
@@ -11,7 +11,7 @@ Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
13
  Requires-Dist: requests
14
- Requires-Dist: pydantic>=2.0.0
14
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
15
15
  Dynamic: license-file
16
16
 
17
17
  # MCSM API
@@ -23,16 +23,9 @@ Dynamic: license-file
23
23
 
24
24
  English|[Chinese Simplified](README_zh-cn.md)
25
25
 
26
- > [!important]
27
- > We need your help, the documentation for this project has not been written yet, if you are willing, please submit pr to help us write the documentation.
28
-
29
26
  ## Documentation
30
27
 
31
- The documentation is not yet complete, if you need it, please visit [deepwiki-mcsmapi](https://deepwiki.com/molanp/mcsmapi)
32
-
33
- You can also find:
34
-
35
- 📄 Work-in-progress docs: [docs](docs)
28
+ 📄 Docs: [docs](https://mcsmapi.awkchan.top/en/)
36
29
 
37
30
  💡 Example: [example](example)
38
31
 
@@ -50,7 +43,7 @@ You can install `mcsmapi` using `pip`:
50
43
  pip install mcsmapi
51
44
  ```
52
45
 
53
- If you need the latest build files (untested), please visit
46
+ If you need the latest build files, please visit
54
47
  [Actions](https://github.com/molanp/mcsmapi/actions/workflows/auto-build.yml)
55
48
 
56
49
  ## Supported Features
@@ -65,8 +58,8 @@ If you need the latest build files (untested), please visit
65
58
  ## Supported MCSM Versions
66
59
 
67
60
  | MCSM Version | Support Status |
68
- | :---: | :---: |
69
- | 10.x | ✅ |
61
+ | :----------: | :------------: |
62
+ | 10.x | ✅ |
70
63
 
71
64
  ### Quick Example
72
65
 
@@ -84,9 +77,10 @@ mcsm.login_with_apikey("apikey")
84
77
 
85
78
  # Get dashboard data
86
79
  overview = mcsm.overview()
80
+ overview_data = overview.overview()
87
81
 
88
82
  # Get MCSM version
89
- mcsm_version = mcsm.overview().version
83
+ mcsm_version = overview_data.version
90
84
  ```
91
85
 
92
86
  ## Contributing
@@ -7,16 +7,9 @@
7
7
 
8
8
  English|[Chinese Simplified](README_zh-cn.md)
9
9
 
10
- > [!important]
11
- > We need your help, the documentation for this project has not been written yet, if you are willing, please submit pr to help us write the documentation.
12
-
13
10
  ## Documentation
14
11
 
15
- The documentation is not yet complete, if you need it, please visit [deepwiki-mcsmapi](https://deepwiki.com/molanp/mcsmapi)
16
-
17
- You can also find:
18
-
19
- 📄 Work-in-progress docs: [docs](docs)
12
+ 📄 Docs: [docs](https://mcsmapi.awkchan.top/en/)
20
13
 
21
14
  💡 Example: [example](example)
22
15
 
@@ -34,7 +27,7 @@ You can install `mcsmapi` using `pip`:
34
27
  pip install mcsmapi
35
28
  ```
36
29
 
37
- If you need the latest build files (untested), please visit
30
+ If you need the latest build files, please visit
38
31
  [Actions](https://github.com/molanp/mcsmapi/actions/workflows/auto-build.yml)
39
32
 
40
33
  ## Supported Features
@@ -49,8 +42,8 @@ If you need the latest build files (untested), please visit
49
42
  ## Supported MCSM Versions
50
43
 
51
44
  | MCSM Version | Support Status |
52
- | :---: | :---: |
53
- | 10.x | ✅ |
45
+ | :----------: | :------------: |
46
+ | 10.x | ✅ |
54
47
 
55
48
  ### Quick Example
56
49
 
@@ -68,9 +61,10 @@ mcsm.login_with_apikey("apikey")
68
61
 
69
62
  # Get dashboard data
70
63
  overview = mcsm.overview()
64
+ overview_data = overview.overview()
71
65
 
72
66
  # Get MCSM version
73
- mcsm_version = mcsm.overview().version
67
+ mcsm_version = overview_data.version
74
68
  ```
75
69
 
76
70
  ## Contributing
@@ -11,14 +11,14 @@ from mcsmapi.request import Request
11
11
 
12
12
  class MCSMAPI:
13
13
 
14
- def __init__(self, url: str, timeout: int = 5) -> None:
14
+ def __init__(self, url: str, timeout: int = 5):
15
15
  split_url = urllib.parse.urlsplit(url)
16
16
  Request.set_mcsm_url(
17
17
  urllib.parse.urljoin(f"{split_url.scheme}://{split_url.netloc}", "")
18
18
  )
19
19
  Request.set_timeout(timeout)
20
20
 
21
- def login(self, username: str, password: str) -> "MCSMAPI":
21
+ def login(self, username: str, password: str):
22
22
  Request.set_token(
23
23
  Request.send(
24
24
  "POST",
@@ -34,20 +34,26 @@ class MCSMAPI:
34
34
  self.authentication = "apikey"
35
35
  return self
36
36
 
37
- def overview(self) -> Overview:
37
+ @property
38
+ def overview(self):
38
39
  return Overview()
39
40
 
40
- def instance(self) -> Instance:
41
+ @property
42
+ def instance(self):
41
43
  return Instance()
42
44
 
43
- def user(self) -> User:
45
+ @property
46
+ def user(self) :
44
47
  return User()
45
48
 
46
- def daemon(self) -> Daemon:
49
+ @property
50
+ def daemon(self):
47
51
  return Daemon()
48
52
 
49
- def file(self) -> File:
53
+ @property
54
+ def file(self):
50
55
  return File()
51
56
 
52
- def image(self) -> Image:
57
+ @property
58
+ def image(self):
53
59
  return Image()
@@ -0,0 +1,109 @@
1
+ from typing import Any
2
+ from mcsmapi.pool import ApiPool
3
+ from mcsmapi.request import send
4
+ from mcsmapi.models.daemon import (
5
+ DaemonConfig,
6
+ DaemonInfo,
7
+ DaemonSystemInfo,
8
+ DaemonStatus,
9
+ DaemonUpdateConfig,
10
+ )
11
+
12
+
13
+ class Daemon:
14
+ @staticmethod
15
+ def config() -> list[DaemonStatus]:
16
+ """
17
+ 获取全部节点配置信息
18
+
19
+ :returns: 节点的配置信息列表
20
+ """
21
+ daemons = send(
22
+ "GET",
23
+ f"{ApiPool.SERVICE}/remote_services_list",
24
+ )
25
+ return [DaemonStatus(**daemon) for daemon in daemons]
26
+
27
+ @staticmethod
28
+ def info() -> list[DaemonInfo]:
29
+ """
30
+ 获取全部节点信息
31
+
32
+ :returns: 节点信息列表
33
+ """
34
+ daemons = send(
35
+ "GET",
36
+ f"{ApiPool.SERVICE}/remote_services",
37
+ )
38
+ return [DaemonInfo(**daemon) for daemon in daemons]
39
+
40
+ @staticmethod
41
+ def system() -> list[DaemonSystemInfo]:
42
+ """
43
+ 获取全部节点的系统信息
44
+
45
+ :returns: 节点系统信息列表
46
+ """
47
+ daemons = send(
48
+ "GET",
49
+ f"{ApiPool.SERVICE}/remote_services_system",
50
+ )
51
+ return [DaemonSystemInfo(**daemon) for daemon in daemons]
52
+
53
+ @staticmethod
54
+ def add(config: DaemonConfig) -> str:
55
+ """
56
+ 新增一个节点
57
+
58
+ :params config: 节点的配置信息
59
+
60
+ :returns: 新增节点的UUID
61
+ """
62
+ return send(
63
+ "POST",
64
+ f"{ApiPool.SERVICE}/remote_service",
65
+ data=config.model_dump(),
66
+ )
67
+
68
+ @staticmethod
69
+ def delete(daemonId: str) -> bool:
70
+ """
71
+ 删除一个节点
72
+
73
+ :params daemonId: 节点的UUID
74
+
75
+ :returns: 操作成功后返回True
76
+ """
77
+ return send(
78
+ "DELETE", f"{ApiPool.SERVICE}/remote_service", params={"uuid": daemonId}
79
+ )
80
+
81
+ @staticmethod
82
+ def link(daemonId: str) -> bool:
83
+ """
84
+ 连接一个节点
85
+
86
+ :params daemonId: 节点的UUID
87
+
88
+ :returns: 操作成功后返回True
89
+ """
90
+ return send(
91
+ "GET", f"{ApiPool.SERVICE}/link_remote_service", params={"uuid": daemonId}
92
+ )
93
+
94
+ @staticmethod
95
+ def update(daemonId: str, config: dict[str, Any]) -> bool:
96
+ """
97
+ 更新一个节点的配置
98
+
99
+ :params daemonId: 节点的UUID
100
+ :params config: 节点的配置信息,以字典形式提供,缺失内容由DaemonUpdateConfig模型补全
101
+
102
+ :returns: 操作成功后返回True
103
+ """
104
+ return send(
105
+ "PUT",
106
+ f"{ApiPool.SERVICE}/remote_service",
107
+ params={"uuid": daemonId},
108
+ data=DaemonUpdateConfig(**config).model_dump(),
109
+ )
@@ -1,3 +1,4 @@
1
+ from typing import Literal
1
2
  from mcsmapi.pool import ApiPool
2
3
  from mcsmapi.request import Request, send, upload
3
4
  from mcsmapi.models.file import FileDownloadConfig, FileList
@@ -18,16 +19,14 @@ class File:
18
19
  """
19
20
  获取文件列表
20
21
 
21
- **参数:**
22
- - daemonId (str): 守护进程的唯一标识符。
23
- - uuid (str): 文件实例的唯一标识符。
24
- - target (str, 可选): 用于文件过滤的目标路径。默认为空字符串,表示不按路径过滤。
25
- - page (int, 可选): 指定分页的页码。默认为0。
26
- - page_size (int, 可选): 指定每页的文件数量。默认为100。
27
- - file_name (str, 可选): 用于在文件列表中过滤出名称包含指定字符串的文件或文件夹
22
+ :params daemonId: 节点的UUID
23
+ :params uuid: 实例的UUID
24
+ :params target: 用于文件过滤的目标路径
25
+ :params page: 指定分页的页码
26
+ :params page_size: 指定每页的文件数量
27
+ :params file_name: 用于在文件列表中过滤出名称包含指定字符串的文件或文件夹
28
28
 
29
- **返回:**
30
- - FileList: 包含文件列表信息和分页详情的FileList模型。
29
+ :returns: 包含文件列表信息和分页详情的FileList模型
31
30
  """
32
31
  result = send(
33
32
  "GET",
@@ -44,17 +43,15 @@ class File:
44
43
  return FileList(**result, daemonId=daemonId, uuid=uuid)
45
44
 
46
45
  @staticmethod
47
- def content(daemonId: str, uuid: str, target: str) -> str | bytes:
46
+ def content(daemonId: str, uuid: str, target: str) -> str:
48
47
  """
49
48
  获取文件内容
50
49
 
51
- **参数:**
52
- - daemonId (str): 守护进程的唯一标识符。
53
- - uuid (str): 文件实例的唯一标识符。
54
- - target (str): 文件的目标路径。
50
+ :params daemonId: 节点的UUID
51
+ :params uuid: 实例的UUID
52
+ :params target: 文件的目标路径
55
53
 
56
- **返回:**
57
- - str: 文件的内容信息。
54
+ :returns: 文件的内容信息
58
55
  """
59
56
  return send(
60
57
  "PUT",
@@ -68,14 +65,12 @@ class File:
68
65
  """
69
66
  更新文件内容
70
67
 
71
- **参数:**
72
- - daemonId (str): 守护进程的唯一标识符。
73
- - uuid (str): 文件实例的唯一标识符。
74
- - target (str): 文件的目标路径。
75
- - text (str): 新的文件内容。
68
+ :params daemonId: 节点的UUID
69
+ :params uuid: 实例的UUID
70
+ :params target: 目标文件的路径
71
+ :params text: 新的文件内容
76
72
 
77
- **返回:**
78
- - bool: 更新成功后返回True。
73
+ :returns: 操作成功后返回True
79
74
  """
80
75
  return send(
81
76
  "PUT",
@@ -89,13 +84,11 @@ class File:
89
84
  """
90
85
  下载文件
91
86
 
92
- **参数:**
93
- - daemonId (str): 守护进程的唯一标识符。
94
- - uuid (str): 文件实例的唯一标识符。
95
- - file_name (str): 要下载的文件名。路径+名字, 示例: /backup/world.zip
87
+ :params daemonId: 节点的UUID
88
+ :params uuid: 实例的UUID
89
+ :params file_name: 要下载的文件的实例内完整路径, eg: /backup/world.zip
96
90
 
97
- **返回:**
98
- - str: 文件下载URL。
91
+ :returns: 文件下载URL
99
92
  """
100
93
 
101
94
  result = send(
@@ -113,14 +106,12 @@ class File:
113
106
  """
114
107
  上传文件
115
108
 
116
- **参数:**
117
- - daemonId (str): 守护进程的唯一标识符。
118
- - uuid (str): 文件实例的唯一标识符。
119
- - file (bytes): 要上传的文件内容。
120
- - upload_dir (str): 文件上传到的目标路径。
109
+ :params daemonId: 节点的UUID
110
+ :params uuid: 实例的UUID
111
+ :params file: 要上传的文件内容
112
+ :params upload_dir: 文件上传到的目标路径
121
113
 
122
- **返回:**
123
- - bool: 上传成功后返回True。
114
+ :returns: 操作成功后返回True
124
115
  """
125
116
  result = send(
126
117
  "POST",
@@ -135,17 +126,15 @@ class File:
135
126
  return True
136
127
 
137
128
  @staticmethod
138
- def copy(daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
129
+ def copy_to(daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
139
130
  """
140
- 复制多个文件夹或文件到指定位置。
131
+ 复制多个文件夹或文件到指定位置
141
132
 
142
- **参数:**
143
- - daemonId (str): 守护进程的唯一标识符。
144
- - uuid (str): 文件实例的唯一标识符。
145
- - copy_map (dict): 复制映射,格式为 {源路径: 目标路径}
133
+ :params daemonId: 节点的UUID
134
+ :params uuid: 实例的UUID
135
+ :params copy_map: 复制映射,格式为 {源路径: 目标路径}
146
136
 
147
- **返回:**
148
- - bool: 上传成功后返回True。
137
+ :returns: 操作成功后返回True
149
138
  """
150
139
  targets = [[source, target] for source, target in copy_map.items()]
151
140
  return send(
@@ -158,31 +147,27 @@ class File:
158
147
  @staticmethod
159
148
  def copyOne(daemonId: str, uuid: str, source: str, target: str) -> bool:
160
149
  """
161
- 复制单个文件或文件夹到指定位置。
150
+ 复制单个文件或文件夹到指定位置
162
151
 
163
- **参数:**
164
- - daemonId (str): 守护进程的唯一标识符。
165
- - uuid (str): 实例的唯一标识符。
166
- - source (str): 源文件或文件夹的路径。
167
- - target (str): 目标文件或文件夹的路径。
152
+ :params daemonId: 节点的UUID
153
+ :params uuid: 实例的UUID
154
+ :params source: 源文件或文件夹的路径
155
+ :params target: 目标文件或文件夹的路径
168
156
 
169
- **返回:**
170
- - bool: 移动成功后返回True。
157
+ :returns: 操作成功后返回True
171
158
  """
172
- return File.copy(daemonId, uuid, {source: target})
159
+ return File.copy_to(daemonId, uuid, {source: target})
173
160
 
174
161
  @staticmethod
175
162
  def move(daemonId: str, uuid: str, copy_map: dict[str, str]) -> bool:
176
163
  """
177
- 移动多个文件或文件夹到指定位置。
164
+ 移动多个文件或文件夹到指定位置
178
165
 
179
- 参数:
180
- - daemonId (str): 守护进程的唯一标识符。
181
- - uuid (str): 实例的唯一标识符。
182
- - copy_map (dict): 移动映射,格式为 {源路径: 目标路径}
166
+ :params daemonId: 节点的UUID
167
+ :params uuid: 实例的UUID
168
+ :params copy_map: 移动映射,格式为 {源路径: 目标路径}
183
169
 
184
- 返回:
185
- - bool: 移动成功后返回True。
170
+ :returns: 操作成功后返回True
186
171
  """
187
172
  targets = [[source, target] for source, target in copy_map.items()]
188
173
  return send(
@@ -195,32 +180,28 @@ class File:
195
180
  @staticmethod
196
181
  def moveOne(daemonId: str, uuid: str, source: str, target: str) -> bool:
197
182
  """
198
- 从源路径移动单个文件或文件夹到目标路径。
183
+ 从源路径移动单个文件或文件夹到目标路径
199
184
 
200
- 参数:
201
- - daemonId (str): 守护进程的唯一标识符。
202
- - uuid (str): 实例的唯一标识符。
203
- - source (str): 源文件或文件夹的路径。
204
- - target (str): 目标文件或文件夹的路径。
185
+ :params daemonId: 节点的UUID
186
+ :params uuid: 实例的UUID
187
+ :params source: 源文件或文件夹的路径
188
+ :params target: 目标文件或文件夹的路径
205
189
 
206
- 返回:
207
- - bool: 移动成功后返回True。
190
+ :returns: 操作成功后返回True
208
191
  """
209
192
  return File.move(daemonId, uuid, {source: target})
210
193
 
211
194
  @staticmethod
212
195
  def rename(daemonId: str, uuid: str, source: str, new_name: str) -> bool:
213
196
  """
214
- 重命名单个文件或文件夹。
197
+ 重命名单个文件或文件夹
215
198
 
216
- **参数:**
217
- - daemonId (str): 守护进程的唯一标识符。
218
- - uuid (str): 实例的唯一标识符。
219
- - source (str): 源文件或文件夹的路径。
220
- - new_name (str): 源文件或文件夹的新名字。
199
+ :params daemonId: 节点的UUID
200
+ :params uuid: 实例的UUID
201
+ :params source: 源文件或文件夹的路径
202
+ :params new_name: 源文件或文件夹的新名字
221
203
 
222
- **返回:**
223
- - bool: 重命名成功后返回True。
204
+ :returns: 操作成功后返回True
224
205
  """
225
206
  directory = os.path.dirname(source)
226
207
  target = os.path.join(directory, new_name)
@@ -229,16 +210,14 @@ class File:
229
210
  @staticmethod
230
211
  def zip(daemonId: str, uuid: str, source: str, targets: list[str]) -> bool:
231
212
  """
232
- 压缩多个文件或文件夹到指定位置。
213
+ 压缩多个文件或文件夹到指定位置
233
214
 
234
- **参数:**
235
- - daemonId (str): 守护进程的唯一标识符。
236
- - uuid (str): 实例的唯一标识符。
237
- - source (str): 需要压缩的文件路径。
238
- - targets (list): 要压缩到的目标文件的路径。
215
+ :params daemonId: 节点的UUID
216
+ :params uuid: 实例的UUID
217
+ :params source: 要压缩到的目标文件的路径
218
+ :params targets: 需要压缩的文件路径
239
219
 
240
- **返回:**
241
- - bool: 压缩成功后返回True。
220
+ :returns: 操作成功后返回True
242
221
  """
243
222
  return send(
244
223
  "POST",
@@ -249,41 +228,40 @@ class File:
249
228
 
250
229
  @staticmethod
251
230
  def unzip(
252
- daemonId: str, uuid: str, source: str, target: str, code: str = "utf-8"
231
+ daemonId: str,
232
+ uuid: str,
233
+ source: str,
234
+ targets: str,
235
+ code: Literal["utf-8", "gbk", "big5"] = "utf-8",
253
236
  ) -> bool:
254
237
  """
255
- 解压缩指定的zip文件到目标位置。
256
-
257
- **参数:**
258
- - daemonId (str): 守护进程的唯一标识符。
259
- - uuid (str): 实例的唯一标识符。
260
- - source (str): 需要解压的zip文件路径。
261
- - target (str): 解压到的目标路径。
262
- - code (str, optional): 压缩文件的编码方式,默认为"utf-8"。
263
- 可选值: utf-8, gbk, big5
264
-
265
- **返回:**
266
- - bool: 解压成功后返回True。
238
+ 解压缩指定的zip文件到目标位置
239
+
240
+ :params daemonId: 节点的UUID
241
+ :params uuid: 实例的UUID
242
+ :params source: 需要解压的zip文件路径
243
+ :params targets: 解压到的目标路径
244
+ :params code: 压缩文件的编码方式
245
+
246
+ :returns: 操作成功后返回True
267
247
  """
268
248
  return send(
269
249
  "POST",
270
250
  f"{ApiPool.FILE}/compress",
271
251
  params={"daemonId": daemonId, "uuid": uuid},
272
- data={"type": 2, "code": code, "source": source, "targets": target},
252
+ data={"type": 2, "code": code, "source": source, "targets": targets},
273
253
  )
274
254
 
275
255
  @staticmethod
276
256
  def delete(daemonId: str, uuid: str, targets: list[str]) -> bool:
277
257
  """
278
- 删除多个文件或文件夹。
258
+ 删除多个文件或文件夹
279
259
 
280
- **参数:**
281
- - daemonId (str): 守护进程的唯一标识符。
282
- - uuid (str): 实例的唯一标识符。
283
- - targets (list): 要删除的文件或文件夹的路径。
260
+ :params daemonId: 节点的UUID
261
+ :params uuid: 实例的UUID
262
+ :params targets: 要删除的文件或文件夹的路径
284
263
 
285
- **返回:**
286
- - bool: 删除成功后返回True。
264
+ :returns: 操作成功后返回True
287
265
  """
288
266
  return send(
289
267
  "DELETE",
@@ -295,15 +273,13 @@ class File:
295
273
  @staticmethod
296
274
  def createFile(daemonId: str, uuid: str, target: str) -> bool:
297
275
  """
298
- 创建文件。
276
+ 创建文件
299
277
 
300
- **参数:**
301
- - daemonId (str): 守护进程的唯一标识符。
302
- - uuid (str): 实例的唯一标识符。
303
- - target (str): 目标文件的路径,包含文件名。
278
+ :params daemonId: 节点的UUID
279
+ :params uuid: 实例的UUID
280
+ :params target: 目标文件的路径,包含文件名
304
281
 
305
- **返回:**
306
- - bool: 创建成功后返回True。
282
+ :returns: 操作成功后返回True
307
283
  """
308
284
  return send(
309
285
  "POST",
@@ -317,13 +293,11 @@ class File:
317
293
  """
318
294
  创建文件夹
319
295
 
320
- **参数:**
321
- - daemonId (str): 守护进程的唯一标识符。
322
- - uuid (str): 实例的唯一标识符。
323
- - target (str): 目标文件夹的路径。
296
+ :params daemonId: 节点的UUID
297
+ :params uuid: 实例的UUID
298
+ :params target: 目标文件夹的路径
324
299
 
325
- **返回:**
326
- - bool: 创建成功后返回True。
300
+ :returns: 操作成功后返回True
327
301
  """
328
302
  return send(
329
303
  "POST",