{ "openapi": "3.0.3", "info": { "title": "assistant", "version": "0.0.1", "description": "Process and transform text", "license": { "name": "agpl" } }, "components": { "securitySchemes": { "basic_auth": { "type": "http", "scheme": "basic" }, "bearer_auth": { "type": "http", "scheme": "bearer" } }, "schemas": { "OCSMeta": { "type": "object", "required": [ "status", "statuscode" ], "properties": { "status": { "type": "string" }, "statuscode": { "type": "integer" }, "message": { "type": "string" }, "totalitems": { "type": "string" }, "itemsperpage": { "type": "string" } } }, "PublicCapabilities": { "type": "object", "required": [ "assistant" ], "properties": { "assistant": { "type": "object", "required": [ "version" ], "properties": { "version": { "type": "string" }, "enabled": { "type": "boolean" } } } } }, "ShapeDescriptor": { "type": "object", "required": [ "name", "description", "type" ], "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "type": { "type": "string" } } }, "TaskProcessingTask": { "type": "object", "required": [ "appId", "completionExpectedAt", "customId", "id", "input", "lastUpdated", "output", "progress", "status", "type", "userId" ], "properties": { "appId": { "type": "string" }, "completionExpectedAt": { "type": "integer", "format": "int64", "nullable": true }, "customId": { "type": "string", "nullable": true }, "id": { "type": "integer", "format": "int64", "nullable": true }, "input": { "type": "object", "additionalProperties": { "type": "object" } }, "lastUpdated": { "type": "integer", "format": "int64" }, "output": { "type": "object", "additionalProperties": { "type": "object" } }, "progress": { "type": "number", "format": "double", "nullable": true }, "status": { "type": "string" }, "type": { "type": "string" }, "userId": { "type": "string", "nullable": true } } }, "TaskProcessingTaskType": { "type": "object", "required": [ "id", "name", "description", "inputShape", "optionalInputShape", "outputShape", "optionalOutputShape", "priority" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "inputShape": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/ShapeDescriptor" } }, "optionalInputShape": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/ShapeDescriptor" } }, "outputShape": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/ShapeDescriptor" } }, "optionalOutputShape": { "type": "object", "additionalProperties": { "$ref": "#/components/schemas/ShapeDescriptor" } }, "priority": { "type": "integer", "format": "int64" } } } } }, "paths": { "/ocs/v2.php/apps/assistant/api/{apiVersion}/task-types": { "get": { "operationId": "assistant_api-get-available-task-types", "summary": "Get available task types", "description": "Get all available task types that the assistant can handle.", "tags": [ "task_management" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "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": "Available 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": "array", "items": { "$ref": "#/components/schemas/TaskProcessingTaskType" } } } } } } } } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/tasks": { "get": { "operationId": "assistant_api-get-user-tasks", "summary": "Get user's tasks", "description": "Get a list of assistant tasks for the current user.", "tags": [ "task_management" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "taskTypeId", "in": "query", "description": "Task type id. If null, tasks of all task types will be retrieved", "schema": { "type": "string", "nullable": true } }, { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "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": "User tasks 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" } } } } } } } } } } }, "404": { "description": "No tasks found", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "string" } } } } } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/parse-file": { "post": { "operationId": "assistant_api-parse-text-from-file", "summary": "Extract text from file", "description": "Parse and extract text content of a file (if the file type is supported)", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "filePath", "in": "query", "description": "Path of the file to parse in the user's storage", "required": true, "schema": { "type": "string" } }, { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "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": "Text parsed from file 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": [ "parsedText" ], "properties": { "parsedText": { "type": "string" } } } } } } } } } }, "400": { "description": "Parsing text from file 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": "string" } } } } } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/task/{ocpTaskId}/notify": { "post": { "operationId": "assistant_api-notify-when-ready", "summary": "Notify when the task has finished", "description": "Does not need bruteforce protection since we respond with success anyways as we don't want to keep the front-end waiting. However, we still use rate limiting to prevent timing attacks.", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "name": "ocpTaskId", "in": "path", "description": "ID of the target 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": "Ready notification enabled successfully", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "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": [ "error" ], "properties": { "error": { "type": "string" } } } } } } } }, "text/plain": { "schema": { "type": "string" } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/input-file": { "post": { "operationId": "assistant_api-upload-input-file", "summary": "Upload input file", "description": "Upload an input file for a task that is being prepared", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "extension", "in": "query", "description": "The file extension", "schema": { "type": "string", "nullable": true } }, { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "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": "The input file was uploaded", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "object", "required": [ "fileId", "filePath" ], "properties": { "fileId": { "type": "integer", "format": "int64" }, "filePath": { "type": "string" } } } } } } } } } }, "400": { "description": "Impossible to upload an input file", "content": { "application/json": { "schema": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "string" } } } } } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/file/{fileId}/display": { "get": { "operationId": "assistant_api-display-user-file", "summary": "Get a file of the current user", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "name": "fileId", "in": "path", "description": "The ID of the file that is requested", "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": "The file is returned", "content": { "*/*": { "schema": { "type": "string", "format": "binary" } } } }, "404": { "description": "The file was 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": { "text/plain": { "schema": { "type": "string" } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/file/{fileId}/info": { "get": { "operationId": "assistant_api-get-user-file-info", "summary": "Get user file info", "description": "Get information about a file of the current user", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "name": "fileId", "in": "path", "description": "The file ID for which the info is requested", "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": "The file info is 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": [ "name", "path", "owner", "size" ], "properties": { "name": { "type": "string" }, "path": { "type": "string" }, "owner": { "type": "string" }, "size": { "type": "integer", "format": "int64" } } } } } } } } } }, "404": { "description": "The file was 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/apps/assistant/api/{apiVersion}/task/{ocpTaskId}/file/{fileId}/share": { "post": { "operationId": "assistant_api-share-output-file", "summary": "Share an output file", "description": "Share a file that was produced by a task", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "name": "ocpTaskId", "in": "path", "description": "The task ID", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "fileId", "in": "path", "description": "The file ID", "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": "The file was shared", "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": [ "shareToken" ], "properties": { "shareToken": { "type": "string" } } } } } } } } } }, "404": { "description": "The file was 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": [ "error" ], "properties": { "error": { "type": "string" } } } } } } } } } } } } }, "/ocs/v2.php/apps/assistant/api/{apiVersion}/task/{ocpTaskId}/output-file/{fileId}/preview": { "get": { "operationId": "assistant_api-get-output-file-preview", "summary": "Get output file preview", "description": "Generate and get a preview of a task output file", "tags": [ "assistant_api" ], "security": [ { "bearer_auth": [] }, { "basic_auth": [] } ], "parameters": [ { "name": "apiVersion", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "v1" ], "default": "v1" } }, { "name": "ocpTaskId", "in": "path", "description": "The task ID", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "fileId", "in": "path", "description": "The task output file ID", "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": "The file preview has been generated and is returned", "content": { "*/*": { "schema": { "type": "string", "format": "binary" } } } }, "404": { "description": "The output file is 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": "string" } } } } } } } }, "303": { "description": "Fallback to the file type icon URL", "headers": { "Location": { "schema": { "type": "string" } } } } } } } }, "tags": [] }