Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions nc_py_api/ex_app/providers/task_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,23 @@ def report_result(
task_id: int,
output: dict[str, typing.Any] | None = None,
error_message: str | None = None,
user_facing_error_message: str | None = None,
) -> dict[str, typing.Any]:
"""Report result of the task processing to Nextcloud."""
"""Report result of the task processing to Nextcloud.

:param user_facing_error_message: An error message that will be shown to the user.
Available starting with Nextcloud 33. Added in nc_py_api 0.31.0.
"""
with contextlib.suppress(NextcloudException):
if r := self._session.ocs(
"POST",
f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result",
json={"taskId": task_id, "output": output, "errorMessage": error_message},
json={
"taskId": task_id,
"output": output,
"errorMessage": error_message,
"userFacingErrorMessage": user_facing_error_message,
},
):
return r
return {}
Expand Down Expand Up @@ -283,13 +293,23 @@ async def report_result(
task_id: int,
output: dict[str, typing.Any] | None = None,
error_message: str | None = None,
user_facing_error_message: str | None = None,
) -> dict[str, typing.Any]:
"""Report result of the task processing to Nextcloud."""
"""Report result of the task processing to Nextcloud.

:param user_facing_error_message: An error message that will be shown to the user.
Available starting with Nextcloud 33. Added in nc_py_api 0.31.0.
"""
with contextlib.suppress(NextcloudException):
if r := await self._session.ocs(
"POST",
f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result",
json={"taskId": task_id, "output": output, "errorMessage": error_message},
json={
"taskId": task_id,
"output": output,
"errorMessage": error_message,
"userFacingErrorMessage": user_facing_error_message,
},
):
return r
return {}
Loading