Skip to content

Commit 388c9ce

Browse files
authored
users groups docs & adjust (#49)
More consistent return types. `dataclass` is better then TypedDict in this cases --------- Signed-off-by: Alexander Piskun <[email protected]>
1 parent ce55a72 commit 388c9ce

File tree

14 files changed

+164
-82
lines changed

14 files changed

+164
-82
lines changed

.github/workflows/analysis-coverage-unrelated.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/analysis-coverage.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,8 @@ name: Analysis & Coverage
22

33
on:
44
pull_request:
5-
paths:
6-
- '.github/workflows/analysis-coverage.yml'
7-
- 'nc_py_api/*.*'
8-
- 'tests/**'
9-
- 'setup.*'
10-
- 'pyproject.toml'
11-
- '.pre-commit-config.yaml'
125
push:
136
branches: [main]
14-
paths:
15-
- '.github/workflows/analysis-coverage.yml'
16-
- 'nc_py_api/*.*'
17-
- 'tests/**'
18-
- 'setup.*'
19-
- 'pyproject.toml'
20-
- '.pre-commit-config.yaml'
217

228
permissions:
239
contents: read

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [0.0.26 - 2023-07-xx]
5+
## [0.0.26 - 2023-07-29]
66

77
### Added
88

@@ -11,7 +11,7 @@ All notable changes to this project will be documented in this file.
1111

1212
### Changed
1313

14-
- Reworked `User Status API`
14+
- Reworked `User Status API`, `Users Group API`
1515
- Reworked return type for `weather_status.get_location`
1616

1717
## [0.0.25 - 2023-07-25]

docs/reference/Apps.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. py:currentmodule:: nc_py_api.apps
22
3-
Applications Management API
4-
---------------------------
3+
Applications Management
4+
-----------------------
55

66
.. autoclass:: AppAPI
77
:members:

docs/reference/Users.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. py:currentmodule:: nc_py_api.users
22
3-
User Management API
4-
-------------------
3+
User Management
4+
---------------
55

66
.. autoclass:: UsersAPI
77
:members:

docs/reference/UsersGroups.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. py:currentmodule:: nc_py_api.users_groups
2+
3+
User Groups Management
4+
----------------------
5+
6+
.. autoclass:: UserGroupsAPI
7+
:members:
8+
9+
.. autoclass:: GroupDetails
10+
:members:

docs/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Reference
88
Shares
99
Apps
1010
Users
11+
UsersGroups
1112
UsersStatus
1213
WeatherStatus
1314
Session

nc_py_api/appconfig_preferences_ex.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ def get_values(self, keys: list[str]) -> list[AppCfgPrefRecord]:
3636
raise ValueError("`key` parameter can not be empty")
3737
require_capabilities("app_ecosystem_v2", self._session.capabilities)
3838
data = {"configKeys": keys}
39-
try:
40-
return self._session.ocs(method="POST", path=f"{APP_V2_BASIC_URL}/{self.url_suffix}/get-values", json=data)
41-
except NextcloudExceptionNotFound:
42-
return []
39+
return self._session.ocs(method="POST", path=f"{APP_V2_BASIC_URL}/{self.url_suffix}/get-values", json=data)
4340

4441
def set(self, key: str, value: str) -> None:
4542
if not key:

nc_py_api/files.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,46 @@ def __str__(self):
102102

103103
@property
104104
def is_shared(self) -> bool:
105+
"""Check if a file or folder is shared"""
106+
105107
return self.info["permissions"].find("S") != -1
106108

107109
@property
108110
def is_shareable(self) -> bool:
111+
"""Check if a file or folder can be shared"""
112+
109113
return self.info["permissions"].find("R") != -1
110114

111115
@property
112116
def is_mounted(self) -> bool:
117+
"""Check if a file or folder is mounted"""
118+
113119
return self.info["permissions"].find("M") != -1
114120

115121
@property
116122
def is_readable(self) -> bool:
123+
"""Check if the file or folder is readable"""
124+
117125
return self.info["permissions"].find("G") != -1
118126

119127
@property
120128
def is_deletable(self) -> bool:
129+
"""Check if a file or folder can be deleted"""
130+
121131
return self.info["permissions"].find("D") != -1
122132

123133
@property
124134
def is_updatable(self) -> bool:
135+
"""Check if a file is writable"""
136+
125137
if self.is_dir:
126138
return self.info["permissions"].find("NV") != -1
127139
return self.info["permissions"].find("W") != -1
128140

129141
@property
130142
def is_creatable(self) -> bool:
143+
"""Check whether new files or folders can be created inside this folder"""
144+
131145
if not self.is_dir:
132146
return False
133147
return self.info["permissions"].find("CK") != -1

nc_py_api/preferences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Nextcloud API for working with classics app's storage with user context(table oc_preferences).
2+
Nextcloud API for working with classics app's storage with user's context (table oc_preferences).
33
"""
44

55
from ._session import NcSessionBasic

0 commit comments

Comments
 (0)