nc-py-api 0.20.1__tar.gz → 0.20.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/CHANGELOG.md +6 -0
  2. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/PKG-INFO +1 -1
  3. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_preferences_ex.py +32 -48
  4. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_version.py +1 -1
  5. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/ui/settings.py +2 -0
  6. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/.gitignore +0 -0
  7. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/AUTHORS +0 -0
  8. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/LICENSE.txt +0 -0
  9. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/README.md +0 -0
  10. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/__init__.py +0 -0
  11. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_deffered_error.py +0 -0
  12. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_exceptions.py +0 -0
  13. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_misc.py +0 -0
  14. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_preferences.py +0 -0
  15. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_session.py +0 -0
  16. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_talk_api.py +0 -0
  17. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/_theming.py +0 -0
  18. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/activity.py +0 -0
  19. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/apps.py +0 -0
  20. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/calendar_api.py +0 -0
  21. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/__init__.py +0 -0
  22. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/defs.py +0 -0
  23. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/integration_fastapi.py +0 -0
  24. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/logger.py +0 -0
  25. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/misc.py +0 -0
  26. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/occ_commands.py +0 -0
  27. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/persist_transformers_cache.py +0 -0
  28. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/providers/__init__.py +0 -0
  29. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/providers/providers.py +0 -0
  30. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/providers/task_processing.py +0 -0
  31. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/ui/__init__.py +0 -0
  32. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/ui/files_actions.py +0 -0
  33. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/ui/resources.py +0 -0
  34. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/ui/top_menu.py +0 -0
  35. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/ui/ui.py +0 -0
  36. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/ex_app/uvicorn_fastapi.py +0 -0
  37. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/files/__init__.py +0 -0
  38. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/files/_files.py +0 -0
  39. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/files/files.py +0 -0
  40. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/files/files_async.py +0 -0
  41. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/files/sharing.py +0 -0
  42. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/loginflow_v2.py +0 -0
  43. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/nextcloud.py +0 -0
  44. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/notes.py +0 -0
  45. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/notifications.py +0 -0
  46. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/options.py +0 -0
  47. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/talk.py +0 -0
  48. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/talk_bot.py +0 -0
  49. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/user_status.py +0 -0
  50. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/users.py +0 -0
  51. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/users_groups.py +0 -0
  52. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/weather_status.py +0 -0
  53. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/nc_py_api/webhooks.py +0 -0
  54. {nc_py_api-0.20.1 → nc_py_api-0.20.2}/pyproject.toml +0 -0
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.20.2 - 2025-05-28]
6
+
7
+ ### Added
8
+
9
+ - ExApps(NC32+): field `sensitive` to the `SettingsField` class (Declarative Settings) and to the `PreferencesExAPI` class. #357
10
+
5
11
  ## [0.20.1 - 2025-05-06]
6
12
 
7
13
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nc-py-api
3
- Version: 0.20.1
3
+ Version: 0.20.2
4
4
  Summary: Nextcloud Python Framework
5
5
  Project-URL: Changelog, https://github.com/cloud-py-api/nc_py_api/blob/main/CHANGELOG.md
6
6
  Project-URL: Documentation, https://cloud-py-api.github.io/nc_py_api/
@@ -61,6 +61,21 @@ class _BasicAppCfgPref:
61
61
  if not not_fail:
62
62
  raise e from None
63
63
 
64
+ def set_value(self, key: str, value: str, sensitive: bool | None = None) -> None:
65
+ """Sets a value and if specified the sensitive flag for a key.
66
+
67
+ .. note:: A sensitive flag ensures key value are encrypted and truncated in Nextcloud logs.
68
+ Default for new records is ``False`` when sensitive is *unspecified*, if changes existing record and
69
+ sensitive is *unspecified* it will not change the existing `sensitive` flag.
70
+ """
71
+ if not key:
72
+ raise ValueError("`key` parameter can not be empty")
73
+ require_capabilities("app_api", self._session.capabilities)
74
+ params: dict = {"configKey": key, "configValue": value}
75
+ if sensitive is not None:
76
+ params["sensitive"] = sensitive
77
+ self._session.ocs("POST", f"{self._session.ae_url}/{self._url_suffix}", json=params)
78
+
64
79
 
65
80
  class _AsyncBasicAppCfgPref:
66
81
  _url_suffix: str
@@ -104,72 +119,41 @@ class _AsyncBasicAppCfgPref:
104
119
  if not not_fail:
105
120
  raise e from None
106
121
 
122
+ async def set_value(self, key: str, value: str, sensitive: bool | None = None) -> None:
123
+ """Sets a value and if specified the sensitive flag for a key.
124
+
125
+ .. note:: A sensitive flag ensures key value are encrypted and truncated in Nextcloud logs.
126
+ Default for new records is ``False`` when sensitive is *unspecified*, if changes existing record and
127
+ sensitive is *unspecified* it will not change the existing `sensitive` flag.
128
+ """
129
+ if not key:
130
+ raise ValueError("`key` parameter can not be empty")
131
+ require_capabilities("app_api", await self._session.capabilities)
132
+ params: dict = {"configKey": key, "configValue": value}
133
+ if sensitive is not None:
134
+ params["sensitive"] = sensitive
135
+ await self._session.ocs("POST", f"{self._session.ae_url}/{self._url_suffix}", json=params)
136
+
107
137
 
108
138
  class PreferencesExAPI(_BasicAppCfgPref):
109
- """User specific preferences API, avalaible as **nc.preferences_ex.<method>**."""
139
+ """User specific preferences API, available as **nc.preferences_ex.<method>**."""
110
140
 
111
141
  _url_suffix = "ex-app/preference"
112
142
 
113
- def set_value(self, key: str, value: str) -> None:
114
- """Sets a value for a key."""
115
- if not key:
116
- raise ValueError("`key` parameter can not be empty")
117
- require_capabilities("app_api", self._session.capabilities)
118
- params = {"configKey": key, "configValue": value}
119
- self._session.ocs("POST", f"{self._session.ae_url}/{self._url_suffix}", json=params)
120
-
121
143
 
122
144
  class AsyncPreferencesExAPI(_AsyncBasicAppCfgPref):
123
145
  """User specific preferences API."""
124
146
 
125
147
  _url_suffix = "ex-app/preference"
126
148
 
127
- async def set_value(self, key: str, value: str) -> None:
128
- """Sets a value for a key."""
129
- if not key:
130
- raise ValueError("`key` parameter can not be empty")
131
- require_capabilities("app_api", await self._session.capabilities)
132
- params = {"configKey": key, "configValue": value}
133
- await self._session.ocs("POST", f"{self._session.ae_url}/{self._url_suffix}", json=params)
134
-
135
149
 
136
150
  class AppConfigExAPI(_BasicAppCfgPref):
137
- """Non-user(App) specific preferences API, avalaible as **nc.appconfig_ex.<method>**."""
151
+ """Non-user(App) specific preferences API, available as **nc.appconfig_ex.<method>**."""
138
152
 
139
153
  _url_suffix = "ex-app/config"
140
154
 
141
- def set_value(self, key: str, value: str, sensitive: bool | None = None) -> None:
142
- """Sets a value and if specified the sensitive flag for a key.
143
-
144
- .. note:: A sensitive flag ensures key values are truncated in Nextcloud logs.
145
- Default for new records is ``False`` when sensitive is *unspecified*, if changes existing record and
146
- sensitive is *unspecified* it will not change the existing `sensitive` flag.
147
- """
148
- if not key:
149
- raise ValueError("`key` parameter can not be empty")
150
- require_capabilities("app_api", self._session.capabilities)
151
- params: dict = {"configKey": key, "configValue": value}
152
- if sensitive is not None:
153
- params["sensitive"] = sensitive
154
- self._session.ocs("POST", f"{self._session.ae_url}/{self._url_suffix}", json=params)
155
-
156
155
 
157
156
  class AsyncAppConfigExAPI(_AsyncBasicAppCfgPref):
158
157
  """Non-user(App) specific preferences API."""
159
158
 
160
159
  _url_suffix = "ex-app/config"
161
-
162
- async def set_value(self, key: str, value: str, sensitive: bool | None = None) -> None:
163
- """Sets a value and if specified the sensitive flag for a key.
164
-
165
- .. note:: A sensitive flag ensures key values are truncated in Nextcloud logs.
166
- Default for new records is ``False`` when sensitive is *unspecified*, if changes existing record and
167
- sensitive is *unspecified* it will not change the existing `sensitive` flag.
168
- """
169
- if not key:
170
- raise ValueError("`key` parameter can not be empty")
171
- require_capabilities("app_api", await self._session.capabilities)
172
- params: dict = {"configKey": key, "configValue": value}
173
- if sensitive is not None:
174
- params["sensitive"] = sensitive
175
- await self._session.ocs("POST", f"{self._session.ae_url}/{self._url_suffix}", json=params)
@@ -1,3 +1,3 @@
1
1
  """Version of nc_py_api."""
2
2
 
3
- __version__ = "0.20.1"
3
+ __version__ = "0.20.2"
@@ -48,6 +48,7 @@ class SettingsField:
48
48
  description: str = ""
49
49
  placeholder: str = ""
50
50
  label: str = ""
51
+ sensitive: bool = False
51
52
  notify = False # to be supported in future
52
53
 
53
54
  @classmethod
@@ -74,6 +75,7 @@ class SettingsField:
74
75
  "placeholder": self.placeholder,
75
76
  "label": self.label,
76
77
  "notify": self.notify,
78
+ "sensitive": self.sensitive,
77
79
  }
78
80
 
79
81
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes