From 4ac7f8275b5e89023c8c6c4f468d82d5c782c0d4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 9 Jul 2024 11:43:11 +0200 Subject: [PATCH 01/16] feat(TaskProcessing): Allow setting task results for file slots Signed-off-by: Marcel Klehr --- .../TaskProcessingApiController.php | 51 ++++++- lib/private/TaskProcessing/Manager.php | 129 ++++++++++++------ .../SynchronousBackgroundJob.php | 3 +- lib/public/TaskProcessing/IManager.php | 6 +- 4 files changed, 142 insertions(+), 47 deletions(-) diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 90ee650f1ed7a..981f67804e4c0 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -11,6 +11,7 @@ namespace OC\Core\Controller; use OC\Core\ResponseDefinitions; +use OC\Files\SimpleFS\SimpleFile; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\AnonRateLimit; use OCP\AppFramework\Http\Attribute\ApiRoute; @@ -22,6 +23,7 @@ use OCP\AppFramework\Http\DataResponse; use OCP\Files\File; use OCP\Files\GenericFileException; +use OCP\Files\IAppData; use OCP\Files\IRootFolder; use OCP\Files\NotPermittedException; use OCP\IL10N; @@ -50,6 +52,7 @@ public function __construct( private IL10N $l, private ?string $userId, private IRootFolder $rootFolder, + private IAppData $appData, ) { parent::__construct($appName, $request); } @@ -286,6 +289,39 @@ public function getFileContentsExApp(int $taskId, int $fileId): Http\DataDownloa } } + /** + * Upload a file so it can be referenced in a task result (ExApp route version) + * + * Use field 'file' for the file upload + * + * @param int $taskId The id of the task + * @return DataDownloadResponse|DataResponse + * + * 201: File created + * 404: Task not found + */ + #[ExAppRequired] + #[ApiRoute(verb: 'POST', url: '/tasks_provider/{taskId}/file', root: '/taskprocessing')] + public function setFileContentsExApp(int $taskId): DataResponse { + try { + $task = $this->taskProcessingManager->getTask($taskId); + $file = $this->request->getUploadedFile('file'); + if (!isset($file['tmp_name'])) { + return new DataResponse(['message' => $this->l->t('Bad request')], Http::STATUS_BAD_REQUEST); + } + $data = file_get_contents($file['tmp_name']); + if (!$data) { + return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); + } + $fileId = $this->setFileContentsInternal($task, $data); + return new DataResponse(['fileId' => $fileId], Http::STATUS_CREATED); + } catch (NotFoundException) { + return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); + } catch (Exception) { + return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); + } + } + /** * @throws NotPermittedException * @throws NotFoundException @@ -384,7 +420,7 @@ public function setProgress(int $taskId, float $progress): DataResponse { * Sets the task result * * @param int $taskId The id of the task - * @param array|null $output The resulting task output + * @param array|null $output The resulting task output, files are represented by their IDs * @param string|null $errorMessage An error message if the task failed * @return DataResponse|DataResponse * @@ -396,7 +432,7 @@ public function setProgress(int $taskId, float $progress): DataResponse { public function setResult(int $taskId, ?array $output = null, ?string $errorMessage = null): DataResponse { try { // set result - $this->taskProcessingManager->setTaskResult($taskId, $errorMessage, $output); + $this->taskProcessingManager->setTaskResult($taskId, $errorMessage, $output, true); $task = $this->taskProcessingManager->getTask($taskId); /** @var CoreTaskProcessingTask $json */ @@ -493,4 +529,15 @@ public function getNextScheduledTask(array $providerIds, array $taskTypeIds): Da return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); } } + + private function setFileContentsInternal(Task $task, string $data) { + try { + $folder = $this->appData->getFolder('TaskProcessing'); + } catch (\OCP\Files\NotFoundException) { + $folder = $this->appData->newFolder('TaskProcessing'); + } + /** @var SimpleFile $file */ + $file = $folder->newFile((string) rand(0, 10000000), $data); + return $file->getId(); + } } diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index f0d1d4ba51a33..234534936d44e 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -18,10 +18,12 @@ use OCP\DB\Exception; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\AppData\IAppDataFactory; +use OCP\Files\Config\IUserMountCache; use OCP\Files\File; use OCP\Files\GenericFileException; use OCP\Files\IAppData; use OCP\Files\IRootFolder; +use OCP\Files\Node; use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; use OCP\IL10N; @@ -77,7 +79,7 @@ public function __construct( private \OCP\TextProcessing\IManager $textProcessingManager, private \OCP\TextToImage\IManager $textToImageManager, private \OCP\SpeechToText\ISpeechToTextManager $speechToTextManager, - private \OCP\Share\IManager $shareManager, + private IUserMountCache $userMountCache, ) { $this->appData = $appDataFactory->get('core'); } @@ -561,19 +563,8 @@ public function scheduleTask(Task $task): void { } } foreach ($ids as $fileId) { - $node = $this->rootFolder->getFirstNodeById($fileId); - if ($node === null) { - $node = $this->rootFolder->getFirstNodeByIdInPath($fileId, '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); - if ($node === null) { - throw new ValidationException('Could not find file ' . $fileId); - } - } - /** @var array{users:array, remote: array, mail: array} $accessList */ - $accessList = $this->shareManager->getAccessList($node, true, true); - $userIds = array_map(fn ($id) => strval($id), array_keys($accessList['users'])); - if (!in_array($task->getUserId(), $userIds)) { - throw new UnauthorizedException('User ' . $task->getUserId() . ' does not have access to file ' . $fileId); - } + $this->validateFileId($fileId); + $this->validateUserAccessToFile($fileId, $task->getUserId()); } // remove superfluous keys and set input $task->setInput($this->removeSuperfluousArrayKeys($task->getInput(), $inputShape, $optionalInputShape)); @@ -643,7 +634,7 @@ public function setTaskProgress(int $id, float $progress): bool { return true; } - public function setTaskResult(int $id, ?string $error, ?array $result): void { + public function setTaskResult(int $id, ?string $error, ?array $result, bool $isUsingFileIds = false): void { // TODO: Not sure if we should rather catch the exceptions of getTask here and fail silently $task = $this->getTask($id); if ($task->getStatus() === Task::STATUS_CANCELLED) { @@ -664,7 +655,11 @@ public function setTaskResult(int $id, ?string $error, ?array $result): void { $this->validateOutput($optionalOutputShape, $result, true); $output = $this->removeSuperfluousArrayKeys($result, $outputShape, $optionalOutputShape); // extract raw data and put it in files, replace it with file ids - $output = $this->encapsulateOutputFileData($output, $outputShape, $optionalOutputShape); + if (!$isUsingFileIds) { + $output = $this->encapsulateOutputFileData($output, $outputShape, $optionalOutputShape); + } else { + $output = $this->validateOutputFileIds($output, $outputShape, $optionalOutputShape); + } $task->setOutput($output); $task->setProgress(1); $task->setStatus(Task::STATUS_SUCCESSFUL); @@ -711,16 +706,13 @@ public function getNextScheduledTask(array $taskTypeIds = [], array $taskIdsToIg } /** - * Takes task input or output data and replaces fileIds with base64 data + * Takes task input data and replaces fileIds with File objects * * @param string|null $userId * @param array|numeric|string> $input * @param ShapeDescriptor[] ...$specs the specs * @return array|numeric|string|File> - * @throws GenericFileException - * @throws LockedException - * @throws NotPermittedException - * @throws ValidationException + * @throws GenericFileException|LockedException|NotPermittedException|ValidationException|UnauthorizedException */ public function fillInputFileData(?string $userId, array $input, ...$specs): array { if ($userId !== null) { @@ -738,30 +730,14 @@ public function fillInputFileData(?string $userId, array $input, ...$specs): arr continue; } if ($type->value < 10) { - $node = $this->rootFolder->getFirstNodeById((int)$input[$key]); - if ($node === null) { - $node = $this->rootFolder->getFirstNodeByIdInPath((int)$input[$key], '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); - if (!$node instanceof File) { - throw new ValidationException('File id given for key "' . $key . '" is not a file'); - } - } elseif (!$node instanceof File) { - throw new ValidationException('File id given for key "' . $key . '" is not a file'); - } - // TODO: Validate if userId has access to this file + $node = $this->validateFileId((int)$input[$key]); + $this->validateUserAccessToFile($input[$key], $userId); $newInputOutput[$key] = $node; } else { $newInputOutput[$key] = []; foreach ($input[$key] as $item) { - $node = $this->rootFolder->getFirstNodeById((int)$item); - if ($node === null) { - $node = $this->rootFolder->getFirstNodeByIdInPath((int)$item, '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); - if (!$node instanceof File) { - throw new ValidationException('File id given for key "' . $key . '" is not a file'); - } - } elseif (!$node instanceof File) { - throw new ValidationException('File id given for key "' . $key . '" is not a file'); - } - // TODO: Validate if userId has access to this file + $node = $this->validateFileId((int)$item); + $this->validateUserAccessToFile($item, $userId); $newInputOutput[$key][] = $node; } } @@ -851,7 +827,7 @@ public function encapsulateOutputFileData(array $output, ...$specs): array { * @throws GenericFileException * @throws LockedException * @throws NotPermittedException - * @throws ValidationException + * @throws ValidationException|UnauthorizedException */ public function prepareInputData(Task $task): array { $taskTypes = $this->getAvailableTaskTypes(); @@ -884,4 +860,73 @@ public function setTaskStatus(Task $task, int $status): void { $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task); $this->taskMapper->update($taskEntity); } + + /** + * @param array $output + * @param ShapeDescriptor[] ...$specs the specs that define which keys to keep + * @return array + * @throws NotPermittedException + */ + private function validateOutputFileIds(array $output, ...$specs): array { + $newOutput = []; + $spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []); + foreach($spec as $key => $descriptor) { + $type = $descriptor->getShapeType(); + if (!isset($output[$key])) { + continue; + } + if (!in_array(EShapeType::getScalarType($type), [EShapeType::Image, EShapeType::Audio, EShapeType::Video, EShapeType::File], true)) { + $newOutput[$key] = $output[$key]; + continue; + } + if ($type->value < 10) { + // Is scalar file ID + $newOutput[$key] = $this->validateFileId($output[$key]); + } else { + // Is list of file IDs + $newOutput = []; + foreach ($output[$key] as $item) { + $newOutput[$key][] = $this->validateFileId($item); + } + } + } + return $newOutput; + } + + /** + * @param mixed $id + * @return Node + * @throws ValidationException + */ + private function validateFileId(mixed $id): Node { + $node = $this->rootFolder->getFirstNodeById($id); + if ($node === null) { + $node = $this->rootFolder->getFirstNodeByIdInPath($id, '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); + if ($node === null) { + throw new ValidationException('Could not find file ' . $id); + } elseif (!$node instanceof File) { + throw new ValidationException('File with id "' . $id . '" is not a file'); + } + } elseif (!$node instanceof File) { + throw new ValidationException('File with id "' . $id . '" is not a file'); + } + return $node; + } + + /** + * @param mixed $fileId + * @param string $userId + * @return void + * @throws UnauthorizedException + */ + private function validateUserAccessToFile(mixed $fileId, ?string $userId): void { + if ($userId === null) { + throw new UnauthorizedException('User does not have access to file ' . $fileId); + } + $mounts = $this->userMountCache->getMountsForFileId($fileId); + $userIds = array_map(fn ($mount) => $mount->getUser()->getUID(), $mounts); + if (!in_array($userId, $userIds)) { + throw new UnauthorizedException('User ' . $userId . ' does not have access to file ' . $fileId); + } + } } diff --git a/lib/private/TaskProcessing/SynchronousBackgroundJob.php b/lib/private/TaskProcessing/SynchronousBackgroundJob.php index 7f1ab623190be..093882d4c1e53 100644 --- a/lib/private/TaskProcessing/SynchronousBackgroundJob.php +++ b/lib/private/TaskProcessing/SynchronousBackgroundJob.php @@ -15,6 +15,7 @@ use OCP\TaskProcessing\Exception\Exception; use OCP\TaskProcessing\Exception\NotFoundException; use OCP\TaskProcessing\Exception\ProcessingException; +use OCP\TaskProcessing\Exception\UnauthorizedException; use OCP\TaskProcessing\Exception\ValidationException; use OCP\TaskProcessing\IManager; use OCP\TaskProcessing\ISynchronousProvider; @@ -54,7 +55,7 @@ protected function run($argument) { try { try { $input = $this->taskProcessingManager->prepareInputData($task); - } catch (GenericFileException|NotPermittedException|LockedException|ValidationException $e) { + } catch (GenericFileException|NotPermittedException|LockedException|ValidationException|UnauthorizedException $e) { $this->logger->warning('Failed to prepare input data for a TaskProcessing task with synchronous provider ' . $provider->getId(), ['exception' => $e]); $this->taskProcessingManager->setTaskResult($task->getId(), $e->getMessage(), null); // Schedule again diff --git a/lib/public/TaskProcessing/IManager.php b/lib/public/TaskProcessing/IManager.php index 599bd244d8a62..c68ad1afbac84 100644 --- a/lib/public/TaskProcessing/IManager.php +++ b/lib/public/TaskProcessing/IManager.php @@ -91,11 +91,12 @@ public function cancelTask(int $id): void; * @param int $id The id of the task * @param string|null $error * @param array|null $result + * @param bool $isUsingFileIds * @throws Exception If the query failed * @throws NotFoundException If the task could not be found * @since 30.0.0 */ - public function setTaskResult(int $id, ?string $error, ?array $result): void; + public function setTaskResult(int $id, ?string $error, ?array $result, bool $isUsingFileIds = false): void; /** * @param int $id @@ -152,7 +153,7 @@ public function getUserTasksByApp(?string $userId, string $appId, ?string $custo /** * Prepare the task's input data, so it can be processed by the provider - * ie. this replaces file ids with base64 data + * ie. this replaces file ids with File objects * * @param Task $task * @return array|numeric|string|File> @@ -160,6 +161,7 @@ public function getUserTasksByApp(?string $userId, string $appId, ?string $custo * @throws GenericFileException * @throws LockedException * @throws ValidationException + * @throws UnauthorizedException * @since 30.0.0 */ public function prepareInputData(Task $task): array; From 4ac1ac673e99ef067406b543c24d4c1e903238a4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 9 Jul 2024 12:28:48 +0200 Subject: [PATCH 02/16] fix: psalm errors Signed-off-by: Marcel Klehr --- core/Controller/TaskProcessingApiController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 981f67804e4c0..289597a110f84 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -295,7 +295,7 @@ public function getFileContentsExApp(int $taskId, int $fileId): Http\DataDownloa * Use field 'file' for the file upload * * @param int $taskId The id of the task - * @return DataDownloadResponse|DataResponse + * @return DataResponse|DataResponse * * 201: File created * 404: Task not found @@ -313,7 +313,7 @@ public function setFileContentsExApp(int $taskId): DataResponse { if (!$data) { return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); } - $fileId = $this->setFileContentsInternal($task, $data); + $fileId = $this->setFileContentsInternal($data); return new DataResponse(['fileId' => $fileId], Http::STATUS_CREATED); } catch (NotFoundException) { return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); @@ -530,7 +530,7 @@ public function getNextScheduledTask(array $providerIds, array $taskTypeIds): Da } } - private function setFileContentsInternal(Task $task, string $data) { + private function setFileContentsInternal(string $data): int { try { $folder = $this->appData->getFolder('TaskProcessing'); } catch (\OCP\Files\NotFoundException) { From 5c457c64e88c4c7140c25a580c0964463b7c1094 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 9 Jul 2024 12:43:31 +0200 Subject: [PATCH 03/16] fix: Validate output properly Differentiate between output with file IDs and output with File data Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 37 +++++++++++++++++++++--- lib/public/TaskProcessing/EShapeType.php | 35 +++++++++++++++++++++- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 234534936d44e..4ec8dd9cad218 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -456,7 +456,7 @@ private function validateInput(array $spec, array $io, bool $optional = false): * @return void * @throws ValidationException */ - private function validateOutput(array $spec, array $io, bool $optional = false): void { + private function validateOutputWithFileIds(array $spec, array $io, bool $optional = false): void { foreach ($spec as $key => $descriptor) { $type = $descriptor->getShapeType(); if (!isset($io[$key])) { @@ -466,7 +466,31 @@ private function validateOutput(array $spec, array $io, bool $optional = false): throw new ValidationException('Missing key: "' . $key . '"'); } try { - $type->validateOutput($io[$key]); + $type->validateOutputWithFileIds($io[$key]); + } catch (ValidationException $e) { + throw new ValidationException('Failed to validate output key "' . $key . '": ' . $e->getMessage()); + } + } + } + + /** + * @param ShapeDescriptor[] $spec + * @param array $io + * @param bool $optional + * @return void + * @throws ValidationException + */ + private function validateOutputWithFileData(array $spec, array $io, bool $optional = false): void { + foreach ($spec as $key => $descriptor) { + $type = $descriptor->getShapeType(); + if (!isset($io[$key])) { + if ($optional) { + continue; + } + throw new ValidationException('Missing key: "' . $key . '"'); + } + try { + $type->validateOutputWithFileData($io[$key]); } catch (ValidationException $e) { throw new ValidationException('Failed to validate output key "' . $key . '": ' . $e->getMessage()); } @@ -651,8 +675,13 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU $optionalOutputShape = $taskTypes[$task->getTaskTypeId()]['optionalOutputShape']; try { // validate output - $this->validateOutput($outputShape, $result); - $this->validateOutput($optionalOutputShape, $result, true); + if (!$isUsingFileIds) { + $this->validateOutputWithFileData($outputShape, $result); + $this->validateOutputWithFileData($optionalOutputShape, $result, true); + } else { + $this->validateOutputWithFileIds($outputShape, $result); + $this->validateOutputWithFileIds($optionalOutputShape, $result, true); + } $output = $this->removeSuperfluousArrayKeys($result, $outputShape, $optionalOutputShape); // extract raw data and put it in files, replace it with file ids if (!$isUsingFileIds) { diff --git a/lib/public/TaskProcessing/EShapeType.php b/lib/public/TaskProcessing/EShapeType.php index d66de6e01a8b1..ade78fda71a16 100644 --- a/lib/public/TaskProcessing/EShapeType.php +++ b/lib/public/TaskProcessing/EShapeType.php @@ -89,7 +89,7 @@ public function validateInput(mixed $value): void { * @throws ValidationException * @since 30.0.0 */ - public function validateOutput(mixed $value) { + public function validateOutputWithFileData(mixed $value): void { $this->validateNonFileType($value); if ($this === EShapeType::Image && !is_string($value)) { throw new ValidationException('Non-image item provided for Image slot'); @@ -117,6 +117,39 @@ public function validateOutput(mixed $value) { } } + /** + * @param mixed $value + * @return void + * @throws ValidationException + */ + public function validateOutputWithFileIds(mixed $value): void { + $this->validateNonFileType($value); + if ($this === EShapeType::Image && !is_numeric($value)) { + throw new ValidationException('Non-image item provided for Image slot'); + } + if ($this === EShapeType::ListOfImages && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { + throw new ValidationException('Non-image list item provided for ListOfImages slot'); + } + if ($this === EShapeType::Audio && !is_string($value)) { + throw new ValidationException('Non-audio item provided for Audio slot'); + } + if ($this === EShapeType::ListOfAudios && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { + throw new ValidationException('Non-audio list item provided for ListOfAudio slot'); + } + if ($this === EShapeType::Video && !is_string($value)) { + throw new ValidationException('Non-video item provided for Video slot'); + } + if ($this === EShapeType::ListOfVideos && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { + throw new ValidationException('Non-video list item provided for ListOfTexts slot'); + } + if ($this === EShapeType::File && !is_string($value)) { + throw new ValidationException('Non-file item provided for File slot'); + } + if ($this === EShapeType::ListOfFiles && (!is_array($value) || count(array_filter($value, fn ($item) => !is_numeric($item))) > 0)) { + throw new ValidationException('Non-audio list item provided for ListOfFiles slot'); + } + } + /** * @param EShapeType $type * @return EShapeType From 3937cccd4b564c77620f6fc001b1d623d5e15c1b Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 9 Jul 2024 13:35:46 +0200 Subject: [PATCH 04/16] fix(TaskProcessing\Manager#setTaskResult): Replace files contents with ID instead of File object Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 4ec8dd9cad218..1158c4a8519cf 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -689,6 +689,11 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU } else { $output = $this->validateOutputFileIds($output, $outputShape, $optionalOutputShape); } + foreach ($output as $key => $value) { + if ($value instanceof Node) { + $output[$key] = $value->getId(); + } + } $task->setOutput($output); $task->setProgress(1); $task->setStatus(Task::STATUS_SUCCESSFUL); From c1f2c76f447b91d4c7de43177f25e594d14bace1 Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Sat, 13 Jul 2024 11:49:53 +0300 Subject: [PATCH 05/16] fix: do not overwrite the output if NodeID exists Signed-off-by: Alexander Piskun Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 1158c4a8519cf..c5ddbb31dc34f 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -687,12 +687,7 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU if (!$isUsingFileIds) { $output = $this->encapsulateOutputFileData($output, $outputShape, $optionalOutputShape); } else { - $output = $this->validateOutputFileIds($output, $outputShape, $optionalOutputShape); - } - foreach ($output as $key => $value) { - if ($value instanceof Node) { - $output[$key] = $value->getId(); - } + $this->validateOutputFileIds($output, $outputShape, $optionalOutputShape); } $task->setOutput($output); $task->setProgress(1); From ee7502ab1c126d4bf744bea816c602ef3a458e35 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 9 Jul 2024 13:35:46 +0200 Subject: [PATCH 06/16] fix(TaskProcessing\Manager#setTaskResult): Replace files contents with ID instead of File object Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index c5ddbb31dc34f..f2b4cecd99c88 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -689,6 +689,15 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU } else { $this->validateOutputFileIds($output, $outputShape, $optionalOutputShape); } + // Turn file objects into IDs + foreach ($output as $key => $value) { + if ($value instanceof Node) { + $output[$key] = $value->getId(); + } + if (is_array($value) && $value[0] instanceof Node) { + $output[$key] = array_map(fn($node) => $node->getId(), $value); + } + } $task->setOutput($output); $task->setProgress(1); $task->setStatus(Task::STATUS_SUCCESSFUL); From eb0b5f29fb3cfa3c02edc3b9a42e96ed6a10baaf Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 11:40:39 +0200 Subject: [PATCH 07/16] fix(TaskProcessingApiController): Address review comments Signed-off-by: Marcel Klehr --- core/Controller/TaskProcessingApiController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 289597a110f84..1107b13d9648a 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -309,11 +309,11 @@ public function setFileContentsExApp(int $taskId): DataResponse { if (!isset($file['tmp_name'])) { return new DataResponse(['message' => $this->l->t('Bad request')], Http::STATUS_BAD_REQUEST); } - $data = file_get_contents($file['tmp_name']); - if (!$data) { + $handle = fopen($file['tmp_name'], 'r'); + if (!$handle) { return new DataResponse(['message' => $this->l->t('Internal error')], Http::STATUS_INTERNAL_SERVER_ERROR); } - $fileId = $this->setFileContentsInternal($data); + $fileId = $this->setFileContentsInternal($handle); return new DataResponse(['fileId' => $fileId], Http::STATUS_CREATED); } catch (NotFoundException) { return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); @@ -530,14 +530,14 @@ public function getNextScheduledTask(array $providerIds, array $taskTypeIds): Da } } - private function setFileContentsInternal(string $data): int { + private function setFileContentsInternal($data): int { try { $folder = $this->appData->getFolder('TaskProcessing'); } catch (\OCP\Files\NotFoundException) { $folder = $this->appData->newFolder('TaskProcessing'); } /** @var SimpleFile $file */ - $file = $folder->newFile((string) rand(0, 10000000), $data); + $file = $folder->newFile(time() . '-' . rand(1, 100000), $data); return $file->getId(); } } From 2fed2fc433350cc7633a5c5ffeac149c450483b7 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 11:41:44 +0200 Subject: [PATCH 08/16] fix(TaskProcessingA/Manager): Use time() along with rand int for file names Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index f2b4cecd99c88..5d4c4497afd0e 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -845,13 +845,13 @@ public function encapsulateOutputFileData(array $output, ...$specs): array { } if ($type->value < 10) { /** @var SimpleFile $file */ - $file = $folder->newFile((string) rand(0, 10000000), $output[$key]); + $file = $folder->newFile(time() . '-' . rand(1, 100000), $output[$key]); $newOutput[$key] = $file->getId(); // polymorphic call to SimpleFile } else { $newOutput = []; foreach ($output[$key] as $item) { /** @var SimpleFile $file */ - $file = $folder->newFile((string) rand(0, 10000000), $item); + $file = $folder->newFile(time() . '-' . rand(1, 100000), $item); $newOutput[$key][] = $file->getId(); } } From fb34b13439fb9751a2929edff5be6aabf430f181 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 11:42:06 +0200 Subject: [PATCH 09/16] fix(TaskProcessingA/Manager): Catch new error Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 5d4c4497afd0e..421bf39de07d5 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -22,6 +22,7 @@ use OCP\Files\File; use OCP\Files\GenericFileException; use OCP\Files\IAppData; +use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotPermittedException; @@ -713,7 +714,12 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU $error = 'The task was processed successfully but storing the output in a file failed'; $task->setErrorMessage($error); $this->logger->error($error, ['exception' => $e]); - + } catch (InvalidPathException|\OCP\Files\NotFoundException $e) { + $task->setProgress(1); + $task->setStatus(Task::STATUS_FAILED); + $error = 'The task was processed successfully but the result file could not be found'; + $task->setErrorMessage($error); + $this->logger->error($error, ['exception' => $e]); } } $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task); From f1bb43dd5574b12802715cff49185dba0cdfaca4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 12:13:22 +0200 Subject: [PATCH 10/16] test(TaskProcessing): Add test for setTaskResult with fileIds Signed-off-by: Marcel Klehr --- .../lib/TaskProcessing/TaskProcessingTest.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index fe679ebbd2dda..1f81e9df78981 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -582,6 +582,58 @@ public function testAsyncProviderWithFilesShouldBeRegisteredAndRun() { self::assertEquals('World', $node->getContent()); } + public function testAsyncProviderWithFilesShouldBeRegisteredAndRunReturningFileIds() { + $this->registrationContext->expects($this->any())->method('getTaskProcessingTaskTypes')->willReturn([ + new ServiceRegistration('test', AudioToImage::class) + ]); + $this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([ + new ServiceRegistration('test', AsyncProvider::class) + ]); + $user = $this->createMock(IUser::class); + $user->expects($this->any())->method('getUID')->willReturn('testuser'); + $mount = $this->createMock(ICachedMountInfo::class); + $mount->expects($this->any())->method('getUser')->willReturn($user); + $this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]); + self::assertCount(1, $this->manager->getAvailableTaskTypes()); + + self::assertTrue($this->manager->hasProviders()); + $audioId = $this->getFile('audioInput', 'Hello')->getId(); + $task = new Task(AudioToImage::ID, ['audio' => $audioId], 'test', 'testuser'); + self::assertNull($task->getId()); + self::assertEquals(Task::STATUS_UNKNOWN, $task->getStatus()); + $this->manager->scheduleTask($task); + self::assertNotNull($task->getId()); + self::assertEquals(Task::STATUS_SCHEDULED, $task->getStatus()); + + // Task object retrieved from db is up-to-date + $task2 = $this->manager->getTask($task->getId()); + self::assertEquals($task->getId(), $task2->getId()); + self::assertEquals(['audio' => $audioId], $task2->getInput()); + self::assertNull($task2->getOutput()); + self::assertEquals(Task::STATUS_SCHEDULED, $task2->getStatus()); + + $this->eventDispatcher->expects($this->once())->method('dispatchTyped')->with(new IsInstanceOf(TaskSuccessfulEvent::class)); + + $this->manager->setTaskProgress($task2->getId(), 0.1); + $input = $this->manager->prepareInputData($task2); + self::assertTrue(isset($input['audio'])); + self::assertInstanceOf(\OCP\Files\File::class, $input['audio']); + self::assertEquals($audioId, $input['audio']->getId()); + + $outputFileId = $this->getFile('audioOutput', 'World')->getId(); + + $this->manager->setTaskResult($task2->getId(), null, ['spectrogram' => $outputFileId], true); + + $task = $this->manager->getTask($task->getId()); + self::assertEquals(Task::STATUS_SUCCESSFUL, $task->getStatus()); + self::assertEquals(1, $task->getProgress()); + self::assertTrue(isset($task->getOutput()['spectrogram'])); + $node = $this->rootFolder->getFirstNodeById($task->getOutput()['spectrogram']); + self::assertNotNull($node, 'fileId:' . $task->getOutput()['spectrogram']); + self::assertInstanceOf(\OCP\Files\File::class, $node); + self::assertEquals('World', $node->getContent()); + } + public function testNonexistentTask() { $this->expectException(\OCP\TaskProcessing\Exception\NotFoundException::class); $this->manager->getTask(2147483646); From 61ebfad72413c9202514366c5f71dca6cc08a8b4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 12:13:32 +0200 Subject: [PATCH 11/16] fix(TaskProcessing): fix tests Signed-off-by: Marcel Klehr --- .../lib/TaskProcessing/TaskProcessingTest.php | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 1f81e9df78981..2db9001911992 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -16,11 +16,14 @@ use OCP\BackgroundJob\IJobList; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\AppData\IAppDataFactory; +use OCP\Files\Config\ICachedMountInfo; +use OCP\Files\Config\IUserMountCache; use OCP\Files\IAppData; use OCP\Files\IRootFolder; use OCP\IConfig; use OCP\IDBConnection; use OCP\IServerContainer; +use OCP\IUser; use OCP\IUserManager; use OCP\SpeechToText\ISpeechToTextManager; use OCP\TaskProcessing\EShapeType; @@ -295,8 +298,7 @@ class TaskProcessingTest extends \Test\TestCase { private RegistrationContext $registrationContext; private TaskMapper $taskMapper; private IJobList $jobList; - private IAppData $appData; - private \OCP\Share\IManager $shareManager; + private IUserMountCache $userMountCache; private IRootFolder $rootFolder; public const TEST_USER = 'testuser'; @@ -370,7 +372,7 @@ protected function setUp(): void { \OC::$server->get(IAppDataFactory::class), ); - $this->shareManager = $this->createMock(\OCP\Share\IManager::class); + $this->userMountCache = $this->createMock(IUserMountCache::class); $this->manager = new Manager( $this->coordinator, @@ -384,7 +386,7 @@ protected function setUp(): void { $textProcessingManager, $text2imageManager, \OC::$server->get(ISpeechToTextManager::class), - $this->shareManager, + $this->userMountCache, ); } @@ -415,17 +417,21 @@ public function testProviderShouldBeRegisteredAndTaskFailValidation() { } public function testProviderShouldBeRegisteredAndTaskWithFilesFailValidation() { - $this->shareManager->expects($this->any())->method('getAccessList')->willReturn(['users' => []]); $this->registrationContext->expects($this->any())->method('getTaskProcessingTaskTypes')->willReturn([ new ServiceRegistration('test', AudioToImage::class) ]); $this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([ new ServiceRegistration('test', AsyncProvider::class) ]); - $this->shareManager->expects($this->any())->method('getAccessList')->willReturn(['users' => [null]]); - self::assertCount(1, $this->manager->getAvailableTaskTypes()); + $user = $this->createMock(IUser::class); + $user->expects($this->any())->method('getUID')->willReturn(null); + $mount = $this->createMock(ICachedMountInfo::class); + $mount->expects($this->any())->method('getUser')->willReturn($user); + $this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]); + self::assertCount(1, $this->manager->getAvailableTaskTypes()); self::assertTrue($this->manager->hasProviders()); + $audioId = $this->getFile('audioInput', 'Hello')->getId(); $task = new Task(AudioToImage::ID, ['audio' => $audioId], 'test', null); self::assertNull($task->getId()); @@ -536,14 +542,20 @@ public function testProviderShouldBeRegisteredAndRun() { self::assertEquals(1, $task->getProgress()); } - public function testAsyncProviderWithFilesShouldBeRegisteredAndRun() { + public function testAsyncProviderWithFilesShouldBeRegisteredAndRunReturningRawFileData() { $this->registrationContext->expects($this->any())->method('getTaskProcessingTaskTypes')->willReturn([ new ServiceRegistration('test', AudioToImage::class) ]); $this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([ new ServiceRegistration('test', AsyncProvider::class) ]); - $this->shareManager->expects($this->any())->method('getAccessList')->willReturn(['users' => ['testuser' => 1]]); + + $user = $this->createMock(IUser::class); + $user->expects($this->any())->method('getUID')->willReturn('testuser'); + $mount = $this->createMock(ICachedMountInfo::class); + $mount->expects($this->any())->method('getUser')->willReturn($user); + $this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]); + self::assertCount(1, $this->manager->getAvailableTaskTypes()); self::assertTrue($this->manager->hasProviders()); From ba33e6220cd8e07cc1723c13490e660b9789c858 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 12:22:22 +0200 Subject: [PATCH 12/16] fix(TaskProcessing): Use getScalarType instead of relying on magic integers Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 421bf39de07d5..669b0d70a8088 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -773,11 +773,13 @@ public function fillInputFileData(?string $userId, array $input, ...$specs): arr $newInputOutput[$key] = $input[$key]; continue; } - if ($type->value < 10) { + if (EShapeType::getScalarType($type) === $type) { + // is scalar $node = $this->validateFileId((int)$input[$key]); $this->validateUserAccessToFile($input[$key], $userId); $newInputOutput[$key] = $node; } else { + // is list $newInputOutput[$key] = []; foreach ($input[$key] as $item) { $node = $this->validateFileId((int)$item); @@ -849,7 +851,7 @@ public function encapsulateOutputFileData(array $output, ...$specs): array { $newOutput[$key] = $output[$key]; continue; } - if ($type->value < 10) { + if (EShapeType::getScalarType($type) === $type) { /** @var SimpleFile $file */ $file = $folder->newFile(time() . '-' . rand(1, 100000), $output[$key]); $newOutput[$key] = $file->getId(); // polymorphic call to SimpleFile @@ -923,7 +925,7 @@ private function validateOutputFileIds(array $output, ...$specs): array { $newOutput[$key] = $output[$key]; continue; } - if ($type->value < 10) { + if (EShapeType::getScalarType($type) === $type) { // Is scalar file ID $newOutput[$key] = $this->validateFileId($output[$key]); } else { @@ -939,10 +941,10 @@ private function validateOutputFileIds(array $output, ...$specs): array { /** * @param mixed $id - * @return Node + * @return File * @throws ValidationException */ - private function validateFileId(mixed $id): Node { + private function validateFileId(mixed $id): File { $node = $this->rootFolder->getFirstNodeById($id); if ($node === null) { $node = $this->rootFolder->getFirstNodeByIdInPath($id, '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); From 969cc52851aa579b7b265624c1f3ad6f8b90d6ed Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 12:23:05 +0200 Subject: [PATCH 13/16] fix(TaskProcessing): Run cs:fix Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 2 +- tests/lib/TaskProcessing/TaskProcessingTest.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 669b0d70a8088..821fac01b9970 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -696,7 +696,7 @@ public function setTaskResult(int $id, ?string $error, ?array $result, bool $isU $output[$key] = $value->getId(); } if (is_array($value) && $value[0] instanceof Node) { - $output[$key] = array_map(fn($node) => $node->getId(), $value); + $output[$key] = array_map(fn ($node) => $node->getId(), $value); } } $task->setOutput($output); diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 2db9001911992..699a7d6b2c227 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -18,7 +18,6 @@ use OCP\Files\AppData\IAppDataFactory; use OCP\Files\Config\ICachedMountInfo; use OCP\Files\Config\IUserMountCache; -use OCP\Files\IAppData; use OCP\Files\IRootFolder; use OCP\IConfig; use OCP\IDBConnection; From 0d07ad98b067ea4fb6f5b871442fbdac2d87440a Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 12:25:51 +0200 Subject: [PATCH 14/16] fix(TaskProcessing): Update openapi specs Signed-off-by: Marcel Klehr --- .../TaskProcessingApiController.php | 8 +- core/openapi-full.json | 1867 +++++++++-------- core/openapi.json | 1549 +++++++------- 3 files changed, 1712 insertions(+), 1712 deletions(-) diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 1107b13d9648a..d9bcbd5da45c2 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -295,9 +295,10 @@ public function getFileContentsExApp(int $taskId, int $fileId): Http\DataDownloa * Use field 'file' for the file upload * * @param int $taskId The id of the task - * @return DataResponse|DataResponse + * @return DataResponse|DataResponse * * 201: File created + * 400: File upload failed or no file was uploaded * 404: Task not found */ #[ExAppRequired] @@ -530,6 +531,11 @@ public function getNextScheduledTask(array $providerIds, array $taskTypeIds): Da } } + /** + * @param resource $data + * @return int + * @throws NotPermittedException + */ private function setFileContentsInternal($data): int { try { $folder = $this->appData->getFolder('TaskProcessing'); diff --git a/core/openapi-full.json b/core/openapi-full.json index b70e82c3ee814..b39c60212998c 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -1209,26 +1209,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "password" - ], - "properties": { - "password": { - "type": "string", - "description": "The password of the user" - } - } - } - } - } - }, "parameters": [ + { + "name": "password", + "in": "query", + "description": "The password of the user", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -1326,56 +1316,66 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "search" - ], - "properties": { - "search": { - "type": "string", - "description": "Text to search for" - }, - "itemType": { - "type": "string", - "nullable": true, - "description": "Type of the items to search for" - }, - "itemId": { - "type": "string", - "nullable": true, - "description": "ID of the items to search for" - }, - "sorter": { - "type": "string", - "nullable": true, - "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"" - }, - "shareTypes": { - "type": "array", - "default": [], - "description": "Types of shares to search for", - "items": { - "type": "integer", - "format": "int64" - } - }, - "limit": { - "type": "integer", - "format": "int64", - "default": 10, - "description": "Maximum number of results to return" - } - } + "parameters": [ + { + "name": "search", + "in": "query", + "description": "Text to search for", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "itemType", + "in": "query", + "description": "Type of the items to search for", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "itemId", + "in": "query", + "description": "ID of the items to search for", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "sorter", + "in": "query", + "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "shareTypes[]", + "in": "query", + "description": "Types of shares to search for", + "schema": { + "type": "array", + "default": [], + "items": { + "type": "integer", + "format": "int64" } } - } - }, - "parameters": [ + }, + { + "name": "limit", + "in": "query", + "description": "Maximum number of results to return", + "schema": { + "type": "integer", + "format": "int64", + "default": 10 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -1564,31 +1564,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "resourceType", - "resourceId" - ], - "properties": { - "resourceType": { - "type": "string", - "description": "Name of the resource" - }, - "resourceId": { - "type": "string", - "description": "ID of the resource" - } - } - } - } - } - }, "parameters": [ + { + "name": "resourceType", + "in": "query", + "description": "Name of the resource", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resourceId", + "in": "query", + "description": "ID of the resource", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "collectionId", "in": "path", @@ -1713,31 +1707,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "resourceType", - "resourceId" - ], - "properties": { - "resourceType": { - "type": "string", - "description": "Name of the resource" - }, - "resourceId": { - "type": "string", - "description": "ID of the resource" - } - } - } - } - } - }, "parameters": [ + { + "name": "resourceType", + "in": "query", + "description": "Name of the resource", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resourceId", + "in": "query", + "description": "ID of the resource", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "collectionId", "in": "path", @@ -1862,26 +1850,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "collectionName" - ], - "properties": { - "collectionName": { - "type": "string", - "description": "New name" - } - } - } - } - } - }, "parameters": [ + { + "name": "collectionName", + "in": "query", + "description": "New name", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "collectionId", "in": "path", @@ -2219,26 +2197,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the collection" - } - } - } - } - } - }, "parameters": [ + { + "name": "name", + "in": "query", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "baseResourceType", "in": "path", @@ -2518,24 +2486,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "absolute": { - "type": "boolean", - "default": false, - "description": "Rewrite URLs to absolute ones" - } - } - } - } - } - }, "parameters": [ + { + "name": "absolute", + "in": "query", + "description": "Rewrite URLs to absolute ones", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -2602,24 +2566,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "absolute": { - "type": "boolean", - "default": false, - "description": "Rewrite URLs to absolute ones" - } - } - } - } - } - }, "parameters": [ + { + "name": "absolute", + "in": "query", + "description": "Rewrite URLs to absolute ones", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -2795,31 +2755,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "paramId", - "visibility" - ], - "properties": { - "paramId": { - "type": "string", - "description": "ID of the parameter" - }, - "visibility": { - "type": "string", - "description": "New visibility" - } - } - } - } - } - }, "parameters": [ + { + "name": "paramId", + "in": "query", + "description": "ID of the parameter", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "visibility", + "in": "query", + "description": "New visibility", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "targetUserId", "in": "path", @@ -2971,37 +2925,39 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "text" - ], - "properties": { - "text": { - "type": "string", - "description": "Text to extract from" - }, - "resolve": { - "type": "boolean", - "default": false, - "description": "Resolve the references" - }, - "limit": { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Maximum amount of references to extract" - } - } - } - } - } - }, "parameters": [ + { + "name": "text", + "in": "query", + "description": "Text to extract from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resolve", + "in": "query", + "description": "Resolve the references", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum amount of references to extract", + "schema": { + "type": "integer", + "format": "int64", + "default": 1 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -3074,26 +3030,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "reference" - ], - "properties": { - "reference": { - "type": "string", - "description": "Reference to resolve" - } - } - } - } - } - }, "parameters": [ + { + "name": "reference", + "in": "query", + "description": "Reference to resolve", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -3164,35 +3110,29 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "references" - ], - "properties": { - "references": { - "type": "array", - "description": "References to resolve", - "items": { - "type": "string" - } - }, - "limit": { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Maximum amount of references to resolve" - } - } + "parameters": [ + { + "name": "references[]", + "in": "query", + "description": "References to resolve", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" } } - } - }, - "parameters": [ + }, + { + "name": "limit", + "in": "query", + "description": "Maximum amount of references to resolve", + "schema": { + "type": "integer", + "format": "int64", + "default": 1 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -3329,25 +3269,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "Timestamp of the last usage" - } - } - } - } - } - }, "parameters": [ + { + "name": "timestamp", + "in": "query", + "description": "Timestamp of the last usage", + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, { "name": "providerId", "in": "path", @@ -3499,44 +3431,43 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input", - "type", - "appId" - ], - "properties": { - "input": { - "type": "object", - "description": "Task's input parameters", - "additionalProperties": { - "type": "object" - } - }, - "type": { - "type": "string", - "description": "Type of the task" - }, - "appId": { - "type": "string", - "description": "ID of the app that will execute the task" - }, - "customId": { - "type": "string", - "default": "", - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "input", + "in": "query", + "description": "Task's input parameters", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "description": "Type of the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "appId", + "in": "query", + "description": "ID of the app that will execute the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "customId", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -4021,24 +3952,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "customId": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "customId", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "appId", "in": "path", @@ -4157,29 +4080,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "taskType": { - "type": "string", - "nullable": true, - "description": "The task type to filter by" - }, - "customId": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "taskType", + "in": "query", + "description": "The task type to filter by", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "customId", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -4843,41 +4762,43 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input", - "type", - "appId" - ], - "properties": { - "input": { - "type": "string", - "description": "Input text" - }, - "type": { - "type": "string", - "description": "Type of the task" - }, - "appId": { - "type": "string", - "description": "ID of the app that will execute the task" - }, - "identifier": { - "type": "string", - "default": "", - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "input", + "in": "query", + "description": "Input text", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "description": "Type of the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "appId", + "in": "query", + "description": "ID of the app that will execute the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -5369,24 +5290,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "identifier": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "appId", "in": "path", @@ -5576,42 +5489,44 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input", - "appId" - ], - "properties": { - "input": { - "type": "string", - "description": "Input text" - }, - "appId": { - "type": "string", - "description": "ID of the app that will execute the task" - }, - "identifier": { - "type": "string", - "default": "", - "description": "An arbitrary identifier for the task" - }, - "numberOfImages": { - "type": "integer", - "format": "int64", - "default": 8, - "description": "The number of images to generate" - } - } - } - } - } - }, "parameters": [ + { + "name": "input", + "in": "query", + "description": "Input text", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "appId", + "in": "query", + "description": "ID of the app that will execute the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "default": "" + } + }, + { + "name": "numberOfImages", + "in": "query", + "description": "The number of images to generate", + "schema": { + "type": "integer", + "format": "int64", + "default": 8 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -6204,24 +6119,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "identifier": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "appId", "in": "path", @@ -6438,36 +6345,34 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "text", - "toLanguage" - ], - "properties": { - "text": { - "type": "string", - "description": "Text to be translated" - }, - "fromLanguage": { - "type": "string", - "nullable": true, - "description": "Language to translate from" - }, - "toLanguage": { - "type": "string", - "description": "Language to translate to" - } - } - } - } - } - }, "parameters": [ + { + "name": "text", + "in": "query", + "description": "Text to be translated", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "fromLanguage", + "in": "query", + "description": "Language to translate from", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "toLanguage", + "in": "query", + "description": "Language to translate to", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -6667,24 +6572,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "from": { - "type": "string", - "default": "", - "description": "the url the user is currently at" - } - } - } - } - } - }, "parameters": [ + { + "name": "from", + "in": "query", + "description": "the url the user is currently at", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -6749,54 +6646,62 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "term": { - "type": "string", - "default": "", - "description": "Term to search" - }, - "sortOrder": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "Order of entries" - }, - "limit": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "Maximum amount of entries, limited to 25" - }, - "cursor": { - "nullable": true, - "description": "Offset for searching", - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "string" - } - ] - }, - "from": { - "type": "string", - "default": "", - "description": "The current user URL" - } + "parameters": [ + { + "name": "term", + "in": "query", + "description": "Term to search", + "schema": { + "type": "string", + "default": "" + } + }, + { + "name": "sortOrder", + "in": "query", + "description": "Order of entries", + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum amount of entries, limited to 25", + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + { + "name": "cursor", + "in": "query", + "description": "Offset for searching", + "schema": { + "nullable": true, + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "string" } - } + ] } - } - }, - "parameters": [ + }, + { + "name": "from", + "in": "query", + "description": "The current user URL", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "providerId", "in": "path", @@ -6995,26 +6900,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "version" - ], - "properties": { - "version": { - "type": "string", - "description": "Version to dismiss the changes for" - } - } - } - } - } - }, "parameters": [ + { + "name": "version", + "in": "query", + "description": "Version to dismiss the changes for", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -7084,24 +6979,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "guestFallback": { - "type": "boolean", - "default": false, - "description": "Fallback to guest avatar if not found" - } - } - } - } - } - }, "parameters": [ + { + "name": "guestFallback", + "in": "query", + "description": "Fallback to guest avatar if not found", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "userId", "in": "path", @@ -7191,24 +7082,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "guestFallback": { - "type": "boolean", - "default": false, - "description": "Fallback to guest avatar if not found" - } - } - } - } - } - }, "parameters": [ + { + "name": "guestFallback", + "in": "query", + "description": "Fallback to guest avatar if not found", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "userId", "in": "path", @@ -7298,25 +7185,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string", - "description": "Token of the flow" - } - } - } + "parameters": [ + { + "name": "token", + "in": "query", + "description": "Token of the flow", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Login flow credentials returned", @@ -7385,25 +7264,21 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "darkTheme": { - "type": "boolean", - "nullable": true, - "default": false, - "description": "Return dark avatar" - } - } - } - } - } - }, "parameters": [ + { + "name": "darkTheme", + "in": "query", + "description": "Return dark avatar", + "schema": { + "type": "integer", + "nullable": true, + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "guestName", "in": "path", @@ -7564,25 +7439,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "password" - ], - "properties": { - "password": { - "type": "string", - "description": "The password of the user" - } - } - } + "parameters": [ + { + "name": "password", + "in": "query", + "description": "The password of the user", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Password confirmation succeeded", @@ -7737,59 +7604,89 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "file": { - "type": "string", - "default": "", - "description": "Path of the file" - }, - "x": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Width of the preview. A width of -1 will use the original image width." - }, - "y": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Height of the preview. A height of -1 will use the original image height." - }, - "a": { - "type": "boolean", - "default": false, - "description": "Preserve the aspect ratio" - }, - "forceIcon": { - "type": "boolean", - "default": true, - "description": "Force returning an icon" - }, - "mode": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ], - "description": "How to crop the image" - }, - "mimeFallback": { - "type": "boolean", - "default": false, - "description": "Whether to fallback to the mime icon if no preview is available" - } - } - } + "parameters": [ + { + "name": "file", + "in": "query", + "description": "Path of the file", + "schema": { + "type": "string", + "default": "" + } + }, + { + "name": "x", + "in": "query", + "description": "Width of the preview. A width of -1 will use the original image width.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "y", + "in": "query", + "description": "Height of the preview. A height of -1 will use the original image height.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "a", + "in": "query", + "description": "Preserve the aspect ratio", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "forceIcon", + "in": "query", + "description": "Force returning an icon", + "schema": { + "type": "integer", + "default": 1, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "mode", + "in": "query", + "description": "How to crop the image", + "schema": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ] + } + }, + { + "name": "mimeFallback", + "in": "query", + "description": "Whether to fallback to the mime icon if no preview is available", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] } } - }, + ], "responses": { "200": { "description": "Preview returned", @@ -7854,60 +7751,90 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "fileId": { - "type": "integer", - "format": "int64", - "default": -1, - "description": "ID of the file" - }, - "x": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Width of the preview. A width of -1 will use the original image width." - }, - "y": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Height of the preview. A height of -1 will use the original image height." - }, - "a": { - "type": "boolean", - "default": false, - "description": "Preserve the aspect ratio" - }, - "forceIcon": { - "type": "boolean", - "default": true, - "description": "Force returning an icon" - }, - "mode": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ], - "description": "How to crop the image" - }, - "mimeFallback": { - "type": "boolean", - "default": false, - "description": "Whether to fallback to the mime icon if no preview is available" - } - } - } + "parameters": [ + { + "name": "fileId", + "in": "query", + "description": "ID of the file", + "schema": { + "type": "integer", + "format": "int64", + "default": -1 + } + }, + { + "name": "x", + "in": "query", + "description": "Width of the preview. A width of -1 will use the original image width.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "y", + "in": "query", + "description": "Height of the preview. A height of -1 will use the original image height.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "a", + "in": "query", + "description": "Preserve the aspect ratio", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "forceIcon", + "in": "query", + "description": "Force returning an icon", + "schema": { + "type": "integer", + "default": 1, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "mode", + "in": "query", + "description": "How to crop the image", + "schema": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ] + } + }, + { + "name": "mimeFallback", + "in": "query", + "description": "Whether to fallback to the mime icon if no preview is available", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] } } - }, + ], "responses": { "200": { "description": "Preview returned", @@ -8025,25 +7952,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string", - "description": "App password" - } - } - } + "parameters": [ + { + "name": "token", + "in": "query", + "description": "App password", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Device should be wiped", @@ -8090,25 +8009,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string", - "description": "App password" - } - } - } + "parameters": [ + { + "name": "token", + "in": "query", + "description": "App password", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Wipe finished successfully", @@ -8285,11 +8196,11 @@ } } }, - "/ocs/v2.php/taskprocessing/tasks_provider/{taskId}/progress": { + "/ocs/v2.php/taskprocessing/tasks_provider/{taskId}/file": { "post": { - "operationId": "task_processing_api-set-progress", - "summary": "Sets the task progress", - "description": "This endpoint requires admin access", + "operationId": "task_processing_api-set-file-contents-ex-app", + "summary": "Upload a file so it can be referenced in a task result (ExApp route version)", + "description": "Use field 'file' for the file upload\nThis endpoint requires admin access", "tags": [ "task_processing_api" ], @@ -8301,27 +8212,212 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "progress" - ], - "properties": { - "progress": { - "type": "number", - "format": "double", - "description": "The progress" + "parameters": [ + { + "name": "taskId", + "in": "path", + "description": "The id of the task", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "201": { + "description": "File created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "fileId" + ], + "properties": { + "fileId": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + } + } + }, + "400": { + "description": "File upload failed or no file was uploaded", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } + } + } + } } } } } + }, + "404": { + "description": "Task not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/taskprocessing/tasks_provider/{taskId}/progress": { + "post": { + "operationId": "task_processing_api-set-progress", + "summary": "Sets the task progress", + "description": "This endpoint requires admin access", + "tags": [ + "task_processing_api" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] } - }, + ], "parameters": [ + { + "name": "progress", + "in": "query", + "description": "The progress", + "required": true, + "schema": { + "type": "number", + "format": "double" + } + }, { "name": "taskId", "in": "path", @@ -8477,32 +8573,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "output": { - "type": "object", - "nullable": true, - "description": "The resulting task output", - "additionalProperties": { - "type": "object" - } - }, - "errorMessage": { - "type": "string", - "nullable": true, - "description": "An error message if the task failed" - } - } - } - } - } - }, "parameters": [ + { + "name": "output", + "in": "query", + "description": "The resulting task output, files are represented by their IDs", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "errorMessage", + "in": "query", + "description": "An error message if the task failed", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "taskId", "in": "path", @@ -8658,37 +8747,31 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "providerIds", - "taskTypeIds" - ], - "properties": { - "providerIds": { - "type": "array", - "description": "The ids of the providers", - "items": { - "type": "string" - } - }, - "taskTypeIds": { - "type": "array", - "description": "The ids of the task types", - "items": { - "type": "string" - } - } - } + "parameters": [ + { + "name": "providerIds[]", + "in": "query", + "description": "The ids of the providers", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" } } - } - }, - "parameters": [ + }, + { + "name": "taskTypeIds[]", + "in": "query", + "description": "The ids of the task types", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -8810,4 +8893,4 @@ "description": "Controller about the endpoint /ocm-provider/" } ] -} +} \ No newline at end of file diff --git a/core/openapi.json b/core/openapi.json index 3310a03b89d3c..247a09c590b4f 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -1209,26 +1209,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "password" - ], - "properties": { - "password": { - "type": "string", - "description": "The password of the user" - } - } - } - } - } - }, "parameters": [ + { + "name": "password", + "in": "query", + "description": "The password of the user", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -1326,56 +1316,66 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "search" - ], - "properties": { - "search": { - "type": "string", - "description": "Text to search for" - }, - "itemType": { - "type": "string", - "nullable": true, - "description": "Type of the items to search for" - }, - "itemId": { - "type": "string", - "nullable": true, - "description": "ID of the items to search for" - }, - "sorter": { - "type": "string", - "nullable": true, - "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"" - }, - "shareTypes": { - "type": "array", - "default": [], - "description": "Types of shares to search for", - "items": { - "type": "integer", - "format": "int64" - } - }, - "limit": { - "type": "integer", - "format": "int64", - "default": 10, - "description": "Maximum number of results to return" - } - } + "parameters": [ + { + "name": "search", + "in": "query", + "description": "Text to search for", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "itemType", + "in": "query", + "description": "Type of the items to search for", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "itemId", + "in": "query", + "description": "ID of the items to search for", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "sorter", + "in": "query", + "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "shareTypes[]", + "in": "query", + "description": "Types of shares to search for", + "schema": { + "type": "array", + "default": [], + "items": { + "type": "integer", + "format": "int64" } } - } - }, - "parameters": [ + }, + { + "name": "limit", + "in": "query", + "description": "Maximum number of results to return", + "schema": { + "type": "integer", + "format": "int64", + "default": 10 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -1564,31 +1564,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "resourceType", - "resourceId" - ], - "properties": { - "resourceType": { - "type": "string", - "description": "Name of the resource" - }, - "resourceId": { - "type": "string", - "description": "ID of the resource" - } - } - } - } - } - }, "parameters": [ + { + "name": "resourceType", + "in": "query", + "description": "Name of the resource", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resourceId", + "in": "query", + "description": "ID of the resource", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "collectionId", "in": "path", @@ -1713,31 +1707,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "resourceType", - "resourceId" - ], - "properties": { - "resourceType": { - "type": "string", - "description": "Name of the resource" - }, - "resourceId": { - "type": "string", - "description": "ID of the resource" - } - } - } - } - } - }, "parameters": [ + { + "name": "resourceType", + "in": "query", + "description": "Name of the resource", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resourceId", + "in": "query", + "description": "ID of the resource", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "collectionId", "in": "path", @@ -1862,26 +1850,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "collectionName" - ], - "properties": { - "collectionName": { - "type": "string", - "description": "New name" - } - } - } - } - } - }, "parameters": [ + { + "name": "collectionName", + "in": "query", + "description": "New name", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "collectionId", "in": "path", @@ -2219,26 +2197,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the collection" - } - } - } - } - } - }, "parameters": [ + { + "name": "name", + "in": "query", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "baseResourceType", "in": "path", @@ -2518,24 +2486,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "absolute": { - "type": "boolean", - "default": false, - "description": "Rewrite URLs to absolute ones" - } - } - } - } - } - }, "parameters": [ + { + "name": "absolute", + "in": "query", + "description": "Rewrite URLs to absolute ones", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -2602,24 +2566,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "absolute": { - "type": "boolean", - "default": false, - "description": "Rewrite URLs to absolute ones" - } - } - } - } - } - }, "parameters": [ + { + "name": "absolute", + "in": "query", + "description": "Rewrite URLs to absolute ones", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -2795,31 +2755,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "paramId", - "visibility" - ], - "properties": { - "paramId": { - "type": "string", - "description": "ID of the parameter" - }, - "visibility": { - "type": "string", - "description": "New visibility" - } - } - } - } - } - }, "parameters": [ + { + "name": "paramId", + "in": "query", + "description": "ID of the parameter", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "visibility", + "in": "query", + "description": "New visibility", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "targetUserId", "in": "path", @@ -2971,37 +2925,39 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "text" - ], - "properties": { - "text": { - "type": "string", - "description": "Text to extract from" - }, - "resolve": { - "type": "boolean", - "default": false, - "description": "Resolve the references" - }, - "limit": { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Maximum amount of references to extract" - } - } - } - } - } - }, "parameters": [ + { + "name": "text", + "in": "query", + "description": "Text to extract from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resolve", + "in": "query", + "description": "Resolve the references", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum amount of references to extract", + "schema": { + "type": "integer", + "format": "int64", + "default": 1 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -3074,26 +3030,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "reference" - ], - "properties": { - "reference": { - "type": "string", - "description": "Reference to resolve" - } - } - } - } - } - }, "parameters": [ + { + "name": "reference", + "in": "query", + "description": "Reference to resolve", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -3164,35 +3110,29 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "references" - ], - "properties": { - "references": { - "type": "array", - "description": "References to resolve", - "items": { - "type": "string" - } - }, - "limit": { - "type": "integer", - "format": "int64", - "default": 1, - "description": "Maximum amount of references to resolve" - } - } + "parameters": [ + { + "name": "references[]", + "in": "query", + "description": "References to resolve", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" } } - } - }, - "parameters": [ + }, + { + "name": "limit", + "in": "query", + "description": "Maximum amount of references to resolve", + "schema": { + "type": "integer", + "format": "int64", + "default": 1 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -3329,25 +3269,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "Timestamp of the last usage" - } - } - } - } - } - }, "parameters": [ + { + "name": "timestamp", + "in": "query", + "description": "Timestamp of the last usage", + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, { "name": "providerId", "in": "path", @@ -3499,44 +3431,43 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input", - "type", - "appId" - ], - "properties": { - "input": { - "type": "object", - "description": "Task's input parameters", - "additionalProperties": { - "type": "object" - } - }, - "type": { - "type": "string", - "description": "Type of the task" - }, - "appId": { - "type": "string", - "description": "ID of the app that will execute the task" - }, - "customId": { - "type": "string", - "default": "", - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "input", + "in": "query", + "description": "Task's input parameters", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "description": "Type of the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "appId", + "in": "query", + "description": "ID of the app that will execute the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "customId", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -4021,24 +3952,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "customId": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "customId", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "appId", "in": "path", @@ -4157,29 +4080,25 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "taskType": { - "type": "string", - "nullable": true, - "description": "The task type to filter by" - }, - "customId": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "taskType", + "in": "query", + "description": "The task type to filter by", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "customId", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -4843,41 +4762,43 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input", - "type", - "appId" - ], - "properties": { - "input": { - "type": "string", - "description": "Input text" - }, - "type": { - "type": "string", - "description": "Type of the task" - }, - "appId": { - "type": "string", - "description": "ID of the app that will execute the task" - }, - "identifier": { - "type": "string", - "default": "", - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "input", + "in": "query", + "description": "Input text", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "description": "Type of the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "appId", + "in": "query", + "description": "ID of the app that will execute the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -5369,24 +5290,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "identifier": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "appId", "in": "path", @@ -5576,42 +5489,44 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "input", - "appId" - ], - "properties": { - "input": { - "type": "string", - "description": "Input text" - }, - "appId": { - "type": "string", - "description": "ID of the app that will execute the task" - }, - "identifier": { - "type": "string", - "default": "", - "description": "An arbitrary identifier for the task" - }, - "numberOfImages": { - "type": "integer", - "format": "int64", - "default": 8, - "description": "The number of images to generate" - } - } - } - } - } - }, "parameters": [ + { + "name": "input", + "in": "query", + "description": "Input text", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "appId", + "in": "query", + "description": "ID of the app that will execute the task", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "default": "" + } + }, + { + "name": "numberOfImages", + "in": "query", + "description": "The number of images to generate", + "schema": { + "type": "integer", + "format": "int64", + "default": 8 + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -6204,24 +6119,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "identifier": { - "type": "string", - "nullable": true, - "description": "An arbitrary identifier for the task" - } - } - } - } - } - }, "parameters": [ + { + "name": "identifier", + "in": "query", + "description": "An arbitrary identifier for the task", + "schema": { + "type": "string", + "nullable": true + } + }, { "name": "appId", "in": "path", @@ -6438,36 +6345,34 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "text", - "toLanguage" - ], - "properties": { - "text": { - "type": "string", - "description": "Text to be translated" - }, - "fromLanguage": { - "type": "string", - "nullable": true, - "description": "Language to translate from" - }, - "toLanguage": { - "type": "string", - "description": "Language to translate to" - } - } - } - } - } - }, "parameters": [ + { + "name": "text", + "in": "query", + "description": "Text to be translated", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "fromLanguage", + "in": "query", + "description": "Language to translate from", + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "toLanguage", + "in": "query", + "description": "Language to translate to", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -6667,24 +6572,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "from": { - "type": "string", - "default": "", - "description": "the url the user is currently at" - } - } - } - } - } - }, "parameters": [ + { + "name": "from", + "in": "query", + "description": "the url the user is currently at", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -6749,54 +6646,62 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "term": { - "type": "string", - "default": "", - "description": "Term to search" - }, - "sortOrder": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "Order of entries" - }, - "limit": { - "type": "integer", - "format": "int64", - "nullable": true, - "description": "Maximum amount of entries, limited to 25" - }, - "cursor": { - "nullable": true, - "description": "Offset for searching", - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "string" - } - ] - }, - "from": { - "type": "string", - "default": "", - "description": "The current user URL" - } + "parameters": [ + { + "name": "term", + "in": "query", + "description": "Term to search", + "schema": { + "type": "string", + "default": "" + } + }, + { + "name": "sortOrder", + "in": "query", + "description": "Order of entries", + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum amount of entries, limited to 25", + "schema": { + "type": "integer", + "format": "int64", + "nullable": true + } + }, + { + "name": "cursor", + "in": "query", + "description": "Offset for searching", + "schema": { + "nullable": true, + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "string" } - } + ] } - } - }, - "parameters": [ + }, + { + "name": "from", + "in": "query", + "description": "The current user URL", + "schema": { + "type": "string", + "default": "" + } + }, { "name": "providerId", "in": "path", @@ -6995,26 +6900,16 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "version" - ], - "properties": { - "version": { - "type": "string", - "description": "Version to dismiss the changes for" - } - } - } - } - } - }, "parameters": [ + { + "name": "version", + "in": "query", + "description": "Version to dismiss the changes for", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "OCS-APIRequest", "in": "header", @@ -7084,24 +6979,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "guestFallback": { - "type": "boolean", - "default": false, - "description": "Fallback to guest avatar if not found" - } - } - } - } - } - }, "parameters": [ + { + "name": "guestFallback", + "in": "query", + "description": "Fallback to guest avatar if not found", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "userId", "in": "path", @@ -7191,24 +7082,20 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "guestFallback": { - "type": "boolean", - "default": false, - "description": "Fallback to guest avatar if not found" - } - } - } - } - } - }, "parameters": [ + { + "name": "guestFallback", + "in": "query", + "description": "Fallback to guest avatar if not found", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "userId", "in": "path", @@ -7298,25 +7185,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string", - "description": "Token of the flow" - } - } - } + "parameters": [ + { + "name": "token", + "in": "query", + "description": "Token of the flow", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Login flow credentials returned", @@ -7385,25 +7264,21 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "darkTheme": { - "type": "boolean", - "nullable": true, - "default": false, - "description": "Return dark avatar" - } - } - } - } - } - }, "parameters": [ + { + "name": "darkTheme", + "in": "query", + "description": "Return dark avatar", + "schema": { + "type": "integer", + "nullable": true, + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, { "name": "guestName", "in": "path", @@ -7564,25 +7439,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "password" - ], - "properties": { - "password": { - "type": "string", - "description": "The password of the user" - } - } - } + "parameters": [ + { + "name": "password", + "in": "query", + "description": "The password of the user", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Password confirmation succeeded", @@ -7737,59 +7604,89 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "file": { - "type": "string", - "default": "", - "description": "Path of the file" - }, - "x": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Width of the preview. A width of -1 will use the original image width." - }, - "y": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Height of the preview. A height of -1 will use the original image height." - }, - "a": { - "type": "boolean", - "default": false, - "description": "Preserve the aspect ratio" - }, - "forceIcon": { - "type": "boolean", - "default": true, - "description": "Force returning an icon" - }, - "mode": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ], - "description": "How to crop the image" - }, - "mimeFallback": { - "type": "boolean", - "default": false, - "description": "Whether to fallback to the mime icon if no preview is available" - } - } - } + "parameters": [ + { + "name": "file", + "in": "query", + "description": "Path of the file", + "schema": { + "type": "string", + "default": "" + } + }, + { + "name": "x", + "in": "query", + "description": "Width of the preview. A width of -1 will use the original image width.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "y", + "in": "query", + "description": "Height of the preview. A height of -1 will use the original image height.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "a", + "in": "query", + "description": "Preserve the aspect ratio", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "forceIcon", + "in": "query", + "description": "Force returning an icon", + "schema": { + "type": "integer", + "default": 1, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "mode", + "in": "query", + "description": "How to crop the image", + "schema": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ] + } + }, + { + "name": "mimeFallback", + "in": "query", + "description": "Whether to fallback to the mime icon if no preview is available", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] } } - }, + ], "responses": { "200": { "description": "Preview returned", @@ -7854,60 +7751,90 @@ "basic_auth": [] } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "fileId": { - "type": "integer", - "format": "int64", - "default": -1, - "description": "ID of the file" - }, - "x": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Width of the preview. A width of -1 will use the original image width." - }, - "y": { - "type": "integer", - "format": "int64", - "default": 32, - "description": "Height of the preview. A height of -1 will use the original image height." - }, - "a": { - "type": "boolean", - "default": false, - "description": "Preserve the aspect ratio" - }, - "forceIcon": { - "type": "boolean", - "default": true, - "description": "Force returning an icon" - }, - "mode": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ], - "description": "How to crop the image" - }, - "mimeFallback": { - "type": "boolean", - "default": false, - "description": "Whether to fallback to the mime icon if no preview is available" - } - } - } + "parameters": [ + { + "name": "fileId", + "in": "query", + "description": "ID of the file", + "schema": { + "type": "integer", + "format": "int64", + "default": -1 + } + }, + { + "name": "x", + "in": "query", + "description": "Width of the preview. A width of -1 will use the original image width.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "y", + "in": "query", + "description": "Height of the preview. A height of -1 will use the original image height.", + "schema": { + "type": "integer", + "format": "int64", + "default": 32 + } + }, + { + "name": "a", + "in": "query", + "description": "Preserve the aspect ratio", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "forceIcon", + "in": "query", + "description": "Force returning an icon", + "schema": { + "type": "integer", + "default": 1, + "enum": [ + 0, + 1 + ] + } + }, + { + "name": "mode", + "in": "query", + "description": "How to crop the image", + "schema": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ] + } + }, + { + "name": "mimeFallback", + "in": "query", + "description": "Whether to fallback to the mime icon if no preview is available", + "schema": { + "type": "integer", + "default": 0, + "enum": [ + 0, + 1 + ] } } - }, + ], "responses": { "200": { "description": "Preview returned", @@ -8025,25 +7952,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string", - "description": "App password" - } - } - } + "parameters": [ + { + "name": "token", + "in": "query", + "description": "App password", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Device should be wiped", @@ -8090,25 +8009,17 @@ "basic_auth": [] } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string", - "description": "App password" - } - } - } + "parameters": [ + { + "name": "token", + "in": "query", + "description": "App password", + "required": true, + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "Wipe finished successfully", @@ -8161,4 +8072,4 @@ "description": "Controller about the endpoint /ocm-provider/" } ] -} +} \ No newline at end of file From 6ff452491941c4e7d7baf8b9b6db73482c68d714 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 13 Jul 2024 12:35:08 +0200 Subject: [PATCH 15/16] fix(TaskProcessing): Add since doc for new EShapeType method Signed-off-by: Marcel Klehr --- lib/public/TaskProcessing/EShapeType.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/public/TaskProcessing/EShapeType.php b/lib/public/TaskProcessing/EShapeType.php index ade78fda71a16..059f9d0c3c758 100644 --- a/lib/public/TaskProcessing/EShapeType.php +++ b/lib/public/TaskProcessing/EShapeType.php @@ -121,6 +121,7 @@ public function validateOutputWithFileData(mixed $value): void { * @param mixed $value * @return void * @throws ValidationException + * @since 30.0.0 */ public function validateOutputWithFileIds(mixed $value): void { $this->validateNonFileType($value); From ff99df07e7212a3c8bfdcc3cf9a571353c6f84ff Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 18 Jul 2024 08:51:43 +0200 Subject: [PATCH 16/16] chore: update openapi specs Signed-off-by: Marcel Klehr --- core/openapi-ex_app.json | 197 ++++- core/openapi-full.json | 1674 ++++++++++++++++++++------------------ core/openapi.json | 1549 ++++++++++++++++++----------------- 3 files changed, 1908 insertions(+), 1512 deletions(-) diff --git a/core/openapi-ex_app.json b/core/openapi-ex_app.json index e0cf06753de0b..3f5de5161722a 100644 --- a/core/openapi-ex_app.json +++ b/core/openapi-ex_app.json @@ -339,6 +339,201 @@ } } }, + "/ocs/v2.php/taskprocessing/tasks_provider/{taskId}/file": { + "post": { + "operationId": "task_processing_api-set-file-contents-ex-app", + "summary": "Upload a file so it can be referenced in a task result (ExApp route version)", + "description": "Use field 'file' for the file upload\nThis endpoint requires admin access", + "tags": [ + "task_processing_api" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "taskId", + "in": "path", + "description": "The id of the task", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "201": { + "description": "File created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "fileId" + ], + "properties": { + "fileId": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + } + } + }, + "400": { + "description": "File upload failed or no file was uploaded", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "404": { + "description": "Task not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + } + }, "/ocs/v2.php/taskprocessing/tasks_provider/{taskId}/progress": { "post": { "operationId": "task_processing_api-set-progress", @@ -541,7 +736,7 @@ "output": { "type": "object", "nullable": true, - "description": "The resulting task output", + "description": "The resulting task output, files are represented by their IDs", "additionalProperties": { "type": "object" } diff --git a/core/openapi-full.json b/core/openapi-full.json index b39c60212998c..104fdadd4258a 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -1209,16 +1209,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "password", - "in": "query", - "description": "The password of the user", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "password": { + "type": "string", + "description": "The password of the user" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -1316,66 +1326,56 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "search", - "in": "query", - "description": "Text to search for", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "itemType", - "in": "query", - "description": "Type of the items to search for", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "itemId", - "in": "query", - "description": "ID of the items to search for", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "sorter", - "in": "query", - "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "shareTypes[]", - "in": "query", - "description": "Types of shares to search for", - "schema": { - "type": "array", - "default": [], - "items": { - "type": "integer", - "format": "int64" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "search" + ], + "properties": { + "search": { + "type": "string", + "description": "Text to search for" + }, + "itemType": { + "type": "string", + "nullable": true, + "description": "Type of the items to search for" + }, + "itemId": { + "type": "string", + "nullable": true, + "description": "ID of the items to search for" + }, + "sorter": { + "type": "string", + "nullable": true, + "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"" + }, + "shareTypes": { + "type": "array", + "default": [], + "description": "Types of shares to search for", + "items": { + "type": "integer", + "format": "int64" + } + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 10, + "description": "Maximum number of results to return" + } + } } } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum number of results to return", - "schema": { - "type": "integer", - "format": "int64", - "default": 10 - } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -1564,25 +1564,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "resourceType", - "in": "query", - "description": "Name of the resource", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resourceId", - "in": "query", - "description": "ID of the resource", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "resourceType", + "resourceId" + ], + "properties": { + "resourceType": { + "type": "string", + "description": "Name of the resource" + }, + "resourceId": { + "type": "string", + "description": "ID of the resource" + } + } + } } - }, + } + }, + "parameters": [ { "name": "collectionId", "in": "path", @@ -1707,25 +1713,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "resourceType", - "in": "query", - "description": "Name of the resource", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resourceId", - "in": "query", - "description": "ID of the resource", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "resourceType", + "resourceId" + ], + "properties": { + "resourceType": { + "type": "string", + "description": "Name of the resource" + }, + "resourceId": { + "type": "string", + "description": "ID of the resource" + } + } + } } - }, + } + }, + "parameters": [ { "name": "collectionId", "in": "path", @@ -1850,16 +1862,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "collectionName", - "in": "query", - "description": "New name", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "collectionName" + ], + "properties": { + "collectionName": { + "type": "string", + "description": "New name" + } + } + } } - }, + } + }, + "parameters": [ { "name": "collectionId", "in": "path", @@ -2197,16 +2219,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "name", - "in": "query", - "description": "Name of the collection", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the collection" + } + } + } } - }, + } + }, + "parameters": [ { "name": "baseResourceType", "in": "path", @@ -2486,20 +2518,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "absolute", - "in": "query", - "description": "Rewrite URLs to absolute ones", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "absolute": { + "type": "boolean", + "default": false, + "description": "Rewrite URLs to absolute ones" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -2566,20 +2602,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "absolute", - "in": "query", - "description": "Rewrite URLs to absolute ones", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "absolute": { + "type": "boolean", + "default": false, + "description": "Rewrite URLs to absolute ones" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -2755,25 +2795,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "paramId", - "in": "query", - "description": "ID of the parameter", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "visibility", - "in": "query", - "description": "New visibility", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "paramId", + "visibility" + ], + "properties": { + "paramId": { + "type": "string", + "description": "ID of the parameter" + }, + "visibility": { + "type": "string", + "description": "New visibility" + } + } + } } - }, + } + }, + "parameters": [ { "name": "targetUserId", "in": "path", @@ -2925,39 +2971,37 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "text", - "in": "query", - "description": "Text to extract from", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resolve", - "in": "query", - "description": "Resolve the references", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum amount of references to extract", - "schema": { - "type": "integer", - "format": "int64", - "default": 1 + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "text" + ], + "properties": { + "text": { + "type": "string", + "description": "Text to extract from" + }, + "resolve": { + "type": "boolean", + "default": false, + "description": "Resolve the references" + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Maximum amount of references to extract" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3030,16 +3074,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "reference", - "in": "query", - "description": "Reference to resolve", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "reference" + ], + "properties": { + "reference": { + "type": "string", + "description": "Reference to resolve" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3110,29 +3164,35 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "references[]", - "in": "query", - "description": "References to resolve", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "references" + ], + "properties": { + "references": { + "type": "array", + "description": "References to resolve", + "items": { + "type": "string" + } + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Maximum amount of references to resolve" + } + } } } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum amount of references to resolve", - "schema": { - "type": "integer", - "format": "int64", - "default": 1 - } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3269,17 +3329,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "timestamp", - "in": "query", - "description": "Timestamp of the last usage", - "schema": { - "type": "integer", - "format": "int64", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "nullable": true, + "description": "Timestamp of the last usage" + } + } + } } - }, + } + }, + "parameters": [ { "name": "providerId", "in": "path", @@ -3431,43 +3499,44 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "input", - "in": "query", - "description": "Task's input parameters", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "type", - "in": "query", - "description": "Type of the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "appId", - "in": "query", - "description": "ID of the app that will execute the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "customId", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "input", + "type", + "appId" + ], + "properties": { + "input": { + "type": "object", + "description": "Task's input parameters", + "additionalProperties": { + "type": "object" + } + }, + "type": { + "type": "string", + "description": "Type of the task" + }, + "appId": { + "type": "string", + "description": "ID of the app that will execute the task" + }, + "customId": { + "type": "string", + "default": "", + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3952,16 +4021,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "customId", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "customId": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "appId", "in": "path", @@ -4080,25 +4157,29 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "taskType", - "in": "query", - "description": "The task type to filter by", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "customId", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "taskType": { + "type": "string", + "nullable": true, + "description": "The task type to filter by" + }, + "customId": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -4762,43 +4843,41 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "input", - "in": "query", - "description": "Input text", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "type", - "in": "query", - "description": "Type of the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "appId", - "in": "query", - "description": "ID of the app that will execute the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "input", + "type", + "appId" + ], + "properties": { + "input": { + "type": "string", + "description": "Input text" + }, + "type": { + "type": "string", + "description": "Type of the task" + }, + "appId": { + "type": "string", + "description": "ID of the app that will execute the task" + }, + "identifier": { + "type": "string", + "default": "", + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -5290,16 +5369,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "appId", "in": "path", @@ -5489,44 +5576,42 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "input", - "in": "query", - "description": "Input text", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "appId", - "in": "query", - "description": "ID of the app that will execute the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "default": "" - } - }, - { - "name": "numberOfImages", - "in": "query", - "description": "The number of images to generate", - "schema": { - "type": "integer", - "format": "int64", - "default": 8 + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "input", + "appId" + ], + "properties": { + "input": { + "type": "string", + "description": "Input text" + }, + "appId": { + "type": "string", + "description": "ID of the app that will execute the task" + }, + "identifier": { + "type": "string", + "default": "", + "description": "An arbitrary identifier for the task" + }, + "numberOfImages": { + "type": "integer", + "format": "int64", + "default": 8, + "description": "The number of images to generate" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6119,16 +6204,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "appId", "in": "path", @@ -6345,34 +6438,36 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "text", - "in": "query", - "description": "Text to be translated", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "fromLanguage", - "in": "query", - "description": "Language to translate from", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "toLanguage", - "in": "query", - "description": "Language to translate to", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "text", + "toLanguage" + ], + "properties": { + "text": { + "type": "string", + "description": "Text to be translated" + }, + "fromLanguage": { + "type": "string", + "nullable": true, + "description": "Language to translate from" + }, + "toLanguage": { + "type": "string", + "description": "Language to translate to" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6572,16 +6667,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "from", - "in": "query", - "description": "the url the user is currently at", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "from": { + "type": "string", + "default": "", + "description": "the url the user is currently at" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6646,62 +6749,54 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "term", - "in": "query", - "description": "Term to search", - "schema": { - "type": "string", - "default": "" - } - }, - { - "name": "sortOrder", - "in": "query", - "description": "Order of entries", - "schema": { - "type": "integer", - "format": "int64", - "nullable": true - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum amount of entries, limited to 25", - "schema": { - "type": "integer", - "format": "int64", - "nullable": true - } - }, - { - "name": "cursor", - "in": "query", - "description": "Offset for searching", - "schema": { - "nullable": true, - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "string" + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "term": { + "type": "string", + "default": "", + "description": "Term to search" + }, + "sortOrder": { + "type": "integer", + "format": "int64", + "nullable": true, + "description": "Order of entries" + }, + "limit": { + "type": "integer", + "format": "int64", + "nullable": true, + "description": "Maximum amount of entries, limited to 25" + }, + "cursor": { + "nullable": true, + "description": "Offset for searching", + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "string" + } + ] + }, + "from": { + "type": "string", + "default": "", + "description": "The current user URL" + } } - ] - } - }, - { - "name": "from", - "in": "query", - "description": "The current user URL", - "schema": { - "type": "string", - "default": "" + } } - }, + } + }, + "parameters": [ { "name": "providerId", "in": "path", @@ -6900,16 +6995,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "version", - "in": "query", - "description": "Version to dismiss the changes for", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string", + "description": "Version to dismiss the changes for" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6979,20 +7084,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "guestFallback", - "in": "query", - "description": "Fallback to guest avatar if not found", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "guestFallback": { + "type": "boolean", + "default": false, + "description": "Fallback to guest avatar if not found" + } + } + } } - }, + } + }, + "parameters": [ { "name": "userId", "in": "path", @@ -7082,20 +7191,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "guestFallback", - "in": "query", - "description": "Fallback to guest avatar if not found", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "guestFallback": { + "type": "boolean", + "default": false, + "description": "Fallback to guest avatar if not found" + } + } + } } - }, + } + }, + "parameters": [ { "name": "userId", "in": "path", @@ -7185,17 +7298,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "token", - "in": "query", - "description": "Token of the flow", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "Token of the flow" + } + } + } } } - ], + }, "responses": { "200": { "description": "Login flow credentials returned", @@ -7264,21 +7385,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "darkTheme", - "in": "query", - "description": "Return dark avatar", - "schema": { - "type": "integer", - "nullable": true, - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "darkTheme": { + "type": "boolean", + "nullable": true, + "default": false, + "description": "Return dark avatar" + } + } + } } - }, + } + }, + "parameters": [ { "name": "guestName", "in": "path", @@ -7439,17 +7564,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "password", - "in": "query", - "description": "The password of the user", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "password": { + "type": "string", + "description": "The password of the user" + } + } + } } } - ], + }, "responses": { "200": { "description": "Password confirmation succeeded", @@ -7604,89 +7737,59 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "file", - "in": "query", - "description": "Path of the file", - "schema": { - "type": "string", - "default": "" - } - }, - { - "name": "x", - "in": "query", - "description": "Width of the preview. A width of -1 will use the original image width.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "y", - "in": "query", - "description": "Height of the preview. A height of -1 will use the original image height.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "a", - "in": "query", - "description": "Preserve the aspect ratio", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "forceIcon", - "in": "query", - "description": "Force returning an icon", - "schema": { - "type": "integer", - "default": 1, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "mode", - "in": "query", - "description": "How to crop the image", - "schema": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ] - } - }, - { - "name": "mimeFallback", - "in": "query", - "description": "Whether to fallback to the mime icon if no preview is available", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "default": "", + "description": "Path of the file" + }, + "x": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Width of the preview. A width of -1 will use the original image width." + }, + "y": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Height of the preview. A height of -1 will use the original image height." + }, + "a": { + "type": "boolean", + "default": false, + "description": "Preserve the aspect ratio" + }, + "forceIcon": { + "type": "boolean", + "default": true, + "description": "Force returning an icon" + }, + "mode": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ], + "description": "How to crop the image" + }, + "mimeFallback": { + "type": "boolean", + "default": false, + "description": "Whether to fallback to the mime icon if no preview is available" + } + } + } } } - ], + }, "responses": { "200": { "description": "Preview returned", @@ -7751,90 +7854,60 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "fileId", - "in": "query", - "description": "ID of the file", - "schema": { - "type": "integer", - "format": "int64", - "default": -1 - } - }, - { - "name": "x", - "in": "query", - "description": "Width of the preview. A width of -1 will use the original image width.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "y", - "in": "query", - "description": "Height of the preview. A height of -1 will use the original image height.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "a", - "in": "query", - "description": "Preserve the aspect ratio", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "forceIcon", - "in": "query", - "description": "Force returning an icon", - "schema": { - "type": "integer", - "default": 1, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "mode", - "in": "query", - "description": "How to crop the image", - "schema": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ] - } - }, - { - "name": "mimeFallback", - "in": "query", - "description": "Whether to fallback to the mime icon if no preview is available", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "fileId": { + "type": "integer", + "format": "int64", + "default": -1, + "description": "ID of the file" + }, + "x": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Width of the preview. A width of -1 will use the original image width." + }, + "y": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Height of the preview. A height of -1 will use the original image height." + }, + "a": { + "type": "boolean", + "default": false, + "description": "Preserve the aspect ratio" + }, + "forceIcon": { + "type": "boolean", + "default": true, + "description": "Force returning an icon" + }, + "mode": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ], + "description": "How to crop the image" + }, + "mimeFallback": { + "type": "boolean", + "default": false, + "description": "Whether to fallback to the mime icon if no preview is available" + } + } + } } } - ], + }, "responses": { "200": { "description": "Preview returned", @@ -7952,17 +8025,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "token", - "in": "query", - "description": "App password", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "App password" + } + } + } } } - ], + }, "responses": { "200": { "description": "Device should be wiped", @@ -8009,17 +8090,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "token", - "in": "query", - "description": "App password", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "App password" + } + } + } } } - ], + }, "responses": { "200": { "description": "Wipe finished successfully", @@ -8407,17 +8496,27 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "progress", - "in": "query", - "description": "The progress", - "required": true, - "schema": { - "type": "number", - "format": "double" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "progress" + ], + "properties": { + "progress": { + "type": "number", + "format": "double", + "description": "The progress" + } + } + } } - }, + } + }, + "parameters": [ { "name": "taskId", "in": "path", @@ -8573,25 +8672,32 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "output", - "in": "query", - "description": "The resulting task output, files are represented by their IDs", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "errorMessage", - "in": "query", - "description": "An error message if the task failed", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "object", + "nullable": true, + "description": "The resulting task output, files are represented by their IDs", + "additionalProperties": { + "type": "object" + } + }, + "errorMessage": { + "type": "string", + "nullable": true, + "description": "An error message if the task failed" + } + } + } } - }, + } + }, + "parameters": [ { "name": "taskId", "in": "path", @@ -8747,31 +8853,37 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "providerIds[]", - "in": "query", - "description": "The ids of the providers", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "taskTypeIds[]", - "in": "query", - "description": "The ids of the task types", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "providerIds", + "taskTypeIds" + ], + "properties": { + "providerIds": { + "type": "array", + "description": "The ids of the providers", + "items": { + "type": "string" + } + }, + "taskTypeIds": { + "type": "array", + "description": "The ids of the task types", + "items": { + "type": "string" + } + } + } } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -8893,4 +9005,4 @@ "description": "Controller about the endpoint /ocm-provider/" } ] -} \ No newline at end of file +} diff --git a/core/openapi.json b/core/openapi.json index 247a09c590b4f..3310a03b89d3c 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -1209,16 +1209,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "password", - "in": "query", - "description": "The password of the user", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "password": { + "type": "string", + "description": "The password of the user" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -1316,66 +1326,56 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "search", - "in": "query", - "description": "Text to search for", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "itemType", - "in": "query", - "description": "Type of the items to search for", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "itemId", - "in": "query", - "description": "ID of the items to search for", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "sorter", - "in": "query", - "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "shareTypes[]", - "in": "query", - "description": "Types of shares to search for", - "schema": { - "type": "array", - "default": [], - "items": { - "type": "integer", - "format": "int64" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "search" + ], + "properties": { + "search": { + "type": "string", + "description": "Text to search for" + }, + "itemType": { + "type": "string", + "nullable": true, + "description": "Type of the items to search for" + }, + "itemId": { + "type": "string", + "nullable": true, + "description": "ID of the items to search for" + }, + "sorter": { + "type": "string", + "nullable": true, + "description": "can be piped, top prio first, e.g.: \"commenters|share-recipients\"" + }, + "shareTypes": { + "type": "array", + "default": [], + "description": "Types of shares to search for", + "items": { + "type": "integer", + "format": "int64" + } + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 10, + "description": "Maximum number of results to return" + } + } } } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum number of results to return", - "schema": { - "type": "integer", - "format": "int64", - "default": 10 - } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -1564,25 +1564,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "resourceType", - "in": "query", - "description": "Name of the resource", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resourceId", - "in": "query", - "description": "ID of the resource", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "resourceType", + "resourceId" + ], + "properties": { + "resourceType": { + "type": "string", + "description": "Name of the resource" + }, + "resourceId": { + "type": "string", + "description": "ID of the resource" + } + } + } } - }, + } + }, + "parameters": [ { "name": "collectionId", "in": "path", @@ -1707,25 +1713,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "resourceType", - "in": "query", - "description": "Name of the resource", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resourceId", - "in": "query", - "description": "ID of the resource", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "resourceType", + "resourceId" + ], + "properties": { + "resourceType": { + "type": "string", + "description": "Name of the resource" + }, + "resourceId": { + "type": "string", + "description": "ID of the resource" + } + } + } } - }, + } + }, + "parameters": [ { "name": "collectionId", "in": "path", @@ -1850,16 +1862,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "collectionName", - "in": "query", - "description": "New name", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "collectionName" + ], + "properties": { + "collectionName": { + "type": "string", + "description": "New name" + } + } + } } - }, + } + }, + "parameters": [ { "name": "collectionId", "in": "path", @@ -2197,16 +2219,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "name", - "in": "query", - "description": "Name of the collection", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the collection" + } + } + } } - }, + } + }, + "parameters": [ { "name": "baseResourceType", "in": "path", @@ -2486,20 +2518,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "absolute", - "in": "query", - "description": "Rewrite URLs to absolute ones", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "absolute": { + "type": "boolean", + "default": false, + "description": "Rewrite URLs to absolute ones" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -2566,20 +2602,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "absolute", - "in": "query", - "description": "Rewrite URLs to absolute ones", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "absolute": { + "type": "boolean", + "default": false, + "description": "Rewrite URLs to absolute ones" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -2755,25 +2795,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "paramId", - "in": "query", - "description": "ID of the parameter", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "visibility", - "in": "query", - "description": "New visibility", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "paramId", + "visibility" + ], + "properties": { + "paramId": { + "type": "string", + "description": "ID of the parameter" + }, + "visibility": { + "type": "string", + "description": "New visibility" + } + } + } } - }, + } + }, + "parameters": [ { "name": "targetUserId", "in": "path", @@ -2925,39 +2971,37 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "text", - "in": "query", - "description": "Text to extract from", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resolve", - "in": "query", - "description": "Resolve the references", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum amount of references to extract", - "schema": { - "type": "integer", - "format": "int64", - "default": 1 + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "text" + ], + "properties": { + "text": { + "type": "string", + "description": "Text to extract from" + }, + "resolve": { + "type": "boolean", + "default": false, + "description": "Resolve the references" + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Maximum amount of references to extract" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3030,16 +3074,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "reference", - "in": "query", - "description": "Reference to resolve", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "reference" + ], + "properties": { + "reference": { + "type": "string", + "description": "Reference to resolve" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3110,29 +3164,35 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "references[]", - "in": "query", - "description": "References to resolve", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "references" + ], + "properties": { + "references": { + "type": "array", + "description": "References to resolve", + "items": { + "type": "string" + } + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Maximum amount of references to resolve" + } + } } } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum amount of references to resolve", - "schema": { - "type": "integer", - "format": "int64", - "default": 1 - } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3269,17 +3329,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "timestamp", - "in": "query", - "description": "Timestamp of the last usage", - "schema": { - "type": "integer", - "format": "int64", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "nullable": true, + "description": "Timestamp of the last usage" + } + } + } } - }, + } + }, + "parameters": [ { "name": "providerId", "in": "path", @@ -3431,43 +3499,44 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "input", - "in": "query", - "description": "Task's input parameters", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "type", - "in": "query", - "description": "Type of the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "appId", - "in": "query", - "description": "ID of the app that will execute the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "customId", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "input", + "type", + "appId" + ], + "properties": { + "input": { + "type": "object", + "description": "Task's input parameters", + "additionalProperties": { + "type": "object" + } + }, + "type": { + "type": "string", + "description": "Type of the task" + }, + "appId": { + "type": "string", + "description": "ID of the app that will execute the task" + }, + "customId": { + "type": "string", + "default": "", + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -3952,16 +4021,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "customId", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "customId": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "appId", "in": "path", @@ -4080,25 +4157,29 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "taskType", - "in": "query", - "description": "The task type to filter by", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "customId", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "taskType": { + "type": "string", + "nullable": true, + "description": "The task type to filter by" + }, + "customId": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -4762,43 +4843,41 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "input", - "in": "query", - "description": "Input text", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "type", - "in": "query", - "description": "Type of the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "appId", - "in": "query", - "description": "ID of the app that will execute the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "input", + "type", + "appId" + ], + "properties": { + "input": { + "type": "string", + "description": "Input text" + }, + "type": { + "type": "string", + "description": "Type of the task" + }, + "appId": { + "type": "string", + "description": "ID of the app that will execute the task" + }, + "identifier": { + "type": "string", + "default": "", + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -5290,16 +5369,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "appId", "in": "path", @@ -5489,44 +5576,42 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "input", - "in": "query", - "description": "Input text", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "appId", - "in": "query", - "description": "ID of the app that will execute the task", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "default": "" - } - }, - { - "name": "numberOfImages", - "in": "query", - "description": "The number of images to generate", - "schema": { - "type": "integer", - "format": "int64", - "default": 8 + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "input", + "appId" + ], + "properties": { + "input": { + "type": "string", + "description": "Input text" + }, + "appId": { + "type": "string", + "description": "ID of the app that will execute the task" + }, + "identifier": { + "type": "string", + "default": "", + "description": "An arbitrary identifier for the task" + }, + "numberOfImages": { + "type": "integer", + "format": "int64", + "default": 8, + "description": "The number of images to generate" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6119,16 +6204,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "identifier", - "in": "query", - "description": "An arbitrary identifier for the task", - "schema": { - "type": "string", - "nullable": true + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "nullable": true, + "description": "An arbitrary identifier for the task" + } + } + } } - }, + } + }, + "parameters": [ { "name": "appId", "in": "path", @@ -6345,34 +6438,36 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "text", - "in": "query", - "description": "Text to be translated", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "fromLanguage", - "in": "query", - "description": "Language to translate from", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "toLanguage", - "in": "query", - "description": "Language to translate to", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "text", + "toLanguage" + ], + "properties": { + "text": { + "type": "string", + "description": "Text to be translated" + }, + "fromLanguage": { + "type": "string", + "nullable": true, + "description": "Language to translate from" + }, + "toLanguage": { + "type": "string", + "description": "Language to translate to" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6572,16 +6667,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "from", - "in": "query", - "description": "the url the user is currently at", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "from": { + "type": "string", + "default": "", + "description": "the url the user is currently at" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6646,62 +6749,54 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "term", - "in": "query", - "description": "Term to search", - "schema": { - "type": "string", - "default": "" - } - }, - { - "name": "sortOrder", - "in": "query", - "description": "Order of entries", - "schema": { - "type": "integer", - "format": "int64", - "nullable": true - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum amount of entries, limited to 25", - "schema": { - "type": "integer", - "format": "int64", - "nullable": true - } - }, - { - "name": "cursor", - "in": "query", - "description": "Offset for searching", - "schema": { - "nullable": true, - "oneOf": [ - { - "type": "integer", - "format": "int64" - }, - { - "type": "string" + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "term": { + "type": "string", + "default": "", + "description": "Term to search" + }, + "sortOrder": { + "type": "integer", + "format": "int64", + "nullable": true, + "description": "Order of entries" + }, + "limit": { + "type": "integer", + "format": "int64", + "nullable": true, + "description": "Maximum amount of entries, limited to 25" + }, + "cursor": { + "nullable": true, + "description": "Offset for searching", + "oneOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "string" + } + ] + }, + "from": { + "type": "string", + "default": "", + "description": "The current user URL" + } } - ] - } - }, - { - "name": "from", - "in": "query", - "description": "The current user URL", - "schema": { - "type": "string", - "default": "" + } } - }, + } + }, + "parameters": [ { "name": "providerId", "in": "path", @@ -6900,16 +6995,26 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "version", - "in": "query", - "description": "Version to dismiss the changes for", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string", + "description": "Version to dismiss the changes for" + } + } + } } - }, + } + }, + "parameters": [ { "name": "OCS-APIRequest", "in": "header", @@ -6979,20 +7084,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "guestFallback", - "in": "query", - "description": "Fallback to guest avatar if not found", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "guestFallback": { + "type": "boolean", + "default": false, + "description": "Fallback to guest avatar if not found" + } + } + } } - }, + } + }, + "parameters": [ { "name": "userId", "in": "path", @@ -7082,20 +7191,24 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "guestFallback", - "in": "query", - "description": "Fallback to guest avatar if not found", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "guestFallback": { + "type": "boolean", + "default": false, + "description": "Fallback to guest avatar if not found" + } + } + } } - }, + } + }, + "parameters": [ { "name": "userId", "in": "path", @@ -7185,17 +7298,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "token", - "in": "query", - "description": "Token of the flow", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "Token of the flow" + } + } + } } } - ], + }, "responses": { "200": { "description": "Login flow credentials returned", @@ -7264,21 +7385,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "darkTheme", - "in": "query", - "description": "Return dark avatar", - "schema": { - "type": "integer", - "nullable": true, - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "darkTheme": { + "type": "boolean", + "nullable": true, + "default": false, + "description": "Return dark avatar" + } + } + } } - }, + } + }, + "parameters": [ { "name": "guestName", "in": "path", @@ -7439,17 +7564,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "password", - "in": "query", - "description": "The password of the user", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "password": { + "type": "string", + "description": "The password of the user" + } + } + } } } - ], + }, "responses": { "200": { "description": "Password confirmation succeeded", @@ -7604,89 +7737,59 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "file", - "in": "query", - "description": "Path of the file", - "schema": { - "type": "string", - "default": "" - } - }, - { - "name": "x", - "in": "query", - "description": "Width of the preview. A width of -1 will use the original image width.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "y", - "in": "query", - "description": "Height of the preview. A height of -1 will use the original image height.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "a", - "in": "query", - "description": "Preserve the aspect ratio", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "forceIcon", - "in": "query", - "description": "Force returning an icon", - "schema": { - "type": "integer", - "default": 1, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "mode", - "in": "query", - "description": "How to crop the image", - "schema": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ] - } - }, - { - "name": "mimeFallback", - "in": "query", - "description": "Whether to fallback to the mime icon if no preview is available", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "default": "", + "description": "Path of the file" + }, + "x": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Width of the preview. A width of -1 will use the original image width." + }, + "y": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Height of the preview. A height of -1 will use the original image height." + }, + "a": { + "type": "boolean", + "default": false, + "description": "Preserve the aspect ratio" + }, + "forceIcon": { + "type": "boolean", + "default": true, + "description": "Force returning an icon" + }, + "mode": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ], + "description": "How to crop the image" + }, + "mimeFallback": { + "type": "boolean", + "default": false, + "description": "Whether to fallback to the mime icon if no preview is available" + } + } + } } } - ], + }, "responses": { "200": { "description": "Preview returned", @@ -7751,90 +7854,60 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "fileId", - "in": "query", - "description": "ID of the file", - "schema": { - "type": "integer", - "format": "int64", - "default": -1 - } - }, - { - "name": "x", - "in": "query", - "description": "Width of the preview. A width of -1 will use the original image width.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "y", - "in": "query", - "description": "Height of the preview. A height of -1 will use the original image height.", - "schema": { - "type": "integer", - "format": "int64", - "default": 32 - } - }, - { - "name": "a", - "in": "query", - "description": "Preserve the aspect ratio", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "forceIcon", - "in": "query", - "description": "Force returning an icon", - "schema": { - "type": "integer", - "default": 1, - "enum": [ - 0, - 1 - ] - } - }, - { - "name": "mode", - "in": "query", - "description": "How to crop the image", - "schema": { - "type": "string", - "default": "fill", - "enum": [ - "fill", - "cover" - ] - } - }, - { - "name": "mimeFallback", - "in": "query", - "description": "Whether to fallback to the mime icon if no preview is available", - "schema": { - "type": "integer", - "default": 0, - "enum": [ - 0, - 1 - ] + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "fileId": { + "type": "integer", + "format": "int64", + "default": -1, + "description": "ID of the file" + }, + "x": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Width of the preview. A width of -1 will use the original image width." + }, + "y": { + "type": "integer", + "format": "int64", + "default": 32, + "description": "Height of the preview. A height of -1 will use the original image height." + }, + "a": { + "type": "boolean", + "default": false, + "description": "Preserve the aspect ratio" + }, + "forceIcon": { + "type": "boolean", + "default": true, + "description": "Force returning an icon" + }, + "mode": { + "type": "string", + "default": "fill", + "enum": [ + "fill", + "cover" + ], + "description": "How to crop the image" + }, + "mimeFallback": { + "type": "boolean", + "default": false, + "description": "Whether to fallback to the mime icon if no preview is available" + } + } + } } } - ], + }, "responses": { "200": { "description": "Preview returned", @@ -7952,17 +8025,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "token", - "in": "query", - "description": "App password", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "App password" + } + } + } } } - ], + }, "responses": { "200": { "description": "Device should be wiped", @@ -8009,17 +8090,25 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "token", - "in": "query", - "description": "App password", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string", + "description": "App password" + } + } + } } } - ], + }, "responses": { "200": { "description": "Wipe finished successfully", @@ -8072,4 +8161,4 @@ "description": "Controller about the endpoint /ocm-provider/" } ] -} \ No newline at end of file +}