diff options
author | Jonas <jonas@freesources.org> | 2024-07-08 11:29:26 +0200 |
---|---|---|
committer | Jonas <jonas@freesources.org> | 2024-07-17 12:56:41 +0200 |
commit | 1671bf3ef219dd641b51b4d154ea701c6a7cf6b9 (patch) | |
tree | 70b971f9fea1968d7ec3c48b71dd5d1522500922 /core/openapi-full.json | |
parent | b06ce832d8f280b9c008b91c41757e8eab37dc77 (diff) | |
download | nextcloud-server-1671bf3ef219dd641b51b4d154ea701c6a7cf6b9.tar.gz nextcloud-server-1671bf3ef219dd641b51b4d154ea701c6a7cf6b9.zip |
feat(Reference): Add public API endpoints to get references
Calling the public API endpoints will check for matching registered
reference providers that implement `IPublicReferenceProvider` and call
their respective functions. If no matching provider is found, the
default `LinkReferenceProvider` will be used to provide open graph data.
The frontend reference widget components will call these endpoints from
unauthorized sessions, e.g. in public shares.
If present, the sharing token of the origin URL is passed to
`resolveReferencePublic()` as additional information for the reference
provider to determine the access scope. This allows the respective
reference providers to determine whether the origin share has access to
the linked resource.
`getCacheKeyPublic` also gets the sharing token so it can scope the cached
entry to it.
Contributes to #45978
Signed-off-by: Jonas <jonas@freesources.org>
Diffstat (limited to 'core/openapi-full.json')
-rw-r--r-- | core/openapi-full.json | 312 |
1 files changed, 312 insertions, 0 deletions
diff --git a/core/openapi-full.json b/core/openapi-full.json index b70e82c3ee8..a62e587bf06 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -3059,6 +3059,115 @@ } } }, + "/ocs/v2.php/references/extractPublic": { + "post": { + "operationId": "reference_api-extract-public", + "summary": "Extract references from a text", + "tags": [ + "reference_api" + ], + "security": [ + {}, + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "text", + "sharingToken" + ], + "properties": { + "text": { + "type": "string", + "description": "Text to extract from" + }, + "sharingToken": { + "type": "string", + "description": "Token of the public share" + }, + "resolve": { + "type": "boolean", + "default": false, + "description": "Resolve the references" + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Maximum amount of references to extract, limited to 15" + } + } + } + } + } + }, + "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": "References 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": [ + "references" + ], + "properties": { + "references": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Reference", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + } + } + }, "/ocs/v2.php/references/resolve": { "get": { "operationId": "reference_api-resolve-one", @@ -3250,6 +3359,209 @@ } } }, + "/ocs/v2.php/references/resolvePublic": { + "get": { + "operationId": "reference_api-resolve-one-public", + "summary": "Resolve from a public page", + "tags": [ + "reference_api" + ], + "security": [ + {}, + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "reference", + "sharingToken" + ], + "properties": { + "reference": { + "type": "string", + "description": "Reference to resolve" + }, + "sharingToken": { + "type": "string", + "description": "Token of the public share" + } + } + } + } + } + }, + "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": "Reference 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": [ + "references" + ], + "properties": { + "references": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Reference", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "reference_api-resolve-public", + "summary": "Resolve multiple references from a public page", + "tags": [ + "reference_api" + ], + "security": [ + {}, + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "references", + "sharingToken" + ], + "properties": { + "references": { + "type": "array", + "description": "References to resolve", + "items": { + "type": "string" + } + }, + "sharingToken": { + "type": "string", + "description": "Token of the public share" + }, + "limit": { + "type": "integer", + "format": "int64", + "default": 1, + "description": "Maximum amount of references to resolve, limited to 15" + } + } + } + } + } + }, + "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": "References 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": [ + "references" + ], + "properties": { + "references": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Reference", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + } + } + }, "/ocs/v2.php/references/providers": { "get": { "operationId": "reference_api-get-providers-info", |