From fffc7847693080318b759bfa0c0a683325b536b5 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 17 Jul 2024 12:35:13 +0200 Subject: feat(taskprocessing): add support for webhooks (http or AppAPI) in the task processing API Signed-off-by: Julien Veyssier --- core/Controller/TaskProcessingApiController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/Controller') diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index d9bcbd5da45..6e2a039606f 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -97,7 +97,8 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * @param string $type Type of the task * @param string $appId ID of the app that will execute the task * @param string $customId An arbitrary identifier for the task - * + * @param string|null $webhookUri URI to be requested when the task finishes + * @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...) * @return DataResponse|DataResponse * * 200: Task scheduled successfully @@ -109,8 +110,13 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { #[UserRateLimit(limit: 20, period: 120)] #[AnonRateLimit(limit: 5, period: 120)] #[ApiRoute(verb: 'POST', url: '/schedule', root: '/taskprocessing')] - public function schedule(array $input, string $type, string $appId, string $customId = ''): DataResponse { + public function schedule( + array $input, string $type, string $appId, string $customId = '', + ?string $webhookUri = null, ?string $webhookMethod = null + ): DataResponse { $task = new Task($type, $input, $appId, $this->userId, $customId); + $task->setWebhookUri($webhookUri); + $task->setWebhookMethod($webhookMethod); try { $this->taskProcessingManager->scheduleTask($task); -- cgit v1.2.3