Skip to content

Commit ddbd2c0

Browse files
authored
small docs adjustment (#141)
Signed-off-by: Alexander Piskun <[email protected]>
1 parent 9a6361b commit ddbd2c0

File tree

7 files changed

+35
-48
lines changed

7 files changed

+35
-48
lines changed

docs/MoreAPIs.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,32 @@
22

33
More APIs
44
=========
5+
6+
All provided APIs can be accessed using instance of `Nextcloud` or `NextcloudApp` class.
7+
8+
For example, let's print all Talk conversations for the current user:
9+
10+
.. code-block:: python
11+
12+
from nc_py_api import Nextcloud
13+
14+
15+
nc = Nextcloud(nextcloud_url="http://nextcloud.local", nc_auth_user="admin", nc_auth_pass="admin")
16+
all_conversations = nc.talk.get_user_conversations()
17+
for conversation in all_conversations:
18+
print(conversation.conversation_type.name + ": " + conversation.display_name)
19+
20+
Or let's find only your favorite conversations and send them a sweet message containing only heart emoticons: "❤️❤️❤️"
21+
22+
23+
.. code-block:: python
24+
25+
from nc_py_api import Nextcloud
26+
27+
28+
nc = Nextcloud(nextcloud_url="http://nextcloud.local", nc_auth_user="admin", nc_auth_pass="admin")
29+
all_conversations = nc.talk.get_user_conversations()
30+
for conversation in all_conversations:
31+
if conversation.is_favorite:
32+
print(conversation.conversation_type.name + ": " + conversation.display_name)
33+
nc.talk.send_message("❤️❤️❤️️", conversation)
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
How To Install
22
==============
33

4-
Currently, while AppAPI hasn't been published on the App Store, and App Store support hasn't been added yet,
5-
installation is a little bit tricky.
6-
7-
Steps to Install:
8-
9-
1. [Install AppAPI](https://cloud-py-api.github.io/app_api/Installation.html)
4+
1. [Install AppAPI](https://apps.nextcloud.com/apps/app_api)
105
2. Create a deployment daemon according to the [instructions](https://cloud-py-api.github.io/app_api/CreationOfDeployDaemon.html#create-deploy-daemon) of the AppPI
116
3. php occ app_api:app:deploy talk_bot "daemon_deploy_name" \
127
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml
@@ -17,12 +12,3 @@ Steps to Install:
1712
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot/appinfo/info.xml
1813

1914
to call its **enable** handler and accept all required API scopes by default.
20-
21-
22-
In a few months
23-
===============
24-
25-
1. Install AppAPI from App Store
26-
2. Configure Deploy Daemon with GUI provided by AppAPI
27-
3. Go to External Applications page in Nextcloud UI
28-
4. Find this bot in a list and press "Install" and "Enable" buttons, like with usual Applications.
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
How To Install
22
==============
33

4-
Currently, while AppAPI hasn't been published on the App Store, and App Store support hasn't been added yet,
5-
installation is a little bit tricky.
6-
7-
Steps to Install:
8-
9-
1. [Install AppAPI](https://cloud-py-api.github.io/app_api/Installation.html)
4+
1. [Install AppAPI](https://apps.nextcloud.com/apps/app_api)
105
2. Create a deployment daemon according to the [instructions](https://cloud-py-api.github.io/app_api/CreationOfDeployDaemon.html#create-deploy-daemon) of the AppPI
116
3. php occ app_api:app:deploy talk_bot_ai "daemon_deploy_name" \
127
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_ai/appinfo/info.xml
@@ -17,12 +12,3 @@ Steps to Install:
1712
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_ai/appinfo/info.xml
1813

1914
to call its **enable** handler and accept all required API scopes by default.
20-
21-
22-
In a few months
23-
===============
24-
25-
1. Install AppAPI from App Store
26-
2. Configure Deploy Daemon with GUI provided by AppAPI
27-
3. Go to External Applications page in Nextcloud UI
28-
4. Find this bot in a list and press "Install" and "Enable" buttons, like with usual Applications.
Loading

examples/as_app/talk_bot_ai/src/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
from nc_py_api.ex_app import run_app, set_handlers, talk_bot_app
1515

1616
APP = FastAPI()
17-
AI_BOT = talk_bot.TalkBot("/ai_talk_bot", "AI talk bot", "Usage: `@ai What sounds do cats make?`")
17+
AI_BOT = talk_bot.TalkBot("/ai_talk_bot", "AI talk bot", "Usage: `@assistant What sounds do cats make?`")
1818
MODEL_NAME = "MBZUAI/LaMini-Flan-T5-77M"
1919
MODEL_INIT_THREAD = None
2020

2121

2222
def ai_talk_bot_process_request(message: talk_bot.TalkBotMessage):
23-
r = re.search(r"@ai\s(.*)", message.object_content["message"], re.IGNORECASE)
23+
r = re.search(r"@assistant\s(.*)", message.object_content["message"], re.IGNORECASE)
2424
if r is None:
2525
return
2626
model = pipeline("text2text-generation", model=MODEL_NAME)
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
How To Install
22
==============
33

4-
Currently, while AppAPI hasn't been published on the App Store, and App Store support hasn't been added yet,
5-
installation is a little bit tricky.
6-
7-
Steps to Install:
8-
9-
1. [Install AppAPI](https://cloud-py-api.github.io/app_api/Installation.html)
4+
1. [Install AppAPI](https://apps.nextcloud.com/apps/app_api)
105
2. Create a deployment daemon according to the [instructions](https://cloud-py-api.github.io/app_api/CreationOfDeployDaemon.html#create-deploy-daemon) of the AppPI
116
3. php occ app_api:app:deploy talk_bot_multi "daemon_deploy_name" \
127
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_multi/appinfo/info.xml
@@ -17,12 +12,3 @@ Steps to Install:
1712
--info-xml https://raw.githubusercontent.com/cloud-py-api/nc_py_api/main/examples/as_app/talk_bot_multi/appinfo/info.xml
1813

1914
to call its **enable** handler and accept all required API scopes by default.
20-
21-
22-
In a few months
23-
===============
24-
25-
1. Install AppAPI from App Store
26-
2. Configure Deploy Daemon with GUI provided by AppAPI
27-
3. Go to External Applications page in Nextcloud UI
28-
4. Find this bot in a list and press "Install" and "Enable" buttons, like with usual Applications.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ authors = [
2020
]
2121
requires-python = ">=3.9"
2222
classifiers = [
23-
"Development Status :: 2 - Pre-Alpha",
23+
"Development Status :: 3 - Alpha",
2424
"Intended Audience :: Developers",
2525
"License :: OSI Approved :: BSD License",
2626
"Operating System :: MacOS :: MacOS X",

0 commit comments

Comments
 (0)