cloud-py-api / nc_py_api

Nextcloud Python Framework
https://cloud-py-api.github.io/nc_py_api/
Other
84 stars 4 forks source link

added Files Locking support #227

Closed bigcat88 closed 6 months ago

bigcat88 commented 6 months ago

Implemented using WebDAV requests.


    async def lock(self, path: FsNode | str, lock_type: LockType = LockType.MANUAL_LOCK) -> None:
        """Locks the file.

        .. note:: Exception codes: 423 - existing lock present.
        """
        pass

    async def unlock(self, path: FsNode | str) -> None:
        """Unlocks the file.

        .. note:: Exception codes: 412 - the file is not locked, 423 - the lock is owned by another user.
        """ 
        pass   

Reference: https://github.com/nextcloud/files_lock

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (10417cf) 99.83% compared to head (df9fa6a) 99.84%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #227 +/- ## ======================================= Coverage 99.83% 99.84% ======================================= Files 42 42 Lines 4943 5010 +67 ======================================= + Hits 4935 5002 +67 Misses 8 8 ``` | [Files](https://app.codecov.io/gh/cloud-py-api/nc_py_api/pull/227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloud-py-api) | Coverage Δ | | |---|---|---| | [nc\_py\_api/\_\_init\_\_.py](https://app.codecov.io/gh/cloud-py-api/nc_py_api/pull/227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloud-py-api#diff-bmNfcHlfYXBpL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | | | [nc\_py\_api/\_version.py](https://app.codecov.io/gh/cloud-py-api/nc_py_api/pull/227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloud-py-api#diff-bmNfcHlfYXBpL192ZXJzaW9uLnB5) | `100.00% <100.00%> (ø)` | | | [nc\_py\_api/files/\_\_init\_\_.py](https://app.codecov.io/gh/cloud-py-api/nc_py_api/pull/227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloud-py-api#diff-bmNfcHlfYXBpL2ZpbGVzL19faW5pdF9fLnB5) | `99.65% <100.00%> (+0.05%)` | :arrow_up: | | [nc\_py\_api/files/\_files.py](https://app.codecov.io/gh/cloud-py-api/nc_py_api/pull/227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloud-py-api#diff-bmNfcHlfYXBpL2ZpbGVzL19maWxlcy5weQ==) | `98.52% <100.00%> (+0.06%)` | :arrow_up: | | [nc\_py\_api/files/files.py](https://app.codecov.io/gh/cloud-py-api/nc_py_api/pull/227?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cloud-py-api#diff-bmNfcHlfYXBpL2ZpbGVzL2ZpbGVzLnB5) | `100.00% <100.00%> (ø)` | |