mcsmapi 0.2.0__tar.gz → 0.2.1__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 (36) hide show
  1. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/PKG-INFO +1 -1
  2. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/instance.py +3 -2
  3. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/overview.py +8 -7
  4. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/user.py +2 -2
  5. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/daemon.py +2 -2
  6. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/overview.py +29 -2
  7. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi.egg-info/PKG-INFO +1 -1
  8. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/pyproject.toml +1 -1
  9. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/LICENSE +0 -0
  10. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/README.md +0 -0
  11. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/__init__.py +0 -0
  12. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/__init__.py +0 -0
  13. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/daemon.py +0 -0
  14. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/file.py +0 -0
  15. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/image.py +0 -0
  16. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/java.py +0 -0
  17. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/mod.py +0 -0
  18. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/schedule.py +0 -0
  19. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/apis/upgrade.py +0 -0
  20. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/exceptions.py +0 -0
  21. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/common.py +0 -0
  22. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/file.py +0 -0
  23. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/image.py +0 -0
  24. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/instance.py +0 -0
  25. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/java.py +0 -0
  26. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/mod.py +0 -0
  27. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/schedule.py +0 -0
  28. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/upgrade.py +0 -0
  29. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/models/user.py +0 -0
  30. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/pool.py +0 -0
  31. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi/request.py +0 -0
  32. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi.egg-info/SOURCES.txt +0 -0
  33. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi.egg-info/dependency_links.txt +0 -0
  34. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi.egg-info/requires.txt +0 -0
  35. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/mcsmapi.egg-info/top_level.txt +0 -0
  36. {mcsmapi-0.2.0 → mcsmapi-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcsmapi
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Shortcut the pypi package of MCSM./快捷操作MCSM的pypi包
5
5
  Author-email: sokoko-org <contact@sokoko.org>
6
6
  License-Expression: MIT
@@ -9,6 +9,7 @@ from mcsmapi.models.instance import (
9
9
  InstanceConfig,
10
10
  InstanceDeleteResult,
11
11
  BatchOperationDetail,
12
+ Status,
12
13
  )
13
14
  from mcsmapi.models.file import StreamChannelResult
14
15
 
@@ -26,7 +27,7 @@ class Instance:
26
27
  page: int = 1,
27
28
  page_size: int = 20,
28
29
  instance_name: str = "",
29
- status: Literal[-1, 0, 1, 2, 3, ""] = "",
30
+ status: Status | Literal[""] = "",
30
31
  tag: list[str] | None = None,
31
32
  ) -> InstanceSearchList:
32
33
  """
@@ -60,7 +61,7 @@ class Instance:
60
61
  page: int = 1,
61
62
  page_size: int = 20,
62
63
  instance_name: str = "",
63
- status: Literal[-1, 0, 1, 2, 3, ""] = "",
64
+ status: Status | Literal[""] = "",
64
65
  ) -> dict[str, Any]:
65
66
  """
66
67
  跨所有节点搜索实例
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
  import urllib.parse
3
3
  from typing import TYPE_CHECKING, Any
4
4
  from mcsmapi.pool import ApiPool
5
- from mcsmapi.models.overview import OverviewModel, LogDetail
5
+ from mcsmapi.models.overview import OverviewModel, LogDetail, LogType, LogLevel, LogSearchResult
6
6
 
7
7
  if TYPE_CHECKING:
8
8
  from mcsmapi.request import Request
@@ -30,13 +30,13 @@ class Overview:
30
30
  self,
31
31
  page: int = 1,
32
32
  page_size: int = 20,
33
- type: str | None = None,
34
- level: str | None = None,
33
+ type: LogType | None = None,
34
+ level: LogLevel | None = None,
35
35
  operator_name: str | None = None,
36
36
  start_time: int | None = None,
37
37
  end_time: int | None = None,
38
38
  keyword: str | None = None,
39
- ) -> dict[str, Any]:
39
+ ) -> LogSearchResult:
40
40
  """
41
41
  分页搜索操作日志
42
42
 
@@ -51,9 +51,9 @@ class Overview:
51
51
  """
52
52
  params: dict[str, Any] = {"page": page, "page_size": page_size}
53
53
  if type is not None:
54
- params["type"] = type
54
+ params["type"] = type.value if isinstance(type, LogType) else type
55
55
  if level is not None:
56
- params["level"] = level
56
+ params["level"] = level.value if isinstance(level, LogLevel) else level
57
57
  if operator_name is not None:
58
58
  params["operator_name"] = operator_name
59
59
  if start_time is not None:
@@ -62,7 +62,8 @@ class Overview:
62
62
  params["end_time"] = end_time
63
63
  if keyword is not None:
64
64
  params["keyword"] = keyword
65
- return await self._req.send("GET", f"{ApiPool.LOG}/search", params=params)
65
+ result = await self._req.send("GET", f"{ApiPool.LOG}/search", params=params)
66
+ return LogSearchResult(**result)
66
67
 
67
68
  async def setting(self) -> dict[str, Any]:
68
69
  """获取面板配置项(管理员)"""
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
  from typing import TYPE_CHECKING, Any, Literal
3
3
  from mcsmapi.pool import ApiPool
4
- from mcsmapi.models.user import SearchUserModel, UserCreateResult, UserInfo, LoginInfo, PanelStatus, UserOverviewItem
4
+ from mcsmapi.models.user import SearchUserModel, UserCreateResult, UserInfo, LoginInfo, PanelStatus, UserOverviewItem, UserPermission
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from mcsmapi.request import Request
@@ -29,7 +29,7 @@ class User:
29
29
  username: str = "",
30
30
  page: int = 1,
31
31
  page_size: int = 20,
32
- role: Literal[-1, 1, 10, ""] = "",
32
+ role: UserPermission | Literal[""] = "",
33
33
  ) -> SearchUserModel:
34
34
  """
35
35
  搜索用户(管理员)
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
  from typing import TYPE_CHECKING, Any, Literal
3
3
  from pydantic import BaseModel, ConfigDict, PrivateAttr
4
- from mcsmapi.models.instance import InstanceCreateResult, InstanceDetail, InstanceDeleteResult
4
+ from mcsmapi.models.instance import InstanceCreateResult, InstanceDetail, InstanceDeleteResult, Status
5
5
 
6
6
 
7
7
  if TYPE_CHECKING:
@@ -28,7 +28,7 @@ class DaemonOperation(BaseModel):
28
28
  page: int = 1,
29
29
  page_size: int = 20,
30
30
  instance_name: str = "",
31
- status: Literal[-1, 0, 1, 2, 3, ""] = "",
31
+ status: Status | Literal[""] = "",
32
32
  ) -> InstanceSearchList:
33
33
  """
34
34
  搜索当前节点的实例列表
@@ -1,5 +1,4 @@
1
1
  from enum import Enum
2
- from typing import Literal
3
2
  from pydantic import BaseModel
4
3
  from mcsmapi.models.common import CpuMemChart, InstanceStat, ProcessInfo
5
4
 
@@ -275,6 +274,18 @@ class LogType(Enum):
275
274
  """SSO 解绑"""
276
275
 
277
276
 
277
+
278
+ class LogLevel(str, Enum):
279
+ """日志等级"""
280
+
281
+ INFO = "info"
282
+ """信息"""
283
+ WARNING = "warning"
284
+ """警告"""
285
+ ERROR = "error"
286
+ """错误"""
287
+
288
+
278
289
  class LogDetail(BaseModel):
279
290
  """操作日志详情"""
280
291
 
@@ -286,7 +297,7 @@ class LogDetail(BaseModel):
286
297
  """操作时间戳"""
287
298
  operator_ip: str
288
299
  """操作者IP"""
289
- operation_level: Literal["info", "warning", "error", "unknown"]
300
+ operation_level: LogLevel
290
301
  """日志等级"""
291
302
  type: LogType
292
303
  """操作类型"""
@@ -302,3 +313,19 @@ class LogDetail(BaseModel):
302
313
  """被操作的文件"""
303
314
  task_name: str | None = None
304
315
  """任务名称"""
316
+
317
+
318
+ class LogSearchResult(BaseModel):
319
+ """操作日志搜索结果"""
320
+
321
+ page: int
322
+ """当前页码"""
323
+ pageSize: int
324
+ """每页条数"""
325
+ maxPage: int
326
+ """最大页码"""
327
+ total: int
328
+ """总记录数"""
329
+ data: list[LogDetail]
330
+ """日志详情列表"""
331
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcsmapi
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Shortcut the pypi package of MCSM./快捷操作MCSM的pypi包
5
5
  Author-email: sokoko-org <contact@sokoko.org>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ requires = ["setuptools", "wheel"]
4
4
 
5
5
  [project]
6
6
  name = "mcsmapi"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Shortcut the pypi package of MCSM./快捷操作MCSM的pypi包"
9
9
  readme = "README.md"
10
10
  authors = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes