nc-py-api 0.12.1__py3-none-any.whl → 0.15.0__py3-none-any.whl
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.
- nc_py_api/__init__.py +1 -1
- nc_py_api/_session.py +18 -4
- nc_py_api/_version.py +1 -1
- nc_py_api/apps.py +2 -2
- nc_py_api/ex_app/__init__.py +1 -1
- nc_py_api/ex_app/events_listener.py +137 -0
- nc_py_api/ex_app/integration_fastapi.py +17 -7
- nc_py_api/ex_app/occ_commands.py +153 -0
- nc_py_api/ex_app/providers/providers.py +7 -0
- nc_py_api/ex_app/providers/task_processing.py +197 -0
- nc_py_api/ex_app/ui/files_actions.py +45 -1
- nc_py_api/files/__init__.py +10 -4
- nc_py_api/files/_files.py +12 -0
- nc_py_api/files/files.py +14 -482
- nc_py_api/files/files_async.py +523 -0
- nc_py_api/loginflow_v2.py +161 -0
- nc_py_api/nextcloud.py +53 -9
- nc_py_api/webhooks.py +210 -0
- {nc_py_api-0.12.1.dist-info → nc_py_api-0.15.0.dist-info}/METADATA +21 -9
- {nc_py_api-0.12.1.dist-info → nc_py_api-0.15.0.dist-info}/RECORD +23 -17
- {nc_py_api-0.12.1.dist-info → nc_py_api-0.15.0.dist-info}/WHEEL +1 -1
- {nc_py_api-0.12.1.dist-info → nc_py_api-0.15.0.dist-info}/licenses/AUTHORS +0 -0
- {nc_py_api-0.12.1.dist-info → nc_py_api-0.15.0.dist-info}/licenses/LICENSE.txt +0 -0
nc_py_api/nextcloud.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Nextcloud class providing access to all API endpoints."""
|
|
2
2
|
|
|
3
|
+
import contextlib
|
|
3
4
|
import typing
|
|
4
5
|
from abc import ABC
|
|
5
6
|
|
|
@@ -30,15 +31,20 @@ from .activity import _ActivityAPI, _AsyncActivityAPI
|
|
|
30
31
|
from .apps import _AppsAPI, _AsyncAppsAPI
|
|
31
32
|
from .calendar import _CalendarAPI
|
|
32
33
|
from .ex_app.defs import LogLvl
|
|
34
|
+
from .ex_app.events_listener import AsyncEventsListenerAPI, EventsListenerAPI
|
|
35
|
+
from .ex_app.occ_commands import AsyncOccCommandsAPI, OccCommandsAPI
|
|
33
36
|
from .ex_app.providers.providers import AsyncProvidersApi, ProvidersApi
|
|
34
37
|
from .ex_app.ui.ui import AsyncUiApi, UiApi
|
|
35
|
-
from .files.files import
|
|
38
|
+
from .files.files import FilesAPI
|
|
39
|
+
from .files.files_async import AsyncFilesAPI
|
|
40
|
+
from .loginflow_v2 import _AsyncLoginFlowV2API, _LoginFlowV2API
|
|
36
41
|
from .notes import _AsyncNotesAPI, _NotesAPI
|
|
37
42
|
from .notifications import _AsyncNotificationsAPI, _NotificationsAPI
|
|
38
43
|
from .user_status import _AsyncUserStatusAPI, _UserStatusAPI
|
|
39
44
|
from .users import _AsyncUsersAPI, _UsersAPI
|
|
40
45
|
from .users_groups import _AsyncUsersGroupsAPI, _UsersGroupsAPI
|
|
41
46
|
from .weather_status import _AsyncWeatherStatusAPI, _WeatherStatusAPI
|
|
47
|
+
from .webhooks import _AsyncWebhooksAPI, _WebhooksAPI
|
|
42
48
|
|
|
43
49
|
|
|
44
50
|
class _NextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
|
|
@@ -66,6 +72,8 @@ class _NextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
|
|
|
66
72
|
"""Nextcloud API for managing users statuses"""
|
|
67
73
|
weather_status: _WeatherStatusAPI
|
|
68
74
|
"""Nextcloud API for managing user weather statuses"""
|
|
75
|
+
webhooks: _WebhooksAPI
|
|
76
|
+
"""Nextcloud API for managing webhooks"""
|
|
69
77
|
_session: NcSessionBasic
|
|
70
78
|
|
|
71
79
|
def __init__(self, session: NcSessionBasic):
|
|
@@ -81,6 +89,7 @@ class _NextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
|
|
|
81
89
|
self.users_groups = _UsersGroupsAPI(session)
|
|
82
90
|
self.user_status = _UserStatusAPI(session)
|
|
83
91
|
self.weather_status = _WeatherStatusAPI(session)
|
|
92
|
+
self.webhooks = _WebhooksAPI(session)
|
|
84
93
|
|
|
85
94
|
@property
|
|
86
95
|
def capabilities(self) -> dict:
|
|
@@ -164,6 +173,8 @@ class _AsyncNextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
|
|
|
164
173
|
"""Nextcloud API for managing users statuses"""
|
|
165
174
|
weather_status: _AsyncWeatherStatusAPI
|
|
166
175
|
"""Nextcloud API for managing user weather statuses"""
|
|
176
|
+
webhooks: _AsyncWebhooksAPI
|
|
177
|
+
"""Nextcloud API for managing webhooks"""
|
|
167
178
|
_session: AsyncNcSessionBasic
|
|
168
179
|
|
|
169
180
|
def __init__(self, session: AsyncNcSessionBasic):
|
|
@@ -179,6 +190,7 @@ class _AsyncNextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
|
|
|
179
190
|
self.users_groups = _AsyncUsersGroupsAPI(session)
|
|
180
191
|
self.user_status = _AsyncUserStatusAPI(session)
|
|
181
192
|
self.weather_status = _AsyncWeatherStatusAPI(session)
|
|
193
|
+
self.webhooks = _AsyncWebhooksAPI(session)
|
|
182
194
|
|
|
183
195
|
@property
|
|
184
196
|
async def capabilities(self) -> dict:
|
|
@@ -244,15 +256,18 @@ class Nextcloud(_NextcloudBasic):
|
|
|
244
256
|
"""
|
|
245
257
|
|
|
246
258
|
_session: NcSession
|
|
259
|
+
loginflow_v2: _LoginFlowV2API
|
|
260
|
+
"""Nextcloud Login flow v2."""
|
|
247
261
|
|
|
248
262
|
def __init__(self, **kwargs):
|
|
249
263
|
"""If the parameters are not specified, they will be taken from the environment.
|
|
250
264
|
|
|
251
265
|
:param nextcloud_url: url of the nextcloud instance.
|
|
252
|
-
:param nc_auth_user: login username.
|
|
253
|
-
:param nc_auth_pass: password or app-password for the username.
|
|
266
|
+
:param nc_auth_user: login username. Optional.
|
|
267
|
+
:param nc_auth_pass: password or app-password for the username. Optional.
|
|
254
268
|
"""
|
|
255
269
|
self._session = NcSession(**kwargs)
|
|
270
|
+
self.loginflow_v2 = _LoginFlowV2API(self._session)
|
|
256
271
|
super().__init__(self._session)
|
|
257
272
|
|
|
258
273
|
@property
|
|
@@ -268,15 +283,18 @@ class AsyncNextcloud(_AsyncNextcloudBasic):
|
|
|
268
283
|
"""
|
|
269
284
|
|
|
270
285
|
_session: AsyncNcSession
|
|
286
|
+
loginflow_v2: _AsyncLoginFlowV2API
|
|
287
|
+
"""Nextcloud Login flow v2."""
|
|
271
288
|
|
|
272
289
|
def __init__(self, **kwargs):
|
|
273
290
|
"""If the parameters are not specified, they will be taken from the environment.
|
|
274
291
|
|
|
275
292
|
:param nextcloud_url: url of the nextcloud instance.
|
|
276
|
-
:param nc_auth_user: login username.
|
|
277
|
-
:param nc_auth_pass: password or app-password for the username.
|
|
293
|
+
:param nc_auth_user: login username. Optional.
|
|
294
|
+
:param nc_auth_pass: password or app-password for the username. Optional.
|
|
278
295
|
"""
|
|
279
296
|
self._session = AsyncNcSession(**kwargs)
|
|
297
|
+
self.loginflow_v2 = _AsyncLoginFlowV2API(self._session)
|
|
280
298
|
super().__init__(self._session)
|
|
281
299
|
|
|
282
300
|
@property
|
|
@@ -304,6 +322,10 @@ class NextcloudApp(_NextcloudBasic):
|
|
|
304
322
|
"""Nextcloud UI API for ExApps"""
|
|
305
323
|
providers: ProvidersApi
|
|
306
324
|
"""API for registering providers for Nextcloud"""
|
|
325
|
+
events_listener: EventsListenerAPI
|
|
326
|
+
"""API for registering Events listeners for ExApps"""
|
|
327
|
+
occ_commands: OccCommandsAPI
|
|
328
|
+
"""API for registering OCC command for ExApps"""
|
|
307
329
|
|
|
308
330
|
def __init__(self, **kwargs):
|
|
309
331
|
"""The parameters will be taken from the environment.
|
|
@@ -316,6 +338,15 @@ class NextcloudApp(_NextcloudBasic):
|
|
|
316
338
|
self.preferences_ex = PreferencesExAPI(self._session)
|
|
317
339
|
self.ui = UiApi(self._session)
|
|
318
340
|
self.providers = ProvidersApi(self._session)
|
|
341
|
+
self.events_listener = EventsListenerAPI(self._session)
|
|
342
|
+
self.occ_commands = OccCommandsAPI(self._session)
|
|
343
|
+
|
|
344
|
+
@property
|
|
345
|
+
def enabled_state(self) -> bool:
|
|
346
|
+
"""Returns ``True`` if ExApp is enabled, ``False`` otherwise."""
|
|
347
|
+
with contextlib.suppress(Exception):
|
|
348
|
+
return bool(self._session.ocs("GET", "/ocs/v1.php/apps/app_api/ex-app/state"))
|
|
349
|
+
return False
|
|
319
350
|
|
|
320
351
|
def log(self, log_lvl: LogLvl, content: str) -> None:
|
|
321
352
|
"""Writes log to the Nextcloud log file."""
|
|
@@ -326,14 +357,14 @@ class NextcloudApp(_NextcloudBasic):
|
|
|
326
357
|
self._session.ocs("POST", f"{self._session.ae_url}/log", json={"level": int(log_lvl), "message": content})
|
|
327
358
|
|
|
328
359
|
def users_list(self) -> list[str]:
|
|
329
|
-
"""Returns list of users on the Nextcloud instance.
|
|
360
|
+
"""Returns list of users on the Nextcloud instance."""
|
|
330
361
|
return self._session.ocs("GET", f"{self._session.ae_url}/users")
|
|
331
362
|
|
|
332
363
|
@property
|
|
333
364
|
def user(self) -> str:
|
|
334
365
|
"""Property containing the current user ID.
|
|
335
366
|
|
|
336
|
-
**
|
|
367
|
+
**ExApps** can change user ID they impersonate with **set_user** method.
|
|
337
368
|
"""
|
|
338
369
|
return self._session.user
|
|
339
370
|
|
|
@@ -421,6 +452,10 @@ class AsyncNextcloudApp(_AsyncNextcloudBasic):
|
|
|
421
452
|
"""Nextcloud UI API for ExApps"""
|
|
422
453
|
providers: AsyncProvidersApi
|
|
423
454
|
"""API for registering providers for Nextcloud"""
|
|
455
|
+
events_listener: AsyncEventsListenerAPI
|
|
456
|
+
"""API for registering Events listeners for ExApps"""
|
|
457
|
+
occ_commands: AsyncOccCommandsAPI
|
|
458
|
+
"""API for registering OCC command for ExApps"""
|
|
424
459
|
|
|
425
460
|
def __init__(self, **kwargs):
|
|
426
461
|
"""The parameters will be taken from the environment.
|
|
@@ -433,6 +468,15 @@ class AsyncNextcloudApp(_AsyncNextcloudBasic):
|
|
|
433
468
|
self.preferences_ex = AsyncPreferencesExAPI(self._session)
|
|
434
469
|
self.ui = AsyncUiApi(self._session)
|
|
435
470
|
self.providers = AsyncProvidersApi(self._session)
|
|
471
|
+
self.events_listener = AsyncEventsListenerAPI(self._session)
|
|
472
|
+
self.occ_commands = AsyncOccCommandsAPI(self._session)
|
|
473
|
+
|
|
474
|
+
@property
|
|
475
|
+
async def enabled_state(self) -> bool:
|
|
476
|
+
"""Returns ``True`` if ExApp is enabled, ``False`` otherwise."""
|
|
477
|
+
with contextlib.suppress(Exception):
|
|
478
|
+
return bool(await self._session.ocs("GET", "/ocs/v1.php/apps/app_api/ex-app/state"))
|
|
479
|
+
return False
|
|
436
480
|
|
|
437
481
|
async def log(self, log_lvl: LogLvl, content: str) -> None:
|
|
438
482
|
"""Writes log to the Nextcloud log file."""
|
|
@@ -443,14 +487,14 @@ class AsyncNextcloudApp(_AsyncNextcloudBasic):
|
|
|
443
487
|
await self._session.ocs("POST", f"{self._session.ae_url}/log", json={"level": int(log_lvl), "message": content})
|
|
444
488
|
|
|
445
489
|
async def users_list(self) -> list[str]:
|
|
446
|
-
"""Returns list of users on the Nextcloud instance.
|
|
490
|
+
"""Returns list of users on the Nextcloud instance."""
|
|
447
491
|
return await self._session.ocs("GET", f"{self._session.ae_url}/users")
|
|
448
492
|
|
|
449
493
|
@property
|
|
450
494
|
async def user(self) -> str:
|
|
451
495
|
"""Property containing the current user ID.
|
|
452
496
|
|
|
453
|
-
**
|
|
497
|
+
**ExApps** can change user ID they impersonate with **set_user** method.
|
|
454
498
|
"""
|
|
455
499
|
return await self._session.user
|
|
456
500
|
|
nc_py_api/webhooks.py
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"""Nextcloud Webhooks API."""
|
|
2
|
+
|
|
3
|
+
import dataclasses
|
|
4
|
+
|
|
5
|
+
from ._misc import clear_from_params_empty # , require_capabilities
|
|
6
|
+
from ._session import AsyncNcSessionBasic, NcSessionBasic
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclasses.dataclass
|
|
10
|
+
class WebhookInfo:
|
|
11
|
+
"""Information about the Webhook."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, raw_data: dict):
|
|
14
|
+
self._raw_data = raw_data
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def webhook_id(self) -> int:
|
|
18
|
+
"""`ID` of the webhook."""
|
|
19
|
+
return self._raw_data["id"]
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def app_id(self) -> str:
|
|
23
|
+
"""`ID` of the ExApp that registered webhook."""
|
|
24
|
+
return self._raw_data["appId"] if self._raw_data["appId"] else ""
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def user_id(self) -> str:
|
|
28
|
+
"""`UserID` if webhook was registered in user context."""
|
|
29
|
+
return self._raw_data["userId"] if self._raw_data["userId"] else ""
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def http_method(self) -> str:
|
|
33
|
+
"""HTTP method used to call webhook."""
|
|
34
|
+
return self._raw_data["httpMethod"]
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def uri(self) -> str:
|
|
38
|
+
"""URL address that will be called for this webhook."""
|
|
39
|
+
return self._raw_data["uri"]
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def event(self) -> str:
|
|
43
|
+
"""Nextcloud PHP event that triggers this webhook."""
|
|
44
|
+
return self._raw_data["event"]
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def event_filter(self):
|
|
48
|
+
"""Mongo filter to apply to the serialized data to decide if firing."""
|
|
49
|
+
return self._raw_data["eventFilter"]
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def user_id_filter(self) -> str:
|
|
53
|
+
"""Currently unknown."""
|
|
54
|
+
return self._raw_data["userIdFilter"]
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def headers(self) -> dict:
|
|
58
|
+
"""Headers that should be added to request when calling webhook."""
|
|
59
|
+
return self._raw_data["headers"] if self._raw_data["headers"] else {}
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def auth_method(self) -> str:
|
|
63
|
+
"""Currently unknown."""
|
|
64
|
+
return self._raw_data["authMethod"]
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def auth_data(self) -> dict:
|
|
68
|
+
"""Currently unknown."""
|
|
69
|
+
return self._raw_data["authData"] if self._raw_data["authData"] else {}
|
|
70
|
+
|
|
71
|
+
def __repr__(self):
|
|
72
|
+
return f"<{self.__class__.__name__} id={self.webhook_id}, event={self.event}>"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class _WebhooksAPI:
|
|
76
|
+
"""The class provides the application management API on the Nextcloud server."""
|
|
77
|
+
|
|
78
|
+
_ep_base: str = "/ocs/v1.php/apps/webhook_listeners/api/v1/webhooks"
|
|
79
|
+
|
|
80
|
+
def __init__(self, session: NcSessionBasic):
|
|
81
|
+
self._session = session
|
|
82
|
+
|
|
83
|
+
def get_list(self, uri_filter: str = "") -> list[WebhookInfo]:
|
|
84
|
+
params = {"uri": uri_filter} if uri_filter else {}
|
|
85
|
+
return [WebhookInfo(i) for i in self._session.ocs("GET", f"{self._ep_base}", params=params)]
|
|
86
|
+
|
|
87
|
+
def get_entry(self, webhook_id: int) -> WebhookInfo:
|
|
88
|
+
return WebhookInfo(self._session.ocs("GET", f"{self._ep_base}/{webhook_id}"))
|
|
89
|
+
|
|
90
|
+
def register(
|
|
91
|
+
self,
|
|
92
|
+
http_method: str,
|
|
93
|
+
uri: str,
|
|
94
|
+
event: str,
|
|
95
|
+
event_filter: dict | None = None,
|
|
96
|
+
user_id_filter: str = "",
|
|
97
|
+
headers: dict | None = None,
|
|
98
|
+
auth_method: str = "none",
|
|
99
|
+
auth_data: dict | None = None,
|
|
100
|
+
):
|
|
101
|
+
params = {
|
|
102
|
+
"httpMethod": http_method,
|
|
103
|
+
"uri": uri,
|
|
104
|
+
"event": event,
|
|
105
|
+
"eventFilter": event_filter,
|
|
106
|
+
"userIdFilter": user_id_filter,
|
|
107
|
+
"headers": headers,
|
|
108
|
+
"authMethod": auth_method,
|
|
109
|
+
"authData": auth_data,
|
|
110
|
+
}
|
|
111
|
+
clear_from_params_empty(["eventFilter", "userIdFilter", "headers", "authMethod", "authData"], params)
|
|
112
|
+
return WebhookInfo(self._session.ocs("POST", f"{self._ep_base}", json=params))
|
|
113
|
+
|
|
114
|
+
def update(
|
|
115
|
+
self,
|
|
116
|
+
webhook_id: int,
|
|
117
|
+
http_method: str,
|
|
118
|
+
uri: str,
|
|
119
|
+
event: str,
|
|
120
|
+
event_filter: dict | None = None,
|
|
121
|
+
user_id_filter: str = "",
|
|
122
|
+
headers: dict | None = None,
|
|
123
|
+
auth_method: str = "none",
|
|
124
|
+
auth_data: dict | None = None,
|
|
125
|
+
):
|
|
126
|
+
params = {
|
|
127
|
+
"id": webhook_id,
|
|
128
|
+
"httpMethod": http_method,
|
|
129
|
+
"uri": uri,
|
|
130
|
+
"event": event,
|
|
131
|
+
"eventFilter": event_filter,
|
|
132
|
+
"userIdFilter": user_id_filter,
|
|
133
|
+
"headers": headers,
|
|
134
|
+
"authMethod": auth_method,
|
|
135
|
+
"authData": auth_data,
|
|
136
|
+
}
|
|
137
|
+
clear_from_params_empty(["eventFilter", "userIdFilter", "headers", "authMethod", "authData"], params)
|
|
138
|
+
return WebhookInfo(self._session.ocs("POST", f"{self._ep_base}/{webhook_id}", json=params))
|
|
139
|
+
|
|
140
|
+
def unregister(self, webhook_id: int) -> bool:
|
|
141
|
+
return self._session.ocs("DELETE", f"{self._ep_base}/{webhook_id}")
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class _AsyncWebhooksAPI:
|
|
145
|
+
"""The class provides the async application management API on the Nextcloud server."""
|
|
146
|
+
|
|
147
|
+
_ep_base: str = "/ocs/v1.php/webhooks"
|
|
148
|
+
|
|
149
|
+
def __init__(self, session: AsyncNcSessionBasic):
|
|
150
|
+
self._session = session
|
|
151
|
+
|
|
152
|
+
async def get_list(self, uri_filter: str = "") -> list[WebhookInfo]:
|
|
153
|
+
params = {"uri": uri_filter} if uri_filter else {}
|
|
154
|
+
return [WebhookInfo(i) for i in await self._session.ocs("GET", f"{self._ep_base}", params=params)]
|
|
155
|
+
|
|
156
|
+
async def get_entry(self, webhook_id: int) -> WebhookInfo:
|
|
157
|
+
return WebhookInfo(await self._session.ocs("GET", f"{self._ep_base}/{webhook_id}"))
|
|
158
|
+
|
|
159
|
+
async def register(
|
|
160
|
+
self,
|
|
161
|
+
http_method: str,
|
|
162
|
+
uri: str,
|
|
163
|
+
event: str,
|
|
164
|
+
event_filter: dict | None = None,
|
|
165
|
+
user_id_filter: str = "",
|
|
166
|
+
headers: dict | None = None,
|
|
167
|
+
auth_method: str = "none",
|
|
168
|
+
auth_data: dict | None = None,
|
|
169
|
+
):
|
|
170
|
+
params = {
|
|
171
|
+
"httpMethod": http_method,
|
|
172
|
+
"uri": uri,
|
|
173
|
+
"event": event,
|
|
174
|
+
"eventFilter": event_filter,
|
|
175
|
+
"userIdFilter": user_id_filter,
|
|
176
|
+
"headers": headers,
|
|
177
|
+
"authMethod": auth_method,
|
|
178
|
+
"authData": auth_data,
|
|
179
|
+
}
|
|
180
|
+
clear_from_params_empty(["eventFilter", "userIdFilter", "headers", "authMethod", "authData"], params)
|
|
181
|
+
return WebhookInfo(await self._session.ocs("POST", f"{self._ep_base}", json=params))
|
|
182
|
+
|
|
183
|
+
async def update(
|
|
184
|
+
self,
|
|
185
|
+
webhook_id: int,
|
|
186
|
+
http_method: str,
|
|
187
|
+
uri: str,
|
|
188
|
+
event: str,
|
|
189
|
+
event_filter: dict | None = None,
|
|
190
|
+
user_id_filter: str = "",
|
|
191
|
+
headers: dict | None = None,
|
|
192
|
+
auth_method: str = "none",
|
|
193
|
+
auth_data: dict | None = None,
|
|
194
|
+
):
|
|
195
|
+
params = {
|
|
196
|
+
"id": webhook_id,
|
|
197
|
+
"httpMethod": http_method,
|
|
198
|
+
"uri": uri,
|
|
199
|
+
"event": event,
|
|
200
|
+
"eventFilter": event_filter,
|
|
201
|
+
"userIdFilter": user_id_filter,
|
|
202
|
+
"headers": headers,
|
|
203
|
+
"authMethod": auth_method,
|
|
204
|
+
"authData": auth_data,
|
|
205
|
+
}
|
|
206
|
+
clear_from_params_empty(["eventFilter", "userIdFilter", "headers", "authMethod", "authData"], params)
|
|
207
|
+
return WebhookInfo(await self._session.ocs("POST", f"{self._ep_base}/{webhook_id}", json=params))
|
|
208
|
+
|
|
209
|
+
async def unregister(self, webhook_id: int) -> bool:
|
|
210
|
+
return await self._session.ocs("DELETE", f"{self._ep_base}/{webhook_id}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nc-py-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.15.0
|
|
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/
|
|
@@ -38,13 +38,24 @@ Provides-Extra: app
|
|
|
38
38
|
Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'app'
|
|
39
39
|
Provides-Extra: bench
|
|
40
40
|
Requires-Dist: matplotlib; extra == 'bench'
|
|
41
|
-
Requires-Dist: nc-py-api[app]; extra == 'bench'
|
|
42
41
|
Requires-Dist: numpy; extra == 'bench'
|
|
43
42
|
Requires-Dist: py-cpuinfo; extra == 'bench'
|
|
43
|
+
Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'bench'
|
|
44
44
|
Provides-Extra: calendar
|
|
45
45
|
Requires-Dist: caldav==1.3.6; extra == 'calendar'
|
|
46
46
|
Provides-Extra: dev
|
|
47
|
-
Requires-Dist:
|
|
47
|
+
Requires-Dist: caldav==1.3.6; extra == 'dev'
|
|
48
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
49
|
+
Requires-Dist: huggingface-hub; extra == 'dev'
|
|
50
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
51
|
+
Requires-Dist: numpy; extra == 'dev'
|
|
52
|
+
Requires-Dist: pillow; extra == 'dev'
|
|
53
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
54
|
+
Requires-Dist: py-cpuinfo; extra == 'dev'
|
|
55
|
+
Requires-Dist: pylint; extra == 'dev'
|
|
56
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
57
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
58
|
+
Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'dev'
|
|
48
59
|
Provides-Extra: dev-min
|
|
49
60
|
Requires-Dist: coverage; extra == 'dev-min'
|
|
50
61
|
Requires-Dist: huggingface-hub; extra == 'dev-min'
|
|
@@ -55,12 +66,13 @@ Requires-Dist: pytest; extra == 'dev-min'
|
|
|
55
66
|
Requires-Dist: pytest-asyncio; extra == 'dev-min'
|
|
56
67
|
Provides-Extra: docs
|
|
57
68
|
Requires-Dist: autodoc-pydantic>=2.0.1; extra == 'docs'
|
|
58
|
-
Requires-Dist:
|
|
69
|
+
Requires-Dist: caldav==1.3.6; extra == 'docs'
|
|
59
70
|
Requires-Dist: sphinx-copybutton; extra == 'docs'
|
|
60
71
|
Requires-Dist: sphinx-inline-tabs; extra == 'docs'
|
|
61
72
|
Requires-Dist: sphinx-issues>=3.0.1; extra == 'docs'
|
|
62
73
|
Requires-Dist: sphinx-rtd-theme>=1; extra == 'docs'
|
|
63
74
|
Requires-Dist: sphinx>=6.2; extra == 'docs'
|
|
75
|
+
Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'docs'
|
|
64
76
|
Description-Content-Type: text/markdown
|
|
65
77
|
|
|
66
78
|
<p align="center">
|
|
@@ -73,7 +85,7 @@ Description-Content-Type: text/markdown
|
|
|
73
85
|
[](https://cloud-py-api.github.io/nc_py_api/)
|
|
74
86
|
[](https://codecov.io/github/cloud-py-api/nc_py_api)
|
|
75
87
|
|
|
76
|
-

|
|
77
89
|

|
|
78
90
|

|
|
79
91
|

|
|
@@ -89,7 +101,7 @@ Python library that provides a robust and well-documented API that allows develo
|
|
|
89
101
|
* **Sync + Async**: Provides both sync and async APIs.
|
|
90
102
|
|
|
91
103
|
### Capabilities
|
|
92
|
-
| **_Capability_** | Nextcloud
|
|
104
|
+
| **_Capability_** | Nextcloud 27 | Nextcloud 28 | Nextcloud 29 | Nextcloud 30 |
|
|
93
105
|
|-----------------------|:------------:|:------------:|:------------:|:------------:|
|
|
94
106
|
| Calendar | ✅ | ✅ | ✅ | ✅ |
|
|
95
107
|
| File System & Tags | ✅ | ✅ | ✅ | ✅ |
|
|
@@ -99,9 +111,9 @@ Python library that provides a robust and well-documented API that allows develo
|
|
|
99
111
|
| Users & Groups | ✅ | ✅ | ✅ | ✅ |
|
|
100
112
|
| User & Weather status | ✅ | ✅ | ✅ | ✅ |
|
|
101
113
|
| Other APIs*** | ✅ | ✅ | ✅ | ✅ |
|
|
102
|
-
| Talk Bot API* |
|
|
103
|
-
| Settings UI API* | N/A | N/A |
|
|
104
|
-
| AI Providers API** | N/A | N/A |
|
|
114
|
+
| Talk Bot API* | ✅ | ✅ | ✅ | ✅ |
|
|
115
|
+
| Settings UI API* | N/A | N/A | ✅ | ✅ |
|
|
116
|
+
| AI Providers API** | N/A | N/A | ✅ | ✅ |
|
|
105
117
|
|
|
106
118
|
*_available only for **NextcloudApp**_<br>
|
|
107
119
|
**_available only for **NextcloudApp**: SpeechToText, TextProcessing, Translation_<br>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
nc_py_api/__init__.py,sha256=
|
|
1
|
+
nc_py_api/__init__.py,sha256=FOju0DYizwYYzWBgID8Ebx0GeId-faNqd4Z_3K0216o,439
|
|
2
2
|
nc_py_api/_deffered_error.py,sha256=BpEe_tBqflwfj2Zolb67nhW-K16XX-WbcY2IH_6u8fo,319
|
|
3
3
|
nc_py_api/_exceptions.py,sha256=7vbUECaLmD7RJBCU27t4fuP6NmQK6r4508u_gS4szhI,2298
|
|
4
4
|
nc_py_api/_misc.py,sha256=dUzCP9VmyhtICTsn1aexlFAYUioBm40k6Zh-YE5WwCY,3333
|
|
5
5
|
nc_py_api/_preferences.py,sha256=OtovFZuGHnHYKjdDjSnUappO795tW8Oxj7qVaejHWpQ,2479
|
|
6
6
|
nc_py_api/_preferences_ex.py,sha256=tThj6U0ZZMaBZ-jUkjrbaI0xDnafWsBowQKsC6gjOQs,7179
|
|
7
|
-
nc_py_api/_session.py,sha256=
|
|
7
|
+
nc_py_api/_session.py,sha256=dCXMbxzjHqbqYFhH_qqle5QGPJfuaydqljjmGa0pBnY,20042
|
|
8
8
|
nc_py_api/_talk_api.py,sha256=0Uo7OduYniuuX3UQPb468RyGJJ-PWBCgJ5HoPuz5Qa0,51068
|
|
9
9
|
nc_py_api/_theming.py,sha256=hTr3nuOemSuRFZaPy9iXNmBM7rDgQHECH43tHMWGqEY,1870
|
|
10
|
-
nc_py_api/_version.py,sha256=
|
|
10
|
+
nc_py_api/_version.py,sha256=WuFI1D5uSabdFVmTzxrwUg9lblNKAP09gCFGlHLDAKk,52
|
|
11
11
|
nc_py_api/activity.py,sha256=t9VDSnnaXRNOvALqOSGCeXSQZ-426pCOMSfQ96JHys4,9574
|
|
12
|
-
nc_py_api/apps.py,sha256=
|
|
12
|
+
nc_py_api/apps.py,sha256=tc3Qg-V7au0inUQGOv1Mj7Td5sEGiHOjCjRq1mN41x0,9763
|
|
13
13
|
nc_py_api/calendar.py,sha256=-T6CJ8cRbJZTLtxSEDWuuYpD29DMJGCTfLONmtxZV9w,1445
|
|
14
|
-
nc_py_api/
|
|
14
|
+
nc_py_api/loginflow_v2.py,sha256=UjkK3gMouzNrIS7BFhjbmB_9m4fP2UY5sfpmvJ2EXWk,5760
|
|
15
|
+
nc_py_api/nextcloud.py,sha256=l7ssCAKLogwA1UTTUI9I_PrTZHeLzzYg6MICb2vcy5s,22471
|
|
15
16
|
nc_py_api/notes.py,sha256=ljO3TOe-Qg0bJ0mlFQwjg--Pxmj-XFknoLbcbJmII0A,15106
|
|
16
17
|
nc_py_api/notifications.py,sha256=WgzV21TuLOhLk-UEjhBSbMsIi2isa5MmAx6cbe0pc2Y,9187
|
|
17
18
|
nc_py_api/options.py,sha256=K5co-fIfFVbwF6r3sqWsJF3cKgAbS2CjLAXdyTOkP9s,1717
|
|
@@ -21,29 +22,34 @@ nc_py_api/user_status.py,sha256=I101nwYS8X1WvC8AnLa2f3qJUCPDPHrbq-ke0h1VT4E,1328
|
|
|
21
22
|
nc_py_api/users.py,sha256=ixMHBFJtrlvqmZqJ73VdbOZ6CbRnppdsRpjIJnMUtYY,15488
|
|
22
23
|
nc_py_api/users_groups.py,sha256=IPxw-Ks5NjCm6r8_HC9xmf3IYptH00ulITbp5iazhAo,6289
|
|
23
24
|
nc_py_api/weather_status.py,sha256=wAkjuJPjxc0Rxe4za0BzfwB0XeUmkCXoisJtTH3-qdQ,7582
|
|
24
|
-
nc_py_api/
|
|
25
|
+
nc_py_api/webhooks.py,sha256=-cRqpgQFhjlGV0c7k0vLp2JtVw_UeYElecag650kD64,7044
|
|
26
|
+
nc_py_api/ex_app/__init__.py,sha256=YqzRDfFGe-2BMnkIpPI1ws80uF20FiuvoDaN_KL4xZw,647
|
|
25
27
|
nc_py_api/ex_app/defs.py,sha256=FaQInH3jLugKxDUqpwrXdkMT-lBxmoqWmXJXc11fa6A,727
|
|
26
|
-
nc_py_api/ex_app/
|
|
28
|
+
nc_py_api/ex_app/events_listener.py,sha256=pgQ4hSQV39NuP9F9IDWxo0Qle6oG15-Ol2FlItnIBGY,4682
|
|
29
|
+
nc_py_api/ex_app/integration_fastapi.py,sha256=xh-gSxYH6_FE8GluajlrVAHZg1HZeaAxJ-jIUP6uot4,11022
|
|
27
30
|
nc_py_api/ex_app/misc.py,sha256=wA6KrcB05SQGwVAo7dgBxXAVm_2r9bgDf6SqioyOJPc,2286
|
|
31
|
+
nc_py_api/ex_app/occ_commands.py,sha256=hb2BJuvFKIigvLycSCyAe9v6hedq4Gfu2junQZTaK_M,5219
|
|
28
32
|
nc_py_api/ex_app/persist_transformers_cache.py,sha256=ZoEBb1RnNaQrtxK_CjSZ8LZ36Oakz2Xciau_ZpNp8Ic,213
|
|
29
33
|
nc_py_api/ex_app/uvicorn_fastapi.py,sha256=WLtNmWXMBKN6CMip2uhKcgy4mC2Ch9AmNfwRScBUsP0,752
|
|
30
34
|
nc_py_api/ex_app/providers/__init__.py,sha256=jmUBdbAgzUCdYyHl8V5UCNYJI-FFpxPQQ4iEAoURKQs,43
|
|
31
|
-
nc_py_api/ex_app/providers/providers.py,sha256=
|
|
35
|
+
nc_py_api/ex_app/providers/providers.py,sha256=_1zWAgg9ol2u82Huf-yxFfxviGwtEeLIxDWTTYY2jJQ,1955
|
|
32
36
|
nc_py_api/ex_app/providers/speech_to_text.py,sha256=JFD1ksdhXjpr5UFm5npqCxepqB5x-kdHG9CpPoGofx0,4959
|
|
37
|
+
nc_py_api/ex_app/providers/task_processing.py,sha256=zZHjOwTwNIRV5e25jm4Yy4eR0weGwvaU-ooY5YNYsfg,7656
|
|
33
38
|
nc_py_api/ex_app/providers/text_processing.py,sha256=VUZMZ2fof-c6JD7mTKHTZBWbDMOqxDllMCNQFOlHXXk,5265
|
|
34
39
|
nc_py_api/ex_app/providers/translations.py,sha256=io8UgVhdQXFmP7KnrJQx5Vtl8Dz0Z0EVZ0bt3hV7C7A,6112
|
|
35
40
|
nc_py_api/ex_app/ui/__init__.py,sha256=jUMU7_miFF-Q8BQNT90KZYQiLy_a3OvEyK6y8eRMKRk,38
|
|
36
|
-
nc_py_api/ex_app/ui/files_actions.py,sha256=
|
|
41
|
+
nc_py_api/ex_app/ui/files_actions.py,sha256=pKe0VSSy5Zl0NwPe8rwdL_NL374n-0_XBf6M5HmKoIU,7384
|
|
37
42
|
nc_py_api/ex_app/ui/resources.py,sha256=Vwx69oZ93Ouh6HJtGUqaKFUr4Reo74H4vT1YCpb-7j0,12492
|
|
38
43
|
nc_py_api/ex_app/ui/settings.py,sha256=f0R17lGhBfo2JQULVw_hFxhpfoPw_CW7vBu0Rb1ABJw,6623
|
|
39
44
|
nc_py_api/ex_app/ui/top_menu.py,sha256=oCgGtIoMYbp-5iN5aXEbT7Q88HtccR7hg6IBFgbbyX4,5118
|
|
40
45
|
nc_py_api/ex_app/ui/ui.py,sha256=OqFHKn6oIZli8T1wnv6YtQ4glNfeNb90WwGCvtWI1Z4,1632
|
|
41
|
-
nc_py_api/files/__init__.py,sha256=
|
|
42
|
-
nc_py_api/files/_files.py,sha256=
|
|
43
|
-
nc_py_api/files/files.py,sha256=
|
|
46
|
+
nc_py_api/files/__init__.py,sha256=p1RecBNkZCuu8_mf-y_mkbotj9fGsCDSFRl7hGkI1CA,17003
|
|
47
|
+
nc_py_api/files/_files.py,sha256=_s_f8xbzQPEH2F2LNwomI9CxscYHryus1pMZ_vW00C4,13666
|
|
48
|
+
nc_py_api/files/files.py,sha256=Yj388MJp_EdM-2neM9EnALaLnSR6zMJbYxXzHpHmOmI,24577
|
|
49
|
+
nc_py_api/files/files_async.py,sha256=rEIT6P1Pb7TeTub1dAB5IKpR4LDqHWc5LclAEzpiHEQ,25410
|
|
44
50
|
nc_py_api/files/sharing.py,sha256=VRZCl-TYK6dbu9rUHPs3_jcVozu1EO8bLGZwoRpiLsU,14439
|
|
45
|
-
nc_py_api-0.
|
|
46
|
-
nc_py_api-0.
|
|
47
|
-
nc_py_api-0.
|
|
48
|
-
nc_py_api-0.
|
|
49
|
-
nc_py_api-0.
|
|
51
|
+
nc_py_api-0.15.0.dist-info/METADATA,sha256=oj0llVaMYlQRj39-eSjdhXsbFIOs0ggj3NmWOvDuz1A,9466
|
|
52
|
+
nc_py_api-0.15.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
53
|
+
nc_py_api-0.15.0.dist-info/licenses/AUTHORS,sha256=Y1omFHyI8ned9k4jJXs2ATgmgi1GmQ7EZ6S1gxqnX2k,572
|
|
54
|
+
nc_py_api-0.15.0.dist-info/licenses/LICENSE.txt,sha256=OLEMh401fAumGHfRSna365MLIfnjdTcdOHZ6QOzMjkg,1551
|
|
55
|
+
nc_py_api-0.15.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|