|
1 | 1 | """Nextcloud class providing access to all API endpoints."""
|
2 | 2 |
|
| 3 | +import typing |
3 | 4 | from abc import ABC
|
4 | 5 |
|
5 | 6 | from fastapi import Request as FastAPIRequest
|
@@ -112,6 +113,19 @@ def theme(self) -> ThemingInfo | None:
|
112 | 113 | """Returns Theme information."""
|
113 | 114 | return get_parsed_theme(self.capabilities["theming"]) if "theming" in self.capabilities else None
|
114 | 115 |
|
| 116 | + def ocs( |
| 117 | + self, |
| 118 | + method: str, |
| 119 | + path: str, |
| 120 | + *, |
| 121 | + content: bytes | str | typing.Iterable[bytes] | typing.AsyncIterable[bytes] | None = None, |
| 122 | + json: dict | list | None = None, |
| 123 | + params: dict | None = None, |
| 124 | + **kwargs, |
| 125 | + ): |
| 126 | + """Performs OCS call and returns OCS response payload data.""" |
| 127 | + return self._session.ocs(method, path, content=content, json=json, params=params, **kwargs) |
| 128 | + |
115 | 129 |
|
116 | 130 | class _AsyncNextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
|
117 | 131 | apps: _AsyncAppsAPI
|
@@ -185,6 +199,19 @@ async def theme(self) -> ThemingInfo | None:
|
185 | 199 | """Returns Theme information."""
|
186 | 200 | return get_parsed_theme((await self.capabilities)["theming"]) if "theming" in await self.capabilities else None
|
187 | 201 |
|
| 202 | + async def ocs( |
| 203 | + self, |
| 204 | + method: str, |
| 205 | + path: str, |
| 206 | + *, |
| 207 | + content: bytes | str | typing.Iterable[bytes] | typing.AsyncIterable[bytes] | None = None, |
| 208 | + json: dict | list | None = None, |
| 209 | + params: dict | None = None, |
| 210 | + **kwargs, |
| 211 | + ): |
| 212 | + """Performs OCS call and returns OCS response payload data.""" |
| 213 | + return await self._session.ocs(method, path, content=content, json=json, params=params, **kwargs) |
| 214 | + |
188 | 215 |
|
189 | 216 | class Nextcloud(_NextcloudBasic):
|
190 | 217 | """Nextcloud client class.
|
|
0 commit comments