aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/Controller/TaskProcessingApiController.php10
-rw-r--r--core/ResponseDefinitions.php4
-rw-r--r--core/openapi.json990
3 files changed, 997 insertions, 7 deletions
diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php
index 9b77fb37cdf..c3a2e9e0974 100644
--- a/core/Controller/TaskProcessingApiController.php
+++ b/core/Controller/TaskProcessingApiController.php
@@ -69,8 +69,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
/**
* This endpoint returns all available TaskProcessing task types
*
- * @return DataResponse<Http::STATUS_OK, array{types: array<string, CoreTaskProcessingTaskType>}>
- * []}, array{}>
+ * @return DataResponse<Http::STATUS_OK, array{types: array<string, CoreTaskProcessingTaskType>}, array{}>
*
* 200: Task types returned
*/
@@ -131,7 +130,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
/**
* This endpoint allows checking the status and results of a task.
- * Tasks are removed 1 week after receiving their last update.
+ * Tasks are removed 1 week after receiving their last update
*
* @param int $id The id of the task
*
@@ -222,11 +221,12 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController {
/**
* This endpoint returns the contents of a file referenced in a task
*
- * @param int $taskId
- * @param int $fileId
+ * @param int $taskId The id of the task
+ * @param int $fileId The file id of the file to retrieve
* @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}>
*
* 200: File content returned
+ * 404: Task or file not found
*/
#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/tasks/{taskId}/file/{fileId}', root: '/taskprocessing')]
diff --git a/core/ResponseDefinitions.php b/core/ResponseDefinitions.php
index 414b47c159a..8025f7ef8a7 100644
--- a/core/ResponseDefinitions.php
+++ b/core/ResponseDefinitions.php
@@ -197,8 +197,8 @@ namespace OCA\Core;
* status: int,
* userId: ?string,
* appId: string,
- * input: array,
- * output: ?array,
+ * input: array<string, mixed>,
+ * output: ?array<string, mixed>,
* identifier: ?string,
* completionExpectedAt: ?int,
* progress: ?float
diff --git a/core/openapi.json b/core/openapi.json
index 37c32cb7404..311026a33af 100644
--- a/core/openapi.json
+++ b/core/openapi.json
@@ -466,6 +466,128 @@
}
}
},
+ "TaskProcessingShape": {
+ "type": "object",
+ "required": [
+ "name",
+ "description",
+ "type"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "type": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "TaskProcessingTask": {
+ "type": "object",
+ "required": [
+ "id",
+ "status",
+ "userId",
+ "appId",
+ "input",
+ "output",
+ "identifier",
+ "completionExpectedAt",
+ "progress"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
+ "status": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "userId": {
+ "type": "string",
+ "nullable": true
+ },
+ "appId": {
+ "type": "string"
+ },
+ "input": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "output": {
+ "type": "object",
+ "nullable": true,
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "identifier": {
+ "type": "string",
+ "nullable": true
+ },
+ "completionExpectedAt": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
+ "progress": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ }
+ }
+ },
+ "TaskProcessingTaskType": {
+ "type": "object",
+ "required": [
+ "name",
+ "description",
+ "inputShape",
+ "optionalInputShape",
+ "outputShape",
+ "optionalOutputShape"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "inputShape": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TaskProcessingShape"
+ }
+ },
+ "optionalInputShape": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TaskProcessingShape"
+ }
+ },
+ "outputShape": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TaskProcessingShape"
+ }
+ },
+ "optionalOutputShape": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TaskProcessingShape"
+ }
+ }
+ }
+ },
"Team": {
"type": "object",
"required": [
@@ -3183,6 +3305,874 @@
}
}
},
+ "/ocs/v2.php/taskprocessing/tasktypes": {
+ "get": {
+ "operationId": "task_processing_api-task-types",
+ "summary": "This endpoint returns all available TaskProcessing task types",
+ "tags": [
+ "task_processing_api"
+ ],
+ "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": "Task types 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",
+ "required": [
+ "types"
+ ],
+ "properties": {
+ "types": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/TaskProcessingTaskType"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/ocs/v2.php/taskprocessing/schedule": {
+ "post": {
+ "operationId": "task_processing_api-schedule",
+ "summary": "This endpoint allows scheduling a task",
+ "tags": [
+ "task_processing_api"
+ ],
+ "security": [
+ {},
+ {
+ "bearer_auth": []
+ },
+ {
+ "basic_auth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "input",
+ "in": "query",
+ "description": "Input text",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "type",
+ "in": "query",
+ "description": "Type of the task",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "appId",
+ "in": "query",
+ "description": "ID of the app that will execute the task",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "identifier",
+ "in": "query",
+ "description": "An arbitrary identifier for the task",
+ "schema": {
+ "type": "string",
+ "default": ""
+ }
+ },
+ {
+ "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": "Task scheduled successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "task"
+ ],
+ "properties": {
+ "task": {
+ "$ref": "#/components/schemas/TaskProcessingTask"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Scheduling task is not possible",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "412": {
+ "description": "Scheduling task is not possible",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/ocs/v2.php/taskprocessing/task/{id}": {
+ "get": {
+ "operationId": "task_processing_api-get-task",
+ "summary": "This endpoint allows checking the status and results of a task. Tasks are removed 1 week after receiving their last update",
+ "tags": [
+ "task_processing_api"
+ ],
+ "security": [
+ {},
+ {
+ "bearer_auth": []
+ },
+ {
+ "basic_auth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The id of the task",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ {
+ "name": "OCS-APIRequest",
+ "in": "header",
+ "description": "Required to be true for the API request to pass",
+ "required": true,
+ "schema": {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Task 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",
+ "required": [
+ "task"
+ ],
+ "properties": {
+ "task": {
+ "$ref": "#/components/schemas/TaskProcessingTask"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "delete": {
+ "operationId": "task_processing_api-delete-task",
+ "summary": "This endpoint allows to delete a scheduled task for a user",
+ "tags": [
+ "task_processing_api"
+ ],
+ "security": [
+ {
+ "bearer_auth": []
+ },
+ {
+ "basic_auth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "The id of the task",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ {
+ "name": "OCS-APIRequest",
+ "in": "header",
+ "description": "Required to be true for the API request to pass",
+ "required": true,
+ "schema": {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Task 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",
+ "required": [
+ "task"
+ ],
+ "properties": {
+ "task": {
+ "$ref": "#/components/schemas/TaskProcessingTask"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/ocs/v2.php/taskprocessing/tasks/app/{appId}": {
+ "get": {
+ "operationId": "task_processing_api-list-tasks-by-app",
+ "summary": "This endpoint returns a list of tasks of a user that are related with a specific appId and optionally with an identifier",
+ "tags": [
+ "task_processing_api"
+ ],
+ "security": [
+ {
+ "bearer_auth": []
+ },
+ {
+ "basic_auth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "identifier",
+ "in": "query",
+ "description": "An arbitrary identifier for the task",
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
+ },
+ {
+ "name": "appId",
+ "in": "path",
+ "description": "ID of the app",
+ "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": "Task list 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",
+ "required": [
+ "tasks"
+ ],
+ "properties": {
+ "tasks": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TaskProcessingTask"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/ocs/v2.php/taskprocessing/tasks/{taskId}/file/{fileId}": {
+ "get": {
+ "operationId": "task_processing_api-get-file-contents",
+ "summary": "This endpoint returns the contents of a file referenced in a task",
+ "tags": [
+ "task_processing_api"
+ ],
+ "security": [
+ {
+ "bearer_auth": []
+ },
+ {
+ "basic_auth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "taskId",
+ "in": "path",
+ "description": "The id of the task",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ {
+ "name": "fileId",
+ "in": "path",
+ "description": "The file id of the file to retrieve",
+ "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": "File content returned",
+ "content": {
+ "*/*": {
+ "schema": {
+ "type": "string",
+ "format": "binary"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Task or file not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "ocs"
+ ],
+ "properties": {
+ "ocs": {
+ "type": "object",
+ "required": [
+ "meta",
+ "data"
+ ],
+ "properties": {
+ "meta": {
+ "$ref": "#/components/schemas/OCSMeta"
+ },
+ "data": {
+ "type": "object",
+ "required": [
+ "message"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/ocs/v2.php/teams/{teamId}/resources": {
"get": {
"operationId": "teams_api-resolve-one",