Skip to content

Commit

Permalink
added to core_sys_info: group_info, get_sys_health, upgrade_status
Browse files Browse the repository at this point in the history
  • Loading branch information
N4S4 committed Jan 20, 2025
1 parent d4b1df2 commit 9e048bf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ This wrapper cover the following APIs for now:
| SYNO.ActiveBackup.Version |
| SYNO.ActiveBackup.Log |

| Core User |
|-------------------------------|
| SYNO.Core.User |
| SYNO.Core.User.Group |
| SYNO.Core.User.PasswordPolicy |
| SYNO.Core.User.PasswordExpiry |

| Snapshot Replication |
|--------------------------|
| SYNO.Core.Share.Snapshot |
Expand Down Expand Up @@ -342,7 +349,6 @@ This wrapper cover the following APIs for now:
| SYNO.SurveillanceStation.Face.Result |
| SYNO.SurveillanceStation.Recording.Bookmark |


#### FileStation Functions list

To explain the use of some function I will divide all the functions in two sets
Expand Down Expand Up @@ -423,6 +429,7 @@ if you encounter problems you might set ```download_st_version = 2``` during ini
| `resume_task()` | Resume a task. |
| `edit_task()` | Edit a Task. |


#### Photo functions:
| Function |
|-------------------------------------|
Expand Down Expand Up @@ -563,6 +570,9 @@ DS info with below functions:
| `get_disk_utilization()` |
| `get_memory_utilization()` |
| `dsm_info()` |
| `get_system_health()` |
| `upgrade_status()` |
| `groups_info()` |

### core_group (DSM User Groups)
| Functions | Description |
Expand All @@ -581,6 +591,20 @@ DS info with below functions:
| `create()` | Create new group |
| `delete()` | Delete specified groups |

### core_user (DSM User Settings)
| Functions | Description |
|----------------------------|-----------------------------------------------------------------|
| `get_users()` | Retrieve groups information |
| `create_user()` | Create a new user |
| `modify_user()` | Modify a user |
| `delete_user()` | Delete a user |
| `affect_groups()` | Affect or disaffect groups to a user |
| `affect_groups_status()` | Get the status of a join task |
| `get_password_policy()` | Get the password policy |
| `set_password_policy()` | Set the password policy |
| `get_password_expiry()` | Get the password expiry |
| `set_password_expiry()` | Set the password expiry |

### Virtualization
| Functions |
|----------------------------|
Expand Down
1 change: 1 addition & 0 deletions synology_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
core_backup, \
core_certificate, \
core_sys_info, \
core_group, \
downloadstation, \
log_center, \
vpn, \
Expand Down
33 changes: 33 additions & 0 deletions synology_api/core_sys_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations
from typing import Optional
from . import base_api
from __future__ import annotations
from typing import Optional
from . import base_api


class SysInfo(base_api.BaseApi):
Expand Down Expand Up @@ -851,6 +854,22 @@ def server_pair(self) -> dict[str, object] | str:

return self.request_data(api_name, api_path, req_param)

def groups_info(self, offset: int = 0, limit: int = -1, name_only: bool = False) -> dict[str, object] | str:
api_name = 'SYNO.Core.Group'
info = self.core_list[api_name]
api_path = info['path']

if name_only:
name_only = 'true'
elif not name_only:
name_only = 'false'
else:
return 'name_only must be True or False'
req_param = {'version': info['maxVersion'], 'method': 'list', 'offset': offset, 'limit': limit,
'name_only': name_only, 'type': 'local'}

return self.request_data(api_name, api_path, req_param)

def ldap_info(self) -> dict[str, object] | str:
api_name = 'SYNO.Core.Directory.LDAP'
info = self.core_list[api_name]
Expand Down Expand Up @@ -1020,3 +1039,17 @@ def active_notifications(self) -> dict[str, object] | str:
req_param = {'version': info['maxVersion'], 'method': 'notify', 'action': 'load'}

return self.request_data(api_name, api_path, req_param)

def get_system_health(self) -> dict[str, object] | str:
api_name = 'SYNO.Core.System.SystemHealth'
info = self.core_list[api_name]
api_path = info['path']
req_param = {'version': info['maxVersion'], 'method': 'get'}
return self.request_data(api_name, api_path, req_param)

def upgrade_status(self) -> dict[str, object] | str:
api_name = 'SYNO.Core.Upgrade'
info = self.core_list[api_name]
api_path = info['path']
req_param = {'version': info['maxVersion'], 'method': 'status'}
return self.request_data(api_name, api_path, req_param)

0 comments on commit 9e048bf

Please sign in to comment.