You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for Shared Folders using API_KEY = "SYNO.Core.Share". See #58 for motivation.
@Quentame they are using their (?weird?) POST format quite a bit with shares. There are 19 Shared Folder attributes that are only returned if they are specifically requested via params. See an example below. There are other API calls that use this as well. I think there needs to be a generic way to handle these. What do you think about supporting a list of additional parameters in each module? I can't quite figure out how to pass the parameter from the API module (/python-synology/synology_dsm/api/core/share.py) but the structure would look something like the example below.
If you are OK with this general approach I need some pointers on the changes required in synology_dsm.py so these additional parameters get passed to requests. I can't quite grok that flow yet.
Potential share.py with params -
class SynoShare(object):
"""Class containing Share data."""
API_KEY = "SYNO.Core.Share"
SHARE_PARAMS = {"additional": '"hidden", "encryption", "is_aclmode", '
'"unite_permission", "is_support_acl", '
'"is_sync_share", "is_force_readonly", '
'"force_readonly_reason", "recyclebin", '
'"is_share_moving", "is_cluster_share", '
'"is_exfat_share", "is_cold_storage_share", '
'"support_snapshot", "share_quota", '
'"enable_share_compress", "enable_share_cow", '
'"include_cold_storage_share", '
'"is_cold_storage_share"',
"shareType": "all"}
def __init__(self, raw_data):
self._data = {}
self.update(raw_data)
def update(self, raw_data):
"""Updates share data."""
if raw_data:
self._data = raw_data
if raw_data.get("data"):
self._data = raw_data["data"]
@property
# Some changes required here to support SHARE_PARAMS.
def shares(self):
"""Gets all shares."""
return self._data.get("shares", [])
def share(self, share_name):
"""Returns a specific share."""
for share in self.shares:
if share["name"] == share_name:
return share
return {}
Add support for Shared Folders using
API_KEY = "SYNO.Core.Share"
. See #58 for motivation.@Quentame they are using their (?weird?) POST format quite a bit with shares. There are 19 Shared Folder attributes that are only returned if they are specifically requested via params. See an example below. There are other API calls that use this as well. I think there needs to be a generic way to handle these. What do you think about supporting a list of additional parameters in each module? I can't quite figure out how to pass the parameter from the API module (
/python-synology/synology_dsm/api/core/share.py
) but the structure would look something like the example below.If you are OK with this general approach I need some pointers on the changes required in
synology_dsm.py
so these additional parameters get passed to requests. I can't quite grok that flow yet.Potential share.py with params -
Shared Folders POST -
The text was updated successfully, but these errors were encountered: