Skip to content

Commit 716094b

Browse files
committed
Expose token in Share objects
Some use cases require passing the token to external applications that access NextCloud shares via WebDAV.
1 parent c834931 commit 716094b

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

nc_py_api/files/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,11 @@ def path(self) -> str:
442442
"""Share path relative to the user's root directory."""
443443
return self._raw_data.get("path", "").lstrip("/")
444444

445+
@property
446+
def token(self) -> str:
447+
"""Token for the Shared object."""
448+
return self._raw_data.get("token", "")
449+
445450
@property
446451
def label(self) -> str:
447452
"""Label for the Shared object."""

tests/actual_tests/files_sharing_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def _test_share_fields(new_share: Share, get_by_id: Share, shared_file: FsNode):
5050
assert get_by_id.path == new_share.path
5151
assert get_by_id.mimetype == new_share.mimetype
5252
assert get_by_id.share_type == new_share.share_type
53+
assert get_by_id.token == new_share.token
5354
assert get_by_id.file_owner == new_share.file_owner
5455
assert get_by_id.share_owner == new_share.share_owner
5556
assert not get_by_id.share_with

0 commit comments

Comments
 (0)