diff --git a/apps/workflowengine/.noopenapi b/apps/workflowengine/.noopenapi deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/apps/workflowengine/appinfo/routes.php b/apps/workflowengine/appinfo/routes.php deleted file mode 100644 index 7937c65124c5c..0000000000000 --- a/apps/workflowengine/appinfo/routes.php +++ /dev/null @@ -1,17 +0,0 @@ - [ - ['name' => 'requestTime#getTimezones', 'url' => '/timezones', 'verb' => 'GET'], - ], - 'ocs-resources' => [ - 'global_workflows' => ['url' => '/api/v1/workflows/global'], - 'user_workflows' => ['url' => '/api/v1/workflows/user'], - ], -]; diff --git a/apps/workflowengine/composer/composer/autoload_classmap.php b/apps/workflowengine/composer/composer/autoload_classmap.php index 0444cce13e75b..0fd869905d4ee 100644 --- a/apps/workflowengine/composer/composer/autoload_classmap.php +++ b/apps/workflowengine/composer/composer/autoload_classmap.php @@ -21,7 +21,7 @@ 'OCA\\WorkflowEngine\\Check\\TFileCheck' => $baseDir . '/../lib/Check/TFileCheck.php', 'OCA\\WorkflowEngine\\Check\\UserGroupMembership' => $baseDir . '/../lib/Check/UserGroupMembership.php', 'OCA\\WorkflowEngine\\Command\\Index' => $baseDir . '/../lib/Command/Index.php', - 'OCA\\WorkflowEngine\\Controller\\AWorkflowController' => $baseDir . '/../lib/Controller/AWorkflowController.php', + 'OCA\\WorkflowEngine\\Controller\\AWorkflowOCSController' => $baseDir . '/../lib/Controller/AWorkflowOCSController.php', 'OCA\\WorkflowEngine\\Controller\\GlobalWorkflowsController' => $baseDir . '/../lib/Controller/GlobalWorkflowsController.php', 'OCA\\WorkflowEngine\\Controller\\RequestTimeController' => $baseDir . '/../lib/Controller/RequestTimeController.php', 'OCA\\WorkflowEngine\\Controller\\UserWorkflowsController' => $baseDir . '/../lib/Controller/UserWorkflowsController.php', @@ -33,6 +33,7 @@ 'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => $baseDir . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php', 'OCA\\WorkflowEngine\\Migration\\Version2000Date20190808074233' => $baseDir . '/../lib/Migration/Version2000Date20190808074233.php', 'OCA\\WorkflowEngine\\Migration\\Version2200Date20210805101925' => $baseDir . '/../lib/Migration/Version2200Date20210805101925.php', + 'OCA\\WorkflowEngine\\ResponseDefinitions' => $baseDir . '/../lib/ResponseDefinitions.php', 'OCA\\WorkflowEngine\\Service\\Logger' => $baseDir . '/../lib/Service/Logger.php', 'OCA\\WorkflowEngine\\Service\\RuleMatcher' => $baseDir . '/../lib/Service/RuleMatcher.php', 'OCA\\WorkflowEngine\\Settings\\ASettings' => $baseDir . '/../lib/Settings/ASettings.php', diff --git a/apps/workflowengine/composer/composer/autoload_static.php b/apps/workflowengine/composer/composer/autoload_static.php index 0910b3cc34634..dddcf5611dab1 100644 --- a/apps/workflowengine/composer/composer/autoload_static.php +++ b/apps/workflowengine/composer/composer/autoload_static.php @@ -36,7 +36,7 @@ class ComposerStaticInitWorkflowEngine 'OCA\\WorkflowEngine\\Check\\TFileCheck' => __DIR__ . '/..' . '/../lib/Check/TFileCheck.php', 'OCA\\WorkflowEngine\\Check\\UserGroupMembership' => __DIR__ . '/..' . '/../lib/Check/UserGroupMembership.php', 'OCA\\WorkflowEngine\\Command\\Index' => __DIR__ . '/..' . '/../lib/Command/Index.php', - 'OCA\\WorkflowEngine\\Controller\\AWorkflowController' => __DIR__ . '/..' . '/../lib/Controller/AWorkflowController.php', + 'OCA\\WorkflowEngine\\Controller\\AWorkflowOCSController' => __DIR__ . '/..' . '/../lib/Controller/AWorkflowOCSController.php', 'OCA\\WorkflowEngine\\Controller\\GlobalWorkflowsController' => __DIR__ . '/..' . '/../lib/Controller/GlobalWorkflowsController.php', 'OCA\\WorkflowEngine\\Controller\\RequestTimeController' => __DIR__ . '/..' . '/../lib/Controller/RequestTimeController.php', 'OCA\\WorkflowEngine\\Controller\\UserWorkflowsController' => __DIR__ . '/..' . '/../lib/Controller/UserWorkflowsController.php', @@ -48,6 +48,7 @@ class ComposerStaticInitWorkflowEngine 'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => __DIR__ . '/..' . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php', 'OCA\\WorkflowEngine\\Migration\\Version2000Date20190808074233' => __DIR__ . '/..' . '/../lib/Migration/Version2000Date20190808074233.php', 'OCA\\WorkflowEngine\\Migration\\Version2200Date20210805101925' => __DIR__ . '/..' . '/../lib/Migration/Version2200Date20210805101925.php', + 'OCA\\WorkflowEngine\\ResponseDefinitions' => __DIR__ . '/..' . '/../lib/ResponseDefinitions.php', 'OCA\\WorkflowEngine\\Service\\Logger' => __DIR__ . '/..' . '/../lib/Service/Logger.php', 'OCA\\WorkflowEngine\\Service\\RuleMatcher' => __DIR__ . '/..' . '/../lib/Service/RuleMatcher.php', 'OCA\\WorkflowEngine\\Settings\\ASettings' => __DIR__ . '/..' . '/../lib/Settings/ASettings.php', diff --git a/apps/workflowengine/lib/Controller/AWorkflowController.php b/apps/workflowengine/lib/Controller/AWorkflowOCSController.php similarity index 60% rename from apps/workflowengine/lib/Controller/AWorkflowController.php rename to apps/workflowengine/lib/Controller/AWorkflowOCSController.php index 6395d0d98f649..394075bde0b5d 100644 --- a/apps/workflowengine/lib/Controller/AWorkflowController.php +++ b/apps/workflowengine/lib/Controller/AWorkflowOCSController.php @@ -11,6 +11,8 @@ use Doctrine\DBAL\Exception; use OCA\WorkflowEngine\Helper\ScopeContext; use OCA\WorkflowEngine\Manager; +use OCA\WorkflowEngine\ResponseDefinitions; +use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; @@ -18,9 +20,16 @@ use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\AppFramework\OCSController; use OCP\IRequest; +use OCP\WorkflowEngine\IEntityEvent; +use OCP\WorkflowEngine\IOperation; use Psr\Log\LoggerInterface; -abstract class AWorkflowController extends OCSController { +/** + * @psalm-import-type WorkflowEngineOperator from ResponseDefinitions + * @psalm-import-type WorkflowEngineCheck from ResponseDefinitions + * @psalm-import-type WorkflowEngineRule from ResponseDefinitions + */ +abstract class AWorkflowOCSController extends OCSController { public function __construct( $appName, @@ -37,9 +46,11 @@ public function __construct( abstract protected function getScopeContext(): ScopeContext; /** - * Example: curl -u joann -H "OCS-APIREQUEST: true" "http://my.nc.srvr/ocs/v2.php/apps/workflowengine/api/v1/workflows/global?format=json" + * Retrieve all configured workflow rules * - * @throws OCSForbiddenException + * @return DataResponse, list>, array{}> + * + * 200: List of workflows returned */ public function index(): DataResponse { $operationsByClass = $this->manager->getAllOperations($this->getScopeContext()); @@ -54,9 +65,12 @@ public function index(): DataResponse { } /** - * Example: curl -u joann -H "OCS-APIREQUEST: true" "http://my.nc.srvr/ocs/v2.php/apps/workflowengine/api/v1/workflows/global/OCA\\Workflow_DocToPdf\\Operation?format=json" + * Retrieve a specific workflow * - * @throws OCSForbiddenException + * @param string $id Workflow ID to load + * @return DataResponse, array{}> + * + * 200: Workflow returned or empty array if the ID is unknown in the scope */ public function show(string $id): DataResponse { $context = $this->getScopeContext(); @@ -72,9 +86,19 @@ public function show(string $id): DataResponse { } /** - * @throws OCSBadRequestException - * @throws OCSForbiddenException - * @throws OCSException + * Create a workflow + * + * @param class-string $class Operation class to execute + * @param string $name Name of the workflow rule + * @param list $checks List of conditions that need to apply for the rule to match + * @param string $operation Operation class to execute on match + * @param string $entity The matched entity + * @param list> $events The list of events on which the rule should be validated + * @return DataResponse + * + * 200: Workflow created + * + * @throws OCSBadRequestException Thrown when a check or check value is invalid */ #[PasswordConfirmationRequired] public function create( @@ -101,9 +125,20 @@ public function create( } /** - * @throws OCSBadRequestException - * @throws OCSForbiddenException - * @throws OCSException + * Modify a workflow + * + * @param int $id Workflow ID to delete + * @param string $name Name of the workflow rule + * @param list $checks List of conditions that need to apply for the rule to match + * @param string $operation Operation action to execute on match + * @param string $entity The matched entity + * @param list> $events The list of events on which the rule should be validated + * @return DataResponse + * + * 200: Workflow updated + * + * @throws OCSBadRequestException Thrown when a check or check value is invalid + * @throws OCSForbiddenException Thrown when workflow is from a different scope */ #[PasswordConfirmationRequired] public function update( @@ -130,9 +165,14 @@ public function update( } /** - * @throws OCSBadRequestException - * @throws OCSForbiddenException - * @throws OCSException + * Delete a workflow + * + * @param int $id Workflow ID to delete + * @return DataResponse|DataResponse, array{}> + * + * 200: Workflow deleted + * + * @throws OCSForbiddenException Thrown when workflow is from a different scope */ #[PasswordConfirmationRequired] public function destroy(int $id): DataResponse { diff --git a/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php b/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php index f7cfb1527bb44..29ac95f3f5d4b 100644 --- a/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php +++ b/apps/workflowengine/lib/Controller/GlobalWorkflowsController.php @@ -9,12 +9,109 @@ namespace OCA\WorkflowEngine\Controller; use OCA\WorkflowEngine\Helper\ScopeContext; +use OCA\WorkflowEngine\ResponseDefinitions; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\ApiRoute; +use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; +use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCS\OCSBadRequestException; +use OCP\AppFramework\OCS\OCSForbiddenException; +use OCP\WorkflowEngine\IEntityEvent; use OCP\WorkflowEngine\IManager; +use OCP\WorkflowEngine\IOperation; -class GlobalWorkflowsController extends AWorkflowController { +/** + * @psalm-import-type WorkflowEngineCheck from ResponseDefinitions + * @psalm-import-type WorkflowEngineRule from ResponseDefinitions + */ +class GlobalWorkflowsController extends AWorkflowOCSController { private ?ScopeContext $scopeContext = null; + /** + * Retrieve all configured workflow rules + * + * @return DataResponse, list>, array{}> + * + * 200: List of workflows returned + */ + #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/global')] + public function index(): DataResponse { + return parent::index(); + } + + /** + * Retrieve a specific workflow + * + * @param string $id Workflow ID to load + * @return DataResponse, array{}> + * + * 200: Workflow returned or empty array if the ID is unknown in the scope + */ + #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/global/{id}')] + public function show(string $id): DataResponse { + return parent::show($id); + } + + /** + * Create a workflow + * + * @param class-string $class Operation class to execute + * @param string $name Name of the workflow rule + * @param list $checks List of conditions that need to apply for the rule to match + * @param string $operation Operation class to execute on match + * @param string $entity The matched entity + * @param list> $events The list of events on which the rule should be validated + * @return DataResponse + * + * 200: Workflow created + * + * @throws OCSBadRequestException Thrown when a check or check value is invalid + */ + #[PasswordConfirmationRequired] + #[ApiRoute(verb: 'POST', url: '/api/v1/workflows/global')] + public function create(string $class, string $name, array $checks, string $operation, string $entity, array $events): DataResponse { + return parent::create($class, $name, $checks, $operation, $entity, $events); + } + + /** + * Modify a workflow + * + * @param int $id Workflow ID to delete + * @param string $name Name of the workflow rule + * @param list $checks List of conditions that need to apply for the rule to match + * @param string $operation Operation action to execute on match + * @param string $entity The matched entity + * @param list> $events The list of events on which the rule should be validated + * @return DataResponse + * + * 200: Workflow updated + * + * @throws OCSBadRequestException Thrown when a check or check value is invalid + * @throws OCSForbiddenException Thrown when workflow is from a different scope + */ + #[PasswordConfirmationRequired] + #[ApiRoute(verb: 'PUT', url: '/api/v1/workflows/global/{id}')] + public function update(int $id, string $name, array $checks, string $operation, string $entity, array $events): DataResponse { + return parent::update($id, $name, $checks, $operation, $entity, $events); + } + + /** + * Delete a workflow + * + * @param int $id Workflow ID to delete + * @return DataResponse|DataResponse, array{}> + * + * 200: Workflow deleted + * + * @throws OCSForbiddenException Thrown when workflow is from a different scope + */ + #[PasswordConfirmationRequired] + #[ApiRoute(verb: 'DELETE', url: '/api/v1/workflows/global/{id}')] + public function destroy(int $id): DataResponse { + return parent::destroy($id); + } + protected function getScopeContext(): ScopeContext { if ($this->scopeContext === null) { $this->scopeContext = new ScopeContext(IManager::SCOPE_ADMIN); diff --git a/apps/workflowengine/lib/Controller/RequestTimeController.php b/apps/workflowengine/lib/Controller/RequestTimeController.php index 4b34f16ce0a54..2437253c8b7e8 100644 --- a/apps/workflowengine/lib/Controller/RequestTimeController.php +++ b/apps/workflowengine/lib/Controller/RequestTimeController.php @@ -7,6 +7,7 @@ namespace OCA\WorkflowEngine\Controller; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\JSONResponse; @@ -17,6 +18,7 @@ class RequestTimeController extends Controller { * @return JSONResponse */ #[NoAdminRequired] + #[FrontpageRoute(verb: 'GET', url: '/timezones')] public function getTimezones($search = '') { $timezones = \DateTimeZone::listIdentifiers(); diff --git a/apps/workflowengine/lib/Controller/UserWorkflowsController.php b/apps/workflowengine/lib/Controller/UserWorkflowsController.php index 953ce1492331b..da7dd2b4208bf 100644 --- a/apps/workflowengine/lib/Controller/UserWorkflowsController.php +++ b/apps/workflowengine/lib/Controller/UserWorkflowsController.php @@ -10,6 +10,9 @@ use OCA\WorkflowEngine\Helper\ScopeContext; use OCA\WorkflowEngine\Manager; +use OCA\WorkflowEngine\ResponseDefinitions; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired; use OCP\AppFramework\Http\DataResponse; @@ -17,10 +20,16 @@ use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\IRequest; use OCP\IUserSession; +use OCP\WorkflowEngine\IEntityEvent; use OCP\WorkflowEngine\IManager; +use OCP\WorkflowEngine\IOperation; use Psr\Log\LoggerInterface; -class UserWorkflowsController extends AWorkflowController { +/** + * @psalm-import-type WorkflowEngineCheck from ResponseDefinitions + * @psalm-import-type WorkflowEngineRule from ResponseDefinitions + */ +class UserWorkflowsController extends AWorkflowOCSController { /** @var ScopeContext */ private $scopeContext; @@ -38,49 +47,88 @@ public function __construct( /** * Retrieve all configured workflow rules * - * Example: curl -u joann -H "OCS-APIREQUEST: true" "http://my.nc.srvr/ocs/v2.php/apps/workflowengine/api/v1/workflows/user?format=json" + * @return DataResponse, list>, array{}> * - * @throws OCSForbiddenException + * 200: List of workflows returned */ #[NoAdminRequired] + #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/user')] public function index(): DataResponse { return parent::index(); } /** - * Example: curl -u joann -H "OCS-APIREQUEST: true" "http://my.nc.srvr/ocs/v2.php/apps/workflowengine/api/v1/workflows/user/OCA\\Workflow_DocToPdf\\Operation?format=json" - * @throws OCSForbiddenException + * Retrieve a specific workflow + * + * @param string $id Workflow ID to load + * @return DataResponse, array{}> + * + * 200: Workflow returned or empty array if the ID is unknown in the scope */ #[NoAdminRequired] + #[ApiRoute(verb: 'GET', url: '/api/v1/workflows/user/{id}')] public function show(string $id): DataResponse { return parent::show($id); } /** - * @throws OCSBadRequestException - * @throws OCSForbiddenException + * Create a workflow + * + * @param class-string $class Operation class to execute + * @param string $name Name of the workflow rule + * @param list $checks List of conditions that need to apply for the rule to match + * @param string $operation Operation class to execute on match + * @param string $entity The matched entity + * @param list> $events The list of events on which the rule should be validated + * @return DataResponse + * + * 200: Workflow created + * + * @throws OCSBadRequestException Thrown when a check or check value is invalid */ #[NoAdminRequired] #[PasswordConfirmationRequired] + #[ApiRoute(verb: 'POST', url: '/api/v1/workflows/user')] public function create(string $class, string $name, array $checks, string $operation, string $entity, array $events): DataResponse { return parent::create($class, $name, $checks, $operation, $entity, $events); } /** - * @throws OCSBadRequestException - * @throws OCSForbiddenException + * Modify a workflow + * + * @param int $id Workflow ID to delete + * @param string $name Name of the workflow rule + * @param list $checks List of conditions that need to apply for the rule to match + * @param string $operation Operation action to execute on match + * @param string $entity The matched entity + * @param list> $events The list of events on which the rule should be validated + * @return DataResponse + * + * 200: Workflow updated + * + * @throws OCSBadRequestException Thrown when a check or check value is invalid + * @throws OCSForbiddenException Thrown when workflow is from a different scope */ #[NoAdminRequired] #[PasswordConfirmationRequired] + #[ApiRoute(verb: 'PUT', url: '/api/v1/workflows/user/{id}')] public function update(int $id, string $name, array $checks, string $operation, string $entity, array $events): DataResponse { return parent::update($id, $name, $checks, $operation, $entity, $events); } /** - * @throws OCSForbiddenException + * Delete a workflow + * + * @param int $id Workflow ID to delete + * @return DataResponse|DataResponse, array{}> + * + * 200: Workflow deleted + * + * @throws OCSForbiddenException Thrown when workflow is from a different scope */ #[NoAdminRequired] #[PasswordConfirmationRequired] + #[ApiRoute(verb: 'DELETE', url: '/api/v1/workflows/user/{id}')] public function destroy(int $id): DataResponse { return parent::destroy($id); } diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index a4d39ef2c91f1..061188b3648a7 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -43,13 +43,14 @@ use Psr\Log\LoggerInterface; /** - * @psalm-type Check = array{id: int, class: class-string, operator: string, value: string, hash: string} + * @psalm-import-type WorkflowEngineCheck from ResponseDefinitions + * @psalm-import-type WorkflowEngineRule from ResponseDefinitions */ class Manager implements IManager { /** @var array[] */ protected array $operations = []; - /** @var array */ + /** @var array */ protected array $checks = []; /** @var IEntity[] */ @@ -264,7 +265,7 @@ protected function insertOperation( /** * @param string $class * @param string $name - * @param list $checks + * @param list $checks * @param string $operation * @return array The added operation * @throws \UnexpectedValueException @@ -332,7 +333,7 @@ protected function canModify(int $id, ScopeContext $scopeContext):bool { /** * @param int $id * @param string $name - * @param array[] $checks + * @param list $checks * @param string $operation * @return array The updated operation * @throws \UnexpectedValueException @@ -455,7 +456,7 @@ protected function validateEvents(string $entity, array $events, IOperation $ope /** * @param class-string $class - * @param list $checks + * @param list $checks * @param array $events * @throws \UnexpectedValueException */ @@ -522,7 +523,7 @@ public function validateOperation(string $class, string $name, array $checks, st /** * @param int[] $checkIds - * @return array + * @return array */ public function getChecks(array $checkIds): array { $checkIds = array_map('intval', $checkIds); @@ -546,9 +547,12 @@ public function getChecks(array $checkIds): array { $result = $query->executeQuery(); while ($row = $result->fetchAssociative()) { - /** @var Check $row */ - $this->checks[(int)$row['id']] = $row; - $checks[(int)$row['id']] = $row; + $id = (int)$row['id']; + unset($row['id'], $row['hash']); + + /** @var WorkflowEngineCheck $row */ + $this->checks[$id] = $row; + $checks[$id] = $row; } $result->closeCursor(); @@ -604,20 +608,21 @@ protected function addScope(int $operationId, ScopeContext $scope): void { $insertQuery->executeStatement(); } + + /** + * @param array{class: class-string<\OCP\WorkflowEngine\IOperation>, entity: class-string<\OCP\WorkflowEngine\IEntity>, checks: string, events: string, id: int, name: string, operation: string} $operation + * @return WorkflowEngineRule + */ public function formatOperation(array $operation): array { $checkIds = json_decode($operation['checks'], true); - $checks = $this->getChecks($checkIds); - $operation['checks'] = []; - foreach ($checks as $check) { - // Remove internal values - unset($check['id']); - unset($check['hash']); - - $operation['checks'][] = $check; - } - $operation['events'] = json_decode($operation['events'], true) ?? []; + /** @var list $checks */ + $checks = $this->getChecks($checkIds); + $operation['checks'] = $checks; + /** @var list> $events */ + $events = json_decode($operation['events'], true) ?? []; + $operation['events'] = $events; return $operation; } diff --git a/apps/workflowengine/lib/ResponseDefinitions.php b/apps/workflowengine/lib/ResponseDefinitions.php new file mode 100644 index 0000000000000..62257f673419d --- /dev/null +++ b/apps/workflowengine/lib/ResponseDefinitions.php @@ -0,0 +1,37 @@ +, + * value: string, + * operator: WorkflowEngineOperator, + * } + * + * @psalm-type WorkflowEngineRule = array{ + * id: int, + * class: class-string, + * name: string, + * checks: list, + * operation: string, + * entity: class-string, + * events: list>, + * } + */ +class ResponseDefinitions { +} diff --git a/apps/workflowengine/lib/Service/RuleMatcher.php b/apps/workflowengine/lib/Service/RuleMatcher.php index 8c7080d55d8bb..01394cc8e5536 100644 --- a/apps/workflowengine/lib/Service/RuleMatcher.php +++ b/apps/workflowengine/lib/Service/RuleMatcher.php @@ -11,6 +11,7 @@ use OCA\WorkflowEngine\Helper\LogContext; use OCA\WorkflowEngine\Helper\ScopeContext; use OCA\WorkflowEngine\Manager; +use OCA\WorkflowEngine\ResponseDefinitions; use OCP\Files\Storage\IStorage; use OCP\IL10N; use OCP\IUserSession; @@ -26,7 +27,7 @@ use RuntimeException; /** - * @psalm-import-type Check from Manager + * @psalm-import-type WorkflowEngineCheck from ResponseDefinitions */ class RuleMatcher implements IRuleMatcher { @@ -179,7 +180,7 @@ public function getMatchingOperations(string $class, bool $returnFirstMatchingOp } /** - * @param Check $check + * @param WorkflowEngineCheck $check * @return bool */ public function check(array $check): bool { diff --git a/apps/workflowengine/openapi-administration.json b/apps/workflowengine/openapi-administration.json new file mode 100644 index 0000000000000..014d241938ba0 --- /dev/null +++ b/apps/workflowengine/openapi-administration.json @@ -0,0 +1,967 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "workflowengine-administration", + "version": "0.0.1", + "description": "Nextcloud workflow engine", + "license": { + "name": "agpl" + } + }, + "components": { + "securitySchemes": { + "basic_auth": { + "type": "http", + "scheme": "basic" + }, + "bearer_auth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "Check": { + "type": "object", + "required": [ + "class", + "value", + "operator" + ], + "properties": { + "class": { + "type": "string", + "minLength": 1 + }, + "value": { + "type": "string" + }, + "operator": { + "$ref": "#/components/schemas/Operator" + } + } + }, + "OCSMeta": { + "type": "object", + "required": [ + "status", + "statuscode" + ], + "properties": { + "status": { + "type": "string" + }, + "statuscode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "totalitems": { + "type": "string" + }, + "itemsperpage": { + "type": "string" + } + } + }, + "Operator": { + "type": "string", + "enum": [ + "is", + "in", + "match", + "less", + "greater", + "matchesIPv4", + "matchesIPv6", + "!is", + "!in", + "!match", + "!less", + "!greater", + "!matchesIPv4", + "!matchesIPv6" + ] + }, + "Rule": { + "type": "object", + "required": [ + "id", + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "class": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "checks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string" + }, + "entity": { + "type": "string", + "minLength": 1 + }, + "events": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + }, + "paths": { + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/global": { + "get": { + "operationId": "global_workflows-index", + "summary": "Retrieve all configured workflow rules", + "description": "This endpoint requires admin access", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "List of workflows returned", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "global_workflows-create", + "summary": "Create a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "class": { + "type": "string", + "description": "Operation class to execute", + "minLength": 1 + }, + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation class to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/global/{id}": { + "get": { + "operationId": "global_workflows-show", + "summary": "Retrieve a specific workflow", + "description": "This endpoint requires admin access", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to load", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow returned or empty array if the ID is unknown in the scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/Rule" + }, + { + "type": "array", + "maxItems": 0 + } + ] + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "global_workflows-update", + "summary": "Modify a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation action to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + ] + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "global_workflows-destroy", + "summary": "Delete a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + ] + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + } + }, + "tags": [] +} diff --git a/apps/workflowengine/openapi-administration.json.license b/apps/workflowengine/openapi-administration.json.license new file mode 100644 index 0000000000000..8c5ffd5249446 --- /dev/null +++ b/apps/workflowengine/openapi-administration.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/openapi-full.json b/apps/workflowengine/openapi-full.json new file mode 100644 index 0000000000000..449bae61bdca1 --- /dev/null +++ b/apps/workflowengine/openapi-full.json @@ -0,0 +1,1662 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "workflowengine-full", + "version": "0.0.1", + "description": "Nextcloud workflow engine", + "license": { + "name": "agpl" + } + }, + "components": { + "securitySchemes": { + "basic_auth": { + "type": "http", + "scheme": "basic" + }, + "bearer_auth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "Check": { + "type": "object", + "required": [ + "class", + "value", + "operator" + ], + "properties": { + "class": { + "type": "string", + "minLength": 1 + }, + "value": { + "type": "string" + }, + "operator": { + "$ref": "#/components/schemas/Operator" + } + } + }, + "OCSMeta": { + "type": "object", + "required": [ + "status", + "statuscode" + ], + "properties": { + "status": { + "type": "string" + }, + "statuscode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "totalitems": { + "type": "string" + }, + "itemsperpage": { + "type": "string" + } + } + }, + "Operator": { + "type": "string", + "enum": [ + "is", + "in", + "match", + "less", + "greater", + "matchesIPv4", + "matchesIPv6", + "!is", + "!in", + "!match", + "!less", + "!greater", + "!matchesIPv4", + "!matchesIPv6" + ] + }, + "Rule": { + "type": "object", + "required": [ + "id", + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "class": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "checks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string" + }, + "entity": { + "type": "string", + "minLength": 1 + }, + "events": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + }, + "paths": { + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/global": { + "get": { + "operationId": "global_workflows-index", + "summary": "Retrieve all configured workflow rules", + "description": "This endpoint requires admin access", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "List of workflows returned", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "global_workflows-create", + "summary": "Create a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "class": { + "type": "string", + "description": "Operation class to execute", + "minLength": 1 + }, + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation class to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/global/{id}": { + "get": { + "operationId": "global_workflows-show", + "summary": "Retrieve a specific workflow", + "description": "This endpoint requires admin access", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to load", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow returned or empty array if the ID is unknown in the scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/Rule" + }, + { + "type": "array", + "maxItems": 0 + } + ] + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "global_workflows-update", + "summary": "Modify a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation action to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + ] + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "global_workflows-destroy", + "summary": "Delete a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + ] + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/user": { + "get": { + "operationId": "user_workflows-index", + "summary": "Retrieve all configured workflow rules", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "List of workflows returned", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "user_workflows-create", + "summary": "Create a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "class": { + "type": "string", + "description": "Operation class to execute", + "minLength": 1 + }, + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation class to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/user/{id}": { + "get": { + "operationId": "user_workflows-show", + "summary": "Retrieve a specific workflow", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to load", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow returned or empty array if the ID is unknown in the scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/Rule" + }, + { + "type": "array", + "maxItems": 0 + } + ] + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "user_workflows-update", + "summary": "Modify a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation action to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "user_workflows-destroy", + "summary": "Delete a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + } + }, + "tags": [] +} diff --git a/apps/workflowengine/openapi-full.json.license b/apps/workflowengine/openapi-full.json.license new file mode 100644 index 0000000000000..8c5ffd5249446 --- /dev/null +++ b/apps/workflowengine/openapi-full.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/workflowengine/openapi.json b/apps/workflowengine/openapi.json new file mode 100644 index 0000000000000..676b03b820c7f --- /dev/null +++ b/apps/workflowengine/openapi.json @@ -0,0 +1,831 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "workflowengine", + "version": "0.0.1", + "description": "Nextcloud workflow engine", + "license": { + "name": "agpl" + } + }, + "components": { + "securitySchemes": { + "basic_auth": { + "type": "http", + "scheme": "basic" + }, + "bearer_auth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "Check": { + "type": "object", + "required": [ + "class", + "value", + "operator" + ], + "properties": { + "class": { + "type": "string", + "minLength": 1 + }, + "value": { + "type": "string" + }, + "operator": { + "$ref": "#/components/schemas/Operator" + } + } + }, + "OCSMeta": { + "type": "object", + "required": [ + "status", + "statuscode" + ], + "properties": { + "status": { + "type": "string" + }, + "statuscode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "totalitems": { + "type": "string" + }, + "itemsperpage": { + "type": "string" + } + } + }, + "Operator": { + "type": "string", + "enum": [ + "is", + "in", + "match", + "less", + "greater", + "matchesIPv4", + "matchesIPv6", + "!is", + "!in", + "!match", + "!less", + "!greater", + "!matchesIPv4", + "!matchesIPv6" + ] + }, + "Rule": { + "type": "object", + "required": [ + "id", + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "class": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "checks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string" + }, + "entity": { + "type": "string", + "minLength": 1 + }, + "events": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + }, + "paths": { + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/user": { + "get": { + "operationId": "user_workflows-index", + "summary": "Retrieve all configured workflow rules", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "List of workflows returned", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "user_workflows-create", + "summary": "Create a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "class": { + "type": "string", + "description": "Operation class to execute", + "minLength": 1 + }, + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation class to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/user/{id}": { + "get": { + "operationId": "user_workflows-show", + "summary": "Retrieve a specific workflow", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to load", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow returned or empty array if the ID is unknown in the scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/Rule" + }, + { + "type": "array", + "maxItems": 0 + } + ] + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "user_workflows-update", + "summary": "Modify a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/Check" + } + }, + "operation": { + "type": "string", + "description": "Operation action to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Rule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "user_workflows-destroy", + "summary": "Delete a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + } + }, + "tags": [] +} diff --git a/apps/workflowengine/openapi.json.license b/apps/workflowengine/openapi.json.license new file mode 100644 index 0000000000000..8c5ffd5249446 --- /dev/null +++ b/apps/workflowengine/openapi.json.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/openapi.json b/openapi.json index d034244903413..ab25747a0f58d 100644 --- a/openapi.json +++ b/openapi.json @@ -4738,6 +4738,90 @@ } } } + }, + "WorkflowengineCheck": { + "type": "object", + "required": [ + "class", + "value", + "operator" + ], + "properties": { + "class": { + "type": "string", + "minLength": 1 + }, + "value": { + "type": "string" + }, + "operator": { + "$ref": "#/components/schemas/WorkflowengineOperator" + } + } + }, + "WorkflowengineOperator": { + "type": "string", + "enum": [ + "is", + "in", + "match", + "less", + "greater", + "matchesIPv4", + "matchesIPv6", + "!is", + "!in", + "!match", + "!less", + "!greater", + "!matchesIPv4", + "!matchesIPv6" + ] + }, + "WorkflowengineRule": { + "type": "object", + "required": [ + "id", + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "class": { + "type": "string", + "minLength": 1 + }, + "name": { + "type": "string" + }, + "checks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkflowengineCheck" + } + }, + "operation": { + "type": "string" + }, + "entity": { + "type": "string", + "minLength": 1 + }, + "events": { + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + } + } } } }, @@ -40223,6 +40307,1532 @@ } } } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/global": { + "get": { + "operationId": "workflowengine-global_workflows-index", + "summary": "Retrieve all configured workflow rules", + "description": "This endpoint requires admin access", + "tags": [ + "workflowengine/global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "List of workflows returned", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkflowengineRule" + } + } + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "workflowengine-global_workflows-create", + "summary": "Create a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "workflowengine/global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "class": { + "type": "string", + "description": "Operation class to execute", + "minLength": 1 + }, + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/WorkflowengineCheck" + } + }, + "operation": { + "type": "string", + "description": "Operation class to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/WorkflowengineRule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/global/{id}": { + "get": { + "operationId": "workflowengine-global_workflows-show", + "summary": "Retrieve a specific workflow", + "description": "This endpoint requires admin access", + "tags": [ + "workflowengine/global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to load", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow returned or empty array if the ID is unknown in the scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/WorkflowengineRule" + }, + { + "type": "array", + "maxItems": 0 + } + ] + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "workflowengine-global_workflows-update", + "summary": "Modify a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "workflowengine/global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/WorkflowengineCheck" + } + }, + "operation": { + "type": "string", + "description": "Operation action to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/WorkflowengineRule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + ] + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "workflowengine-global_workflows-destroy", + "summary": "Delete a workflow", + "description": "This endpoint requires admin access\nThis endpoint requires password confirmation", + "tags": [ + "workflowengine/global_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + ] + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/user": { + "get": { + "operationId": "workflowengine-user_workflows-index", + "summary": "Retrieve all configured workflow rules", + "tags": [ + "workflowengine/user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "List of workflows returned", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkflowengineRule" + } + } + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "workflowengine-user_workflows-create", + "summary": "Create a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "workflowengine/user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "class", + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "class": { + "type": "string", + "description": "Operation class to execute", + "minLength": 1 + }, + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/WorkflowengineCheck" + } + }, + "operation": { + "type": "string", + "description": "Operation class to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow created", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/WorkflowengineRule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/workflowengine/api/v1/workflows/user/{id}": { + "get": { + "operationId": "workflowengine-user_workflows-show", + "summary": "Retrieve a specific workflow", + "tags": [ + "workflowengine/user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to load", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Workflow returned or empty array if the ID is unknown in the scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/WorkflowengineRule" + }, + { + "type": "array", + "maxItems": 0 + } + ] + } + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "put": { + "operationId": "workflowengine-user_workflows-update", + "summary": "Modify a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "workflowengine/user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "checks", + "operation", + "entity", + "events" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the workflow rule" + }, + "checks": { + "type": "array", + "description": "List of conditions that need to apply for the rule to match", + "items": { + "$ref": "#/components/schemas/WorkflowengineCheck" + } + }, + "operation": { + "type": "string", + "description": "Operation action to execute on match" + }, + "entity": { + "type": "string", + "description": "The matched entity" + }, + "events": { + "type": "array", + "description": "The list of events on which the rule should be validated", + "items": { + "type": "string", + "minLength": 1 + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/WorkflowengineRule" + } + } + } + } + } + } + } + }, + "400": { + "description": "Thrown when a check or check value is invalid", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "workflowengine-user_workflows-destroy", + "summary": "Delete a workflow", + "description": "This endpoint requires password confirmation", + "tags": [ + "workflowengine/user_workflows" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Workflow ID to delete", + "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": { + "200": { + "description": "Workflow deleted", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "403": { + "description": "Thrown when workflow is from a different scope", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } } } }