feat: add files api

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ
2023-05-23 10:21:20 +02:00
parent c3e6fbb0b9
commit 846d339ad6
4 changed files with 72 additions and 15 deletions

View File

@@ -25,13 +25,7 @@ Front-end changes
Added APIs
^^^^^^^^^^
* A new Files Router API allows you to control the files router service and update views, querys or param without page reload (`nextcloud/server#37824 <https://github.com/nextcloud/server/pull/37824>`_)
.. code-block:: js
// https://github.com/nextcloud/server/blob/master/apps/files/src/services/RouterService.ts
OCP.Files.Router.goTo('/trashbin?dir=/Unsplash.d1680193199')
OCP.Files.Router.goToRoute('fileslist', { view: 'files' }, { dir: '/Folders/Group folder' })
* A new Files Router API allows you to control the files router service and update views, querys or param without page reload. See :ref:`FilesAPI`
Back-end changes
----------------

View File

@@ -1,5 +1,5 @@
============
Activity API
============
========
Activity
========
Find the documentation in the `Activity app repo <https://github.com/nextcloud/activity/blob/master/docs/endpoint-v2.md>`__.

View File

@@ -0,0 +1,62 @@
.. _FilesAPI:
=====
Files
=====
.. sectionauthor:: John Molakvoæ <skjnldsv@protonmail.com>
.. versionadded:: 27
Since Nextcloud 27, the files app has been rewritten to use new standards
and frameworks. This means that the old documentation is no longer valid.
We will update and document the new files app APIs and methods here.
.. note:: Some external libraries offers in-depth technical documentation.
Please have a look at the following:
* https://github.com/nextcloud/nextcloud-files (`documentation <https://nextcloud.github.io/nextcloud-files/>`__)
* https://github.com/nextcloud/nextcloud-upload
Router
^^^^^^
To change views and parameters of the current Files app, we expose the router.
This directly maps to the Vue router. You can check their own `documentation <https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location>`__ to
better understand the methods.
.. code-block:: ts
/**
* Trigger a route change on the files app
*
* @param path the url path, eg: '/trashbin?dir=/Deleted'
* @param replace replace the current history
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goTo(path: string, replace: boolean = false): Promise<Route>
/**
* Trigger a route change on the files App
*
* @param name the route name
* @param params the route parameters
* @param query the url query parameters
* @param replace replace the current history
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goToRoute(
name?: string,
params?: Dictionary<string>,
query?: Dictionary<string | (string | null)[] | null | undefined>,
replace?: boolean,
): Promise<Route>
Examples
--------
.. code-block:: js
OCP.Files.Router.goTo('/trashbin?dir=/Unsplash.d1680193199')
OCP.Files.Router.goToRoute('fileslist', { view: 'files' }, { dir: '/Folders/Group folder' })

View File

@@ -8,10 +8,11 @@ Clients and Client APIs
:maxdepth: 2
general
android_library/index
WebDAV/index
OCS/index
LoginFlow/index
RemoteWipe/index
activity-api
android_library/index
files
LoginFlow/index
OCS/index
RemoteWipe/index
WebDAV/index