nc-py-api 0.10.0__py3-none-any.whl → 0.18.1__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: nc-py-api
3
- Version: 0.10.0
3
+ Version: 0.18.1
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/
@@ -10,7 +10,7 @@ License-Expression: BSD-3-Clause
10
10
  License-File: AUTHORS
11
11
  License-File: LICENSE.txt
12
12
  Keywords: api,client,framework,library,nextcloud
13
- Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Development Status :: 4 - Beta
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: License :: OSI Approved :: BSD License
16
16
  Classifier: Operating System :: MacOS :: MacOS X
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
25
  Classifier: Programming Language :: Python :: Implementation :: PyPy
25
26
  Classifier: Topic :: Internet :: WWW/HTTP
@@ -38,13 +39,24 @@ Provides-Extra: app
38
39
  Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'app'
39
40
  Provides-Extra: bench
40
41
  Requires-Dist: matplotlib; extra == 'bench'
41
- Requires-Dist: nc-py-api[app]; extra == 'bench'
42
42
  Requires-Dist: numpy; extra == 'bench'
43
43
  Requires-Dist: py-cpuinfo; extra == 'bench'
44
+ Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'bench'
44
45
  Provides-Extra: calendar
45
46
  Requires-Dist: caldav==1.3.6; extra == 'calendar'
46
47
  Provides-Extra: dev
47
- Requires-Dist: nc-py-api[bench,calendar,dev-min]; extra == 'dev'
48
+ Requires-Dist: caldav==1.3.6; extra == 'dev'
49
+ Requires-Dist: coverage; extra == 'dev'
50
+ Requires-Dist: huggingface-hub; extra == 'dev'
51
+ Requires-Dist: matplotlib; extra == 'dev'
52
+ Requires-Dist: numpy; extra == 'dev'
53
+ Requires-Dist: pillow; extra == 'dev'
54
+ Requires-Dist: pre-commit; extra == 'dev'
55
+ Requires-Dist: py-cpuinfo; extra == 'dev'
56
+ Requires-Dist: pylint; extra == 'dev'
57
+ Requires-Dist: pytest; extra == 'dev'
58
+ Requires-Dist: pytest-asyncio; extra == 'dev'
59
+ Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'dev'
48
60
  Provides-Extra: dev-min
49
61
  Requires-Dist: coverage; extra == 'dev-min'
50
62
  Requires-Dist: huggingface-hub; extra == 'dev-min'
@@ -55,12 +67,13 @@ Requires-Dist: pytest; extra == 'dev-min'
55
67
  Requires-Dist: pytest-asyncio; extra == 'dev-min'
56
68
  Provides-Extra: docs
57
69
  Requires-Dist: autodoc-pydantic>=2.0.1; extra == 'docs'
58
- Requires-Dist: nc-py-api[app,calendar]; extra == 'docs'
70
+ Requires-Dist: caldav==1.3.6; extra == 'docs'
59
71
  Requires-Dist: sphinx-copybutton; extra == 'docs'
60
72
  Requires-Dist: sphinx-inline-tabs; extra == 'docs'
61
73
  Requires-Dist: sphinx-issues>=3.0.1; extra == 'docs'
62
- Requires-Dist: sphinx-rtd-theme>=1; extra == 'docs'
63
- Requires-Dist: sphinx>=6.2; extra == 'docs'
74
+ Requires-Dist: sphinx-rtd-theme<3; extra == 'docs'
75
+ Requires-Dist: sphinx<8; extra == 'docs'
76
+ Requires-Dist: uvicorn[standard]>=0.23.2; extra == 'docs'
64
77
  Description-Content-Type: text/markdown
65
78
 
66
79
  <p align="center">
@@ -73,7 +86,7 @@ Description-Content-Type: text/markdown
73
86
  [![Docs](https://github.com/cloud-py-api/nc_py_api/actions/workflows/docs.yml/badge.svg)](https://cloud-py-api.github.io/nc_py_api/)
74
87
  [![codecov](https://codecov.io/github/cloud-py-api/nc_py_api/branch/main/graph/badge.svg?token=C91PL3FYDQ)](https://codecov.io/github/cloud-py-api/nc_py_api)
75
88
 
76
- ![NextcloudVersion](https://img.shields.io/badge/Nextcloud-26%20%7C%2027%20%7C%2028-blue)
89
+ ![NextcloudVersion](https://img.shields.io/badge/Nextcloud-27%20%7C%2028%20%7C%2029%20%7C%2030-blue)
77
90
  ![PythonVersion](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
78
91
  ![impl](https://img.shields.io/pypi/implementation/nc_py_api)
79
92
  ![pypi](https://img.shields.io/pypi/v/nc_py_api.svg)
@@ -89,23 +102,22 @@ Python library that provides a robust and well-documented API that allows develo
89
102
  * **Sync + Async**: Provides both sync and async APIs.
90
103
 
91
104
  ### Capabilities
92
- | **_Capability_** | Nextcloud 26 | Nextcloud 27 | Nextcloud 28 | Nextcloud 29 |
93
- |-----------------------|:------------:|:------------:|:------------:|:------------:|
94
- | Calendar | ✅ | ✅ | ✅ | ✅ |
95
- | File System & Tags | ✅ | ✅ | ✅ | ✅ |
96
- | Nextcloud Talk | ✅ | ✅ | ✅ | ✅ |
97
- | Notifications | ✅ | ✅ | ✅ | ✅ |
98
- | Shares | ✅ | ✅ | ✅ | ✅ |
99
- | Users & Groups | ✅ | ✅ | ✅ | ✅ |
100
- | User & Weather status | ✅ | ✅ | ✅ | ✅ |
101
- | Other APIs*** | ✅ | ✅ | ✅ | ✅ |
102
- | Talk Bot API* | N/A | ✅ | ✅ | ✅ |
103
- | Settings UI API* | N/A | N/A | N/A | ✅ |
104
- | AI Providers API** | N/A | N/A | N/A | ✅ |
105
+ | **_Capability_** | Nextcloud 27 | Nextcloud 28 | Nextcloud 29 | Nextcloud 30 |
106
+ |------------------------------|:------------:|:------------:|:------------:|:------------:|
107
+ | Calendar | ✅ | ✅ | ✅ | ✅ |
108
+ | File System & Tags | ✅ | ✅ | ✅ | ✅ |
109
+ | Nextcloud Talk | ✅ | ✅ | ✅ | ✅ |
110
+ | Notifications | ✅ | ✅ | ✅ | ✅ |
111
+ | Shares | ✅ | ✅ | ✅ | ✅ |
112
+ | Users & Groups | ✅ | ✅ | ✅ | ✅ |
113
+ | User & Weather status | ✅ | ✅ | ✅ | ✅ |
114
+ | Other APIs** | ✅ | ✅ | ✅ | ✅ |
115
+ | Talk Bot API* | | ✅ | ✅ | ✅ |
116
+ | Settings UI API* | N/A | N/A | | ✅ |
117
+ | TaskProcessing Provider API* | N/A | N/A | N/A | ✅ |
105
118
 
106
119
  &ast;_available only for **NextcloudApp**_<br>
107
- &ast;&ast;_available only for **NextcloudApp**: SpeechToText, TextProcessing, Translation_<br>
108
- &ast;&ast;&ast;_Activity, Notes_
120
+ &ast;&ast;_Activity, Notes_
109
121
 
110
122
  ### Differences between the Nextcloud and NextcloudApp classes
111
123
 
@@ -0,0 +1,53 @@
1
+ nc_py_api/__init__.py,sha256=FOju0DYizwYYzWBgID8Ebx0GeId-faNqd4Z_3K0216o,439
2
+ nc_py_api/_deffered_error.py,sha256=BpEe_tBqflwfj2Zolb67nhW-K16XX-WbcY2IH_6u8fo,319
3
+ nc_py_api/_exceptions.py,sha256=7vbUECaLmD7RJBCU27t4fuP6NmQK6r4508u_gS4szhI,2298
4
+ nc_py_api/_misc.py,sha256=dUzCP9VmyhtICTsn1aexlFAYUioBm40k6Zh-YE5WwCY,3333
5
+ nc_py_api/_preferences.py,sha256=OtovFZuGHnHYKjdDjSnUappO795tW8Oxj7qVaejHWpQ,2479
6
+ nc_py_api/_preferences_ex.py,sha256=tThj6U0ZZMaBZ-jUkjrbaI0xDnafWsBowQKsC6gjOQs,7179
7
+ nc_py_api/_session.py,sha256=ZD0TKrL-tOpxYtV6AO0cwRrYzbnjBr_ylCEUirrykjU,20242
8
+ nc_py_api/_talk_api.py,sha256=0Uo7OduYniuuX3UQPb468RyGJJ-PWBCgJ5HoPuz5Qa0,51068
9
+ nc_py_api/_theming.py,sha256=hTr3nuOemSuRFZaPy9iXNmBM7rDgQHECH43tHMWGqEY,1870
10
+ nc_py_api/_version.py,sha256=vPHaIX0sBYHr1ilh-YTVqasI6cM7TDtyHmVDvps_3zY,52
11
+ nc_py_api/activity.py,sha256=t9VDSnnaXRNOvALqOSGCeXSQZ-426pCOMSfQ96JHys4,9574
12
+ nc_py_api/apps.py,sha256=Us2y2lszdxXlD8t6kxwd5_Nrrmazc0EvZXIH9O-ol80,9315
13
+ nc_py_api/calendar.py,sha256=-T6CJ8cRbJZTLtxSEDWuuYpD29DMJGCTfLONmtxZV9w,1445
14
+ nc_py_api/loginflow_v2.py,sha256=UjkK3gMouzNrIS7BFhjbmB_9m4fP2UY5sfpmvJ2EXWk,5760
15
+ nc_py_api/nextcloud.py,sha256=Uc4hOtLNkvl8sjKmAGS-vyKdiA1gEZwRr1wj0Sd_ONk,23005
16
+ nc_py_api/notes.py,sha256=ljO3TOe-Qg0bJ0mlFQwjg--Pxmj-XFknoLbcbJmII0A,15106
17
+ nc_py_api/notifications.py,sha256=WgzV21TuLOhLk-UEjhBSbMsIi2isa5MmAx6cbe0pc2Y,9187
18
+ nc_py_api/options.py,sha256=K5co-fIfFVbwF6r3sqWsJF3cKgAbS2CjLAXdyTOkP9s,1717
19
+ nc_py_api/talk.py,sha256=OZFemYkDOaM6o4xAK3EvQbjMFiK75E5qnsCDyihIElg,29368
20
+ nc_py_api/talk_bot.py,sha256=_RuImwb3jYvUKX3ywcX095ucOjECCxsuc59heIxNoTM,16725
21
+ nc_py_api/user_status.py,sha256=I101nwYS8X1WvC8AnLa2f3qJUCPDPHrbq-ke0h1VT4E,13282
22
+ nc_py_api/users.py,sha256=SQG8Agplaxy7XJgguK-rxV-azpc-QdktbDmLmQtJkXo,15476
23
+ nc_py_api/users_groups.py,sha256=IPxw-Ks5NjCm6r8_HC9xmf3IYptH00ulITbp5iazhAo,6289
24
+ nc_py_api/weather_status.py,sha256=wAkjuJPjxc0Rxe4za0BzfwB0XeUmkCXoisJtTH3-qdQ,7582
25
+ nc_py_api/webhooks.py,sha256=14nAMy-tnOvmRnJbo42zUHyjX-z6kc9OMDUVKzNmplY,7769
26
+ nc_py_api/ex_app/__init__.py,sha256=hFbu6wTXs-wmjs1tavm_HYLwiqgrp7_qJe-stzCiqfI,692
27
+ nc_py_api/ex_app/defs.py,sha256=FaQInH3jLugKxDUqpwrXdkMT-lBxmoqWmXJXc11fa6A,727
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
30
+ nc_py_api/ex_app/logging.py,sha256=nAHLObuPvl3UBLrlqZulgoxxVaAJ661iP4F6bTW-V-Y,1475
31
+ nc_py_api/ex_app/misc.py,sha256=c7B0uE8isaIi4SQbxURGUuWjZaaXiLg3Ov6cqvRYplE,2298
32
+ nc_py_api/ex_app/occ_commands.py,sha256=hb2BJuvFKIigvLycSCyAe9v6hedq4Gfu2junQZTaK_M,5219
33
+ nc_py_api/ex_app/persist_transformers_cache.py,sha256=ZoEBb1RnNaQrtxK_CjSZ8LZ36Oakz2Xciau_ZpNp8Ic,213
34
+ nc_py_api/ex_app/uvicorn_fastapi.py,sha256=WLtNmWXMBKN6CMip2uhKcgy4mC2Ch9AmNfwRScBUsP0,752
35
+ nc_py_api/ex_app/providers/__init__.py,sha256=jmUBdbAgzUCdYyHl8V5UCNYJI-FFpxPQQ4iEAoURKQs,43
36
+ nc_py_api/ex_app/providers/providers.py,sha256=uGo02dXpxlMOtBpPr_gH4ZPt7foQx_MB5iTlJHEllNA,786
37
+ nc_py_api/ex_app/providers/task_processing.py,sha256=h-H3fGK30c9M-VUpk7I9WGc730t9OCoSZ6vf7lB7xdA,9874
38
+ nc_py_api/ex_app/ui/__init__.py,sha256=jUMU7_miFF-Q8BQNT90KZYQiLy_a3OvEyK6y8eRMKRk,38
39
+ nc_py_api/ex_app/ui/files_actions.py,sha256=pKe0VSSy5Zl0NwPe8rwdL_NL374n-0_XBf6M5HmKoIU,7384
40
+ nc_py_api/ex_app/ui/resources.py,sha256=Vwx69oZ93Ouh6HJtGUqaKFUr4Reo74H4vT1YCpb-7j0,12492
41
+ nc_py_api/ex_app/ui/settings.py,sha256=f0R17lGhBfo2JQULVw_hFxhpfoPw_CW7vBu0Rb1ABJw,6623
42
+ nc_py_api/ex_app/ui/top_menu.py,sha256=oCgGtIoMYbp-5iN5aXEbT7Q88HtccR7hg6IBFgbbyX4,5118
43
+ nc_py_api/ex_app/ui/ui.py,sha256=OqFHKn6oIZli8T1wnv6YtQ4glNfeNb90WwGCvtWI1Z4,1632
44
+ nc_py_api/files/__init__.py,sha256=uSjqZyYAq9x3xOb_yz15KNNAcPo1PhbpPLtPz_ej-Eo,17303
45
+ nc_py_api/files/_files.py,sha256=_s_f8xbzQPEH2F2LNwomI9CxscYHryus1pMZ_vW00C4,13666
46
+ nc_py_api/files/files.py,sha256=7x4hfnVa2y1R5bxK9f8cdggi1gPnpUYnsBj0e4p-4qc,24926
47
+ nc_py_api/files/files_async.py,sha256=nyDeWiGx_8CHuVrNThSgfZy0l-WlC4El-TzJONo0TsM,25773
48
+ nc_py_api/files/sharing.py,sha256=VRZCl-TYK6dbu9rUHPs3_jcVozu1EO8bLGZwoRpiLsU,14439
49
+ nc_py_api-0.18.1.dist-info/METADATA,sha256=kNiYxJLCeclDF7NYY0B3sa9nXkqqm7T1yfZfE4Yx7GE,9502
50
+ nc_py_api-0.18.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
51
+ nc_py_api-0.18.1.dist-info/licenses/AUTHORS,sha256=B2Q9q9XH3PAxJp0V3GiKQc1l0z7vtGDpDHqda-ISWKM,616
52
+ nc_py_api-0.18.1.dist-info/licenses/LICENSE.txt,sha256=OLEMh401fAumGHfRSna365MLIfnjdTcdOHZ6QOzMjkg,1551
53
+ nc_py_api-0.18.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.21.1
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -6,6 +6,7 @@ answer newbie questions, and generally made NC-Py-API that much better:
6
6
  Alexander Piskun <bigcat88@icloud.com>
7
7
  CooperGerman <https://github.com/CooperGerman>
8
8
  Tobias Tschech <Tobias@tschech-online.de>
9
+ Scott Williams <scottwilliams@ucsb.edu>
9
10
  <Please alphabetize new entries>
10
11
 
11
12
  A big THANK YOU goes to:
@@ -1,128 +0,0 @@
1
- """Nextcloud API for declaring SpeechToText provider."""
2
-
3
- import contextlib
4
- import dataclasses
5
-
6
- from ..._exceptions import NextcloudException, NextcloudExceptionNotFound
7
- from ..._misc import require_capabilities
8
- from ..._session import AsyncNcSessionApp, NcSessionApp
9
-
10
- _EP_SUFFIX: str = "ai_provider/speech_to_text"
11
-
12
-
13
- @dataclasses.dataclass
14
- class SpeechToTextProvider:
15
- """Speech2Text provider description."""
16
-
17
- def __init__(self, raw_data: dict):
18
- self._raw_data = raw_data
19
-
20
- @property
21
- def name(self) -> str:
22
- """Unique ID for the provider."""
23
- return self._raw_data["name"]
24
-
25
- @property
26
- def display_name(self) -> str:
27
- """Providers display name."""
28
- return self._raw_data["display_name"]
29
-
30
- @property
31
- def action_handler(self) -> str:
32
- """Relative ExApp url which will be called by Nextcloud."""
33
- return self._raw_data["action_handler"]
34
-
35
- def __repr__(self):
36
- return f"<{self.__class__.__name__} name={self.name}, handler={self.action_handler}>"
37
-
38
-
39
- class _SpeechToTextProviderAPI:
40
- """API for Speech2Text providers, avalaible as **nc.providers.text_processing.<method>**."""
41
-
42
- def __init__(self, session: NcSessionApp):
43
- self._session = session
44
-
45
- def register(self, name: str, display_name: str, callback_url: str) -> None:
46
- """Registers or edit the SpeechToText provider."""
47
- require_capabilities("app_api", self._session.capabilities)
48
- params = {
49
- "name": name,
50
- "displayName": display_name,
51
- "actionHandler": callback_url,
52
- }
53
- self._session.ocs("POST", f"{self._session.ae_url}/{_EP_SUFFIX}", json=params)
54
-
55
- def unregister(self, name: str, not_fail=True) -> None:
56
- """Removes SpeechToText provider."""
57
- require_capabilities("app_api", self._session.capabilities)
58
- try:
59
- self._session.ocs("DELETE", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
60
- except NextcloudExceptionNotFound as e:
61
- if not not_fail:
62
- raise e from None
63
-
64
- def get_entry(self, name: str) -> SpeechToTextProvider | None:
65
- """Get information of the SpeechToText."""
66
- require_capabilities("app_api", self._session.capabilities)
67
- try:
68
- return SpeechToTextProvider(
69
- self._session.ocs("GET", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
70
- )
71
- except NextcloudExceptionNotFound:
72
- return None
73
-
74
- def report_result(self, task_id: int, result: str = "", error: str = "") -> None:
75
- """Report results of speech to text task to Nextcloud."""
76
- require_capabilities("app_api", self._session.capabilities)
77
- with contextlib.suppress(NextcloudException):
78
- self._session.ocs(
79
- "PUT",
80
- f"{self._session.ae_url}/{_EP_SUFFIX}",
81
- json={"taskId": task_id, "result": result, "error": error},
82
- )
83
-
84
-
85
- class _AsyncSpeechToTextProviderAPI:
86
- """Async API for Speech2Text providers."""
87
-
88
- def __init__(self, session: AsyncNcSessionApp):
89
- self._session = session
90
-
91
- async def register(self, name: str, display_name: str, callback_url: str) -> None:
92
- """Registers or edit the SpeechToText provider."""
93
- require_capabilities("app_api", await self._session.capabilities)
94
- params = {
95
- "name": name,
96
- "displayName": display_name,
97
- "actionHandler": callback_url,
98
- }
99
- await self._session.ocs("POST", f"{self._session.ae_url}/{_EP_SUFFIX}", json=params)
100
-
101
- async def unregister(self, name: str, not_fail=True) -> None:
102
- """Removes SpeechToText provider."""
103
- require_capabilities("app_api", await self._session.capabilities)
104
- try:
105
- await self._session.ocs("DELETE", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
106
- except NextcloudExceptionNotFound as e:
107
- if not not_fail:
108
- raise e from None
109
-
110
- async def get_entry(self, name: str) -> SpeechToTextProvider | None:
111
- """Get information of the SpeechToText."""
112
- require_capabilities("app_api", await self._session.capabilities)
113
- try:
114
- return SpeechToTextProvider(
115
- await self._session.ocs("GET", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
116
- )
117
- except NextcloudExceptionNotFound:
118
- return None
119
-
120
- async def report_result(self, task_id: int, result: str = "", error: str = "") -> None:
121
- """Report results of speech to text task to Nextcloud."""
122
- require_capabilities("app_api", await self._session.capabilities)
123
- with contextlib.suppress(NextcloudException):
124
- await self._session.ocs(
125
- "PUT",
126
- f"{self._session.ae_url}/{_EP_SUFFIX}",
127
- json={"taskId": task_id, "result": result, "error": error},
128
- )
@@ -1,135 +0,0 @@
1
- """Nextcloud API for declaring TextProcessing provider."""
2
-
3
- import contextlib
4
- import dataclasses
5
-
6
- from ..._exceptions import NextcloudException, NextcloudExceptionNotFound
7
- from ..._misc import require_capabilities
8
- from ..._session import AsyncNcSessionApp, NcSessionApp
9
-
10
- _EP_SUFFIX: str = "ai_provider/text_processing"
11
-
12
-
13
- @dataclasses.dataclass
14
- class TextProcessingProvider:
15
- """TextProcessing provider description."""
16
-
17
- def __init__(self, raw_data: dict):
18
- self._raw_data = raw_data
19
-
20
- @property
21
- def name(self) -> str:
22
- """Unique ID for the provider."""
23
- return self._raw_data["name"]
24
-
25
- @property
26
- def display_name(self) -> str:
27
- """Providers display name."""
28
- return self._raw_data["display_name"]
29
-
30
- @property
31
- def action_handler(self) -> str:
32
- """Relative ExApp url which will be called by Nextcloud."""
33
- return self._raw_data["action_handler"]
34
-
35
- @property
36
- def task_type(self) -> str:
37
- """The TaskType provided by this provider."""
38
- return self._raw_data["task_type"]
39
-
40
- def __repr__(self):
41
- return f"<{self.__class__.__name__} name={self.name}, type={self.task_type}, handler={self.action_handler}>"
42
-
43
-
44
- class _TextProcessingProviderAPI:
45
- """API for TextProcessing providers, avalaible as **nc.providers.speech_to_text.<method>**."""
46
-
47
- def __init__(self, session: NcSessionApp):
48
- self._session = session
49
-
50
- def register(self, name: str, display_name: str, callback_url: str, task_type: str) -> None:
51
- """Registers or edit the TextProcessing provider."""
52
- require_capabilities("app_api", self._session.capabilities)
53
- params = {
54
- "name": name,
55
- "displayName": display_name,
56
- "actionHandler": callback_url,
57
- "taskType": task_type,
58
- }
59
- self._session.ocs("POST", f"{self._session.ae_url}/{_EP_SUFFIX}", json=params)
60
-
61
- def unregister(self, name: str, not_fail=True) -> None:
62
- """Removes TextProcessing provider."""
63
- require_capabilities("app_api", self._session.capabilities)
64
- try:
65
- self._session.ocs("DELETE", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
66
- except NextcloudExceptionNotFound as e:
67
- if not not_fail:
68
- raise e from None
69
-
70
- def get_entry(self, name: str) -> TextProcessingProvider | None:
71
- """Get information of the TextProcessing."""
72
- require_capabilities("app_api", self._session.capabilities)
73
- try:
74
- return TextProcessingProvider(
75
- self._session.ocs("GET", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
76
- )
77
- except NextcloudExceptionNotFound:
78
- return None
79
-
80
- def report_result(self, task_id: int, result: str = "", error: str = "") -> None:
81
- """Report results of the text processing to Nextcloud."""
82
- require_capabilities("app_api", self._session.capabilities)
83
- with contextlib.suppress(NextcloudException):
84
- self._session.ocs(
85
- "PUT",
86
- f"{self._session.ae_url}/{_EP_SUFFIX}",
87
- json={"taskId": task_id, "result": result, "error": error},
88
- )
89
-
90
-
91
- class _AsyncTextProcessingProviderAPI:
92
- """Async API for TextProcessing providers."""
93
-
94
- def __init__(self, session: AsyncNcSessionApp):
95
- self._session = session
96
-
97
- async def register(self, name: str, display_name: str, callback_url: str, task_type: str) -> None:
98
- """Registers or edit the TextProcessing provider."""
99
- require_capabilities("app_api", await self._session.capabilities)
100
- params = {
101
- "name": name,
102
- "displayName": display_name,
103
- "actionHandler": callback_url,
104
- "taskType": task_type,
105
- }
106
- await self._session.ocs("POST", f"{self._session.ae_url}/{_EP_SUFFIX}", json=params)
107
-
108
- async def unregister(self, name: str, not_fail=True) -> None:
109
- """Removes TextProcessing provider."""
110
- require_capabilities("app_api", await self._session.capabilities)
111
- try:
112
- await self._session.ocs("DELETE", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
113
- except NextcloudExceptionNotFound as e:
114
- if not not_fail:
115
- raise e from None
116
-
117
- async def get_entry(self, name: str) -> TextProcessingProvider | None:
118
- """Get information of the TextProcessing."""
119
- require_capabilities("app_api", await self._session.capabilities)
120
- try:
121
- return TextProcessingProvider(
122
- await self._session.ocs("GET", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
123
- )
124
- except NextcloudExceptionNotFound:
125
- return None
126
-
127
- async def report_result(self, task_id: int, result: str = "", error: str = "") -> None:
128
- """Report results of the text processing to Nextcloud."""
129
- require_capabilities("app_api", await self._session.capabilities)
130
- with contextlib.suppress(NextcloudException):
131
- await self._session.ocs(
132
- "PUT",
133
- f"{self._session.ae_url}/{_EP_SUFFIX}",
134
- json={"taskId": task_id, "result": result, "error": error},
135
- )
@@ -1,156 +0,0 @@
1
- """Nextcloud API for declaring Translations provider."""
2
-
3
- import contextlib
4
- import dataclasses
5
-
6
- from ..._exceptions import NextcloudException, NextcloudExceptionNotFound
7
- from ..._misc import require_capabilities
8
- from ..._session import AsyncNcSessionApp, NcSessionApp
9
-
10
- _EP_SUFFIX: str = "ai_provider/translation"
11
-
12
-
13
- @dataclasses.dataclass
14
- class TranslationsProvider:
15
- """Translations provider description."""
16
-
17
- def __init__(self, raw_data: dict):
18
- self._raw_data = raw_data
19
-
20
- @property
21
- def name(self) -> str:
22
- """Unique ID for the provider."""
23
- return self._raw_data["name"]
24
-
25
- @property
26
- def display_name(self) -> str:
27
- """Providers display name."""
28
- return self._raw_data["display_name"]
29
-
30
- @property
31
- def from_languages(self) -> dict[str, str]:
32
- """Input languages supported by provider."""
33
- return self._raw_data["from_languages"]
34
-
35
- @property
36
- def to_languages(self) -> dict[str, str]:
37
- """Output languages supported by provider."""
38
- return self._raw_data["to_languages"]
39
-
40
- @property
41
- def action_handler(self) -> str:
42
- """Relative ExApp url which will be called by Nextcloud."""
43
- return self._raw_data["action_handler"]
44
-
45
- def __repr__(self):
46
- return f"<{self.__class__.__name__} name={self.name}, handler={self.action_handler}>"
47
-
48
-
49
- class _TranslationsProviderAPI:
50
- """API for Translations providers, avalaible as **nc.providers.translations.<method>**."""
51
-
52
- def __init__(self, session: NcSessionApp):
53
- self._session = session
54
-
55
- def register(
56
- self,
57
- name: str,
58
- display_name: str,
59
- callback_url: str,
60
- from_languages: dict[str, str],
61
- to_languages: dict[str, str],
62
- ) -> None:
63
- """Registers or edit the Translations provider."""
64
- require_capabilities("app_api", self._session.capabilities)
65
- params = {
66
- "name": name,
67
- "displayName": display_name,
68
- "fromLanguages": from_languages,
69
- "toLanguages": to_languages,
70
- "actionHandler": callback_url,
71
- }
72
- self._session.ocs("POST", f"{self._session.ae_url}/{_EP_SUFFIX}", json=params)
73
-
74
- def unregister(self, name: str, not_fail=True) -> None:
75
- """Removes Translations provider."""
76
- require_capabilities("app_api", self._session.capabilities)
77
- try:
78
- self._session.ocs("DELETE", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
79
- except NextcloudExceptionNotFound as e:
80
- if not not_fail:
81
- raise e from None
82
-
83
- def get_entry(self, name: str) -> TranslationsProvider | None:
84
- """Get information of the TranslationsProvider."""
85
- require_capabilities("app_api", self._session.capabilities)
86
- try:
87
- return TranslationsProvider(
88
- self._session.ocs("GET", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
89
- )
90
- except NextcloudExceptionNotFound:
91
- return None
92
-
93
- def report_result(self, task_id: int, result: str = "", error: str = "") -> None:
94
- """Report results of translation task to Nextcloud."""
95
- require_capabilities("app_api", self._session.capabilities)
96
- with contextlib.suppress(NextcloudException):
97
- self._session.ocs(
98
- "PUT",
99
- f"{self._session.ae_url}/{_EP_SUFFIX}",
100
- json={"taskId": task_id, "result": result, "error": error},
101
- )
102
-
103
-
104
- class _AsyncTranslationsProviderAPI:
105
- """Async API for Translations providers."""
106
-
107
- def __init__(self, session: AsyncNcSessionApp):
108
- self._session = session
109
-
110
- async def register(
111
- self,
112
- name: str,
113
- display_name: str,
114
- callback_url: str,
115
- from_languages: dict[str, str],
116
- to_languages: dict[str, str],
117
- ) -> None:
118
- """Registers or edit the Translations provider."""
119
- require_capabilities("app_api", await self._session.capabilities)
120
- params = {
121
- "name": name,
122
- "displayName": display_name,
123
- "fromLanguages": from_languages,
124
- "toLanguages": to_languages,
125
- "actionHandler": callback_url,
126
- }
127
- await self._session.ocs("POST", f"{self._session.ae_url}/{_EP_SUFFIX}", json=params)
128
-
129
- async def unregister(self, name: str, not_fail=True) -> None:
130
- """Removes Translations provider."""
131
- require_capabilities("app_api", await self._session.capabilities)
132
- try:
133
- await self._session.ocs("DELETE", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
134
- except NextcloudExceptionNotFound as e:
135
- if not not_fail:
136
- raise e from None
137
-
138
- async def get_entry(self, name: str) -> TranslationsProvider | None:
139
- """Get information of the TranslationsProvider."""
140
- require_capabilities("app_api", await self._session.capabilities)
141
- try:
142
- return TranslationsProvider(
143
- await self._session.ocs("GET", f"{self._session.ae_url}/{_EP_SUFFIX}", params={"name": name})
144
- )
145
- except NextcloudExceptionNotFound:
146
- return None
147
-
148
- async def report_result(self, task_id: int, result: str = "", error: str = "") -> None:
149
- """Report results of translation task to Nextcloud."""
150
- require_capabilities("app_api", await self._session.capabilities)
151
- with contextlib.suppress(NextcloudException):
152
- await self._session.ocs(
153
- "PUT",
154
- f"{self._session.ae_url}/{_EP_SUFFIX}",
155
- json={"taskId": task_id, "result": result, "error": error},
156
- )
@@ -1,49 +0,0 @@
1
- nc_py_api/__init__.py,sha256=IHPyeXjkOwX6cJlYGnyPpF9RR5E7E3LZ6lAuZ3J_L4M,418
2
- nc_py_api/_deffered_error.py,sha256=BpEe_tBqflwfj2Zolb67nhW-K16XX-WbcY2IH_6u8fo,319
3
- nc_py_api/_exceptions.py,sha256=7vbUECaLmD7RJBCU27t4fuP6NmQK6r4508u_gS4szhI,2298
4
- nc_py_api/_misc.py,sha256=dUzCP9VmyhtICTsn1aexlFAYUioBm40k6Zh-YE5WwCY,3333
5
- nc_py_api/_preferences.py,sha256=OtovFZuGHnHYKjdDjSnUappO795tW8Oxj7qVaejHWpQ,2479
6
- nc_py_api/_preferences_ex.py,sha256=tThj6U0ZZMaBZ-jUkjrbaI0xDnafWsBowQKsC6gjOQs,7179
7
- nc_py_api/_session.py,sha256=G8xFMMpiUlEShX5iWjUZvuU-TW-bQfxxycPkMbgXfCw,19761
8
- nc_py_api/_talk_api.py,sha256=0Uo7OduYniuuX3UQPb468RyGJJ-PWBCgJ5HoPuz5Qa0,51068
9
- nc_py_api/_theming.py,sha256=hTr3nuOemSuRFZaPy9iXNmBM7rDgQHECH43tHMWGqEY,1870
10
- nc_py_api/_version.py,sha256=0DrBatRjxF1-R7fHDYPHU9ghEOcSaQcNxy3eQm1iDII,52
11
- nc_py_api/activity.py,sha256=t9VDSnnaXRNOvALqOSGCeXSQZ-426pCOMSfQ96JHys4,9574
12
- nc_py_api/apps.py,sha256=6vOFFs6vNHCCvZ_SwXxPq5-X1xfgyLjW8uZSfJKduC8,9774
13
- nc_py_api/calendar.py,sha256=-T6CJ8cRbJZTLtxSEDWuuYpD29DMJGCTfLONmtxZV9w,1445
14
- nc_py_api/nextcloud.py,sha256=8KeUDKeAsdLAU20T8O_SSjewPnI8MYLLnVUkA0QMttg,20520
15
- nc_py_api/notes.py,sha256=ljO3TOe-Qg0bJ0mlFQwjg--Pxmj-XFknoLbcbJmII0A,15106
16
- nc_py_api/notifications.py,sha256=WgzV21TuLOhLk-UEjhBSbMsIi2isa5MmAx6cbe0pc2Y,9187
17
- nc_py_api/options.py,sha256=K5co-fIfFVbwF6r3sqWsJF3cKgAbS2CjLAXdyTOkP9s,1717
18
- nc_py_api/talk.py,sha256=OZFemYkDOaM6o4xAK3EvQbjMFiK75E5qnsCDyihIElg,29368
19
- nc_py_api/talk_bot.py,sha256=73V2UXQChqiEzC8JxhWgtKWVQ2YD9lxLRjQ5JJWQRRw,16562
20
- nc_py_api/user_status.py,sha256=I101nwYS8X1WvC8AnLa2f3qJUCPDPHrbq-ke0h1VT4E,13282
21
- nc_py_api/users.py,sha256=B6By-H9oUNvJj2omaRCMPIsQ17xeeDV_udn0VioRO7A,15488
22
- nc_py_api/users_groups.py,sha256=IPxw-Ks5NjCm6r8_HC9xmf3IYptH00ulITbp5iazhAo,6289
23
- nc_py_api/weather_status.py,sha256=wAkjuJPjxc0Rxe4za0BzfwB0XeUmkCXoisJtTH3-qdQ,7582
24
- nc_py_api/ex_app/__init__.py,sha256=JNFZl1LRr8Qu7SqOK9W6CZw4Mf0ATFrRSo7HfVQBJQ0,470
25
- nc_py_api/ex_app/defs.py,sha256=Suh_PpBlkQ8nbHne2-ypoEnl7Plsq39HPLI9Ns3NT2s,1267
26
- nc_py_api/ex_app/integration_fastapi.py,sha256=lNxeMT6Jlhr8GEmP-4bu2tnjtyCD0J2MDYAcSER3tVM,10603
27
- nc_py_api/ex_app/misc.py,sha256=6tPZuDVQa3lyXhK9M66M0dLNFQvrECRtXmULMjIa8-w,2098
28
- nc_py_api/ex_app/persist_transformers_cache.py,sha256=ZoEBb1RnNaQrtxK_CjSZ8LZ36Oakz2Xciau_ZpNp8Ic,213
29
- nc_py_api/ex_app/uvicorn_fastapi.py,sha256=WLtNmWXMBKN6CMip2uhKcgy4mC2Ch9AmNfwRScBUsP0,752
30
- nc_py_api/ex_app/providers/__init__.py,sha256=jmUBdbAgzUCdYyHl8V5UCNYJI-FFpxPQQ4iEAoURKQs,43
31
- nc_py_api/ex_app/providers/providers.py,sha256=jHDhxeQZdYh_ajN88rdNXYTMECCjx9YIt5I6_BlH9QQ,1548
32
- nc_py_api/ex_app/providers/speech_to_text.py,sha256=JFD1ksdhXjpr5UFm5npqCxepqB5x-kdHG9CpPoGofx0,4959
33
- nc_py_api/ex_app/providers/text_processing.py,sha256=VUZMZ2fof-c6JD7mTKHTZBWbDMOqxDllMCNQFOlHXXk,5265
34
- nc_py_api/ex_app/providers/translations.py,sha256=xxe-uTyBNmYlS0_mMXtyeU4rEDk64tDPy6hvWI9YQgM,5697
35
- 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=bPohXjL-szrYQvI0JORLju3G6y8kTXZ0yzLD2g-dcyc,7465
37
- nc_py_api/ex_app/ui/resources.py,sha256=Vwx69oZ93Ouh6HJtGUqaKFUr4Reo74H4vT1YCpb-7j0,12492
38
- nc_py_api/ex_app/ui/settings.py,sha256=f0R17lGhBfo2JQULVw_hFxhpfoPw_CW7vBu0Rb1ABJw,6623
39
- nc_py_api/ex_app/ui/top_menu.py,sha256=oCgGtIoMYbp-5iN5aXEbT7Q88HtccR7hg6IBFgbbyX4,5118
40
- nc_py_api/ex_app/ui/ui.py,sha256=OqFHKn6oIZli8T1wnv6YtQ4glNfeNb90WwGCvtWI1Z4,1632
41
- nc_py_api/files/__init__.py,sha256=rtQTrWIMPjxMk8l7mrvyoBsg9ZHs_2S2woUwdfkJ-CY,12564
42
- nc_py_api/files/_files.py,sha256=IJibj0_y3UQyyVhVI2RgQapPFPsOAV6tyH2sFlLy09I,12226
43
- nc_py_api/files/files.py,sha256=Y86rJABa0Gfqq2lxg2RUCD5RP-mM0FjPd8L2metNho0,44940
44
- nc_py_api/files/sharing.py,sha256=VRZCl-TYK6dbu9rUHPs3_jcVozu1EO8bLGZwoRpiLsU,14439
45
- nc_py_api-0.10.0.dist-info/METADATA,sha256=5PjDRWaqloZeyi9FotkMylQzo5WmGCYakSFQXKKsPh0,8944
46
- nc_py_api-0.10.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
47
- nc_py_api-0.10.0.dist-info/licenses/AUTHORS,sha256=Y1omFHyI8ned9k4jJXs2ATgmgi1GmQ7EZ6S1gxqnX2k,572
48
- nc_py_api-0.10.0.dist-info/licenses/LICENSE.txt,sha256=OLEMh401fAumGHfRSna365MLIfnjdTcdOHZ6QOzMjkg,1551
49
- nc_py_api-0.10.0.dist-info/RECORD,,