Skip to content

Commit 448b6b5

Browse files
mpivchevtobiasKaminsky
authored andcommitted
Additional docs
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
1 parent 4f09e3a commit 448b6b5

2 files changed

Lines changed: 115 additions & 10 deletions

File tree

developer_manual/client_apis/ClientIntegration/index.rst

Lines changed: 115 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,28 @@
44
Client Integration
55
==================
66

7-
With Nextcloud Hub 26 Winter we introduce a new client integration API. It allows server side apps to expose integrations on Desktop and Mobile.
8-
For now we support adding app-defined actions to "context menu" of files and folders.
7+
With Nextcloud Hub 26 Winter we are introducing a new client integration API. It allows server side apps to expose integrations on Desktop and Mobile.
8+
For now we support adding app-defined actions to a "context menu" of files and folders.
99

10-
The idea behind it, is to ease the integration of specific actions on clients without the need to write and maintain code on those platforms.
10+
It allows providing easy integration of specific actions on clients without the need to write and maintain code on those platforms.
1111

1212
Supported clients
1313
-----------------
1414

15-
Android: 3.36.0
16-
Desktop: 4.1.0
17-
iOS: 7.3.0
15+
Android: 3.36.0 and above
16+
17+
Desktop: 4.1.0 and above
18+
19+
iOS: 7.3.0 and above
1820

1921
Supported server apps
2022
---------------------
2123
richdocuments: Convert .docx to .md
24+
2225
assistant: Transcribe audio file
26+
2327
files_zip: Zip a file or folder
28+
2429
contacts: Create new contact from vfc
2530

2631
Exposing actions via capability
@@ -57,7 +62,7 @@ Requirements:
5762
- all urls must be relative
5863
- params is used for body params (currently only POST)
5964
- Icons are always svgs
60-
- Methoth: supported POST/GET
65+
- Method: supports POST/GET
6166

6267
.. code::
6368
[
@@ -72,16 +77,49 @@ Requirements:
7277
Response
7378
--------
7479
When clicking on a menu entry the client sends a predefined request to the server.
75-
The app in question can then handle the request and can send two different response types.
80+
The app in question can then handle the request and can send two different response types:
7681

7782
Declarative UI
7883
^^^^^^^^^^^^^^
84+
The declarative UI response allows the app to send back a new UI to be rendered by the client:
85+
- version: Indicates which version it is. Clients will be backwards compatible. If server sends a newer version than the client can understand the response will be ignored.
86+
- tooltip: Translated text, which will be shown as tooltip / snackbar.
87+
88+
.. code::
89+
90+
{
91+
"ocs": {
92+
"meta": {
93+
"status": "ok",
94+
"statuscode": 200,
95+
"message": "OK"
96+
},
97+
"data": {
98+
"version": 0.1,
99+
"root": {
100+
"orientation": "vertical",
101+
"rows": [
102+
{
103+
"children": [
104+
{
105+
"element": "URL",
106+
"text": "Link created",
107+
"url": "/some/link/to/a/page"
108+
}
109+
]
110+
}
111+
]
112+
}
113+
}
114+
}
115+
}
79116
117+
At the moment only rows with text and url elements are supported, but in the future we will add more elements and options.
80118

81119
Tooltip Response
82120
^^^^^^^^^^^^^^^^
83121
The tooltip response is a regular DataResponse type, with payload:
84-
- version: Indicates which version it is. Clients will be backward compatible. If server sends a newer version than the client can understand the response will be ignored.
122+
- version: Indicates which version it is. Clients will be backwards compatible. If server sends a newer version than the client can understand the response will be ignored.
85123
- tooltip: Translated text, which will be shown as tooltip / snackbar.
86124

87125
.. code::
@@ -99,9 +137,76 @@ The tooltip response is a regular DataResponse type, with payload:
99137
}
100138
}
101139
140+
Example:
141+
----------
142+
Here is an example of using the Assistant app.
143+
144+
**Capabilities:**
145+
146+
`ocs/v1.php/cloud/capabilities` returns the following capability:
147+
148+
.. code::
149+
"client_integration": {
150+
"assistant": {
151+
"version": 0.1,
152+
"context-menu": [
153+
{
154+
"name": "Summarize using AI",
155+
"url": "/ocs/v2.php/apps/assistant/api/v1/file-action/{fileId}/core:text2text:summary",
156+
"method": "POST",
157+
"mimetype_filters": "text/, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.oasis.opendocument.text, application/pdf",
158+
"icon": "/apps/assistant/img/client_integration/summarize.svg"
159+
},
160+
{
161+
"name": "Transcribe audio using AI",
162+
"url": "/ocs/v2.php/apps/assistant/api/v1/file-action/{fileId}/core:audio2text",
163+
"method": "POST",
164+
"mimetype_filters": "audio/",
165+
"icon": "/apps/assistant/img/client_integration/speech_to_text.svg"
166+
},
167+
{
168+
"name": "Text-To-Speech using AI",
169+
"url": "/ocs/v2.php/apps/assistant/api/v1/file-action/{fileId}/core:text2speech",
170+
"method": "POST",
171+
"mimetype_filters": "text/, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.oasis.opendocument.text, application/pdf",
172+
"icon": "/apps/assistant/img/client_integration/text_to_speech.svg"
173+
}
174+
]
175+
},
176+
},
177+
178+
The Assistant integration has a few endpoints for the client to show and execute. They appear like this on the client side:
179+
180+
.. image:: /images/client-integration-ios.png
181+
alt: "Client integration on iOS"
182+
183+
.. image:: /images/client-integration-android.png
184+
alt: "Client integration on Android"
185+
186+
.. image:: /images/client-integration-desktop.png
187+
alt: "Client integration on Desktop"
188+
189+
Looking at the "Summarize using AI" action, it will only show for files with mimetypes starting with "text/" or the specified document and PDF mimetypes, as described in `mimetype_filters`.
190+
When clicking on the action, the client will send a POST request to the specified URL, replacing {fileId} with the actual file id. The app can then handle the request and for example send a tooltip response back to the client. The client will show the tooltip to the user:
191+
192+
.. code::
193+
194+
{
195+
"ocs": {
196+
"meta": {
197+
"status": "ok",
198+
"statuscode": 200,
199+
"message": "OK"
200+
},
201+
"data": {
202+
"version": 0.1,
203+
"tooltip": "Summarization task submitted successfully"
204+
}
205+
}
206+
}
207+
102208
Issues/Bugs
103209
-----------
104210

105211
Please report issues, bugs or feature requests at https://github.com/nextcloud/files-clients with label "Client integration".
106212

107-
432 KB
Loading

0 commit comments

Comments
 (0)