From 2a6d7ea96db5c53baebc1acdb206cf08490d8799 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 30 Jun 2024 21:32:18 +0200 Subject: [PATCH 1/3] Adds an example how to emi files:node:* events Signed-off-by: Cyrille Bollu --- developer_manual/client_apis/files.rst | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/developer_manual/client_apis/files.rst b/developer_manual/client_apis/files.rst index e02451b02..9d42585bf 100644 --- a/developer_manual/client_apis/files.rst +++ b/developer_manual/client_apis/files.rst @@ -30,7 +30,9 @@ the ``event-bus`` and use the following events: * ``files:node:moved``: the node has been moved (and its data is already updated) * ``files:node:updated``: the node data has been updated -Example +All these events use a Node as argument. + +Examples ------- .. code-block:: ts @@ -42,6 +44,20 @@ Example console.log('Node created', node) }) +.. code-block:: ts + + import { davGetClient, davGetDefaultPropfind, davResultToNode, davRootPath } from '@nextcloud/files' + import { emit } from '@nextcloud/event-bus' + + const client = davGetClient() + client.stat(`${davRootPath}${filename}`, { + details: true, + data: davGetDefaultPropfind(), + }).then((result) => { + const node = davResultToNode(result.data) + emit('files:node:updated', node) + }) + Router ^^^^^^ From e43f3f816e798254a17a4ea5d7365bd4466ee8b0 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 5 Jul 2024 09:44:42 +0200 Subject: [PATCH 2/3] Removes example how to emit files:node:* events rather mention the davClient from @nextcloud/files to get a Node from a filename Signed-off-by: Cyrille Bollu --- developer_manual/client_apis/files.rst | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/developer_manual/client_apis/files.rst b/developer_manual/client_apis/files.rst index 9d42585bf..2100dc2a3 100644 --- a/developer_manual/client_apis/files.rst +++ b/developer_manual/client_apis/files.rst @@ -30,7 +30,7 @@ the ``event-bus`` and use the following events: * ``files:node:moved``: the node has been moved (and its data is already updated) * ``files:node:updated``: the node data has been updated -All these events use a Node as argument. +All these events use a Node as argument. You can use a webdav client (for example, by using the davGetClient function from `@nextcloud/files `__) to retrieve a node from a file's name. Examples ------- @@ -44,21 +44,6 @@ Examples console.log('Node created', node) }) -.. code-block:: ts - - import { davGetClient, davGetDefaultPropfind, davResultToNode, davRootPath } from '@nextcloud/files' - import { emit } from '@nextcloud/event-bus' - - const client = davGetClient() - client.stat(`${davRootPath}${filename}`, { - details: true, - data: davGetDefaultPropfind(), - }).then((result) => { - const node = davResultToNode(result.data) - emit('files:node:updated', node) - }) - - Router ^^^^^^ From 6e531997ed72bf08da15dc67ff9c3117420e2c32 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 13 Nov 2024 01:08:24 +0100 Subject: [PATCH 3/3] fix: typo in files docs Signed-off-by: Ferdinand Thiessen --- developer_manual/client_apis/files.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer_manual/client_apis/files.rst b/developer_manual/client_apis/files.rst index 2100dc2a3..8d5cf320c 100644 --- a/developer_manual/client_apis/files.rst +++ b/developer_manual/client_apis/files.rst @@ -33,7 +33,7 @@ the ``event-bus`` and use the following events: All these events use a Node as argument. You can use a webdav client (for example, by using the davGetClient function from `@nextcloud/files `__) to retrieve a node from a file's name. Examples -------- +-------- .. code-block:: ts